public static void longToBigEndian(long[] ns, byte[] bs, int off) { for (int i = 0; i < ns.length; ++i) { longToBigEndian(ns[i], bs, off); off += 8; } }
protected byte[] getLengthTag(byte[] p2) { byte[] L2 = new byte[8]; if (p2 != null) { Pack.longToBigEndian(p2.length * 8L, L2, 0); } return L2; } }
public static byte[] longToBigEndian(long[] ns) { byte[] bs = new byte[8 * ns.length]; longToBigEndian(ns, bs, 0); return bs; }
public static byte[] longToBigEndian(long n) { byte[] bs = new byte[8]; longToBigEndian(n, bs, 0); return bs; }
public static byte[] asBytes(long[] x) { byte[] z = new byte[16]; Pack.longToBigEndian(x, z, 0); return z; }
public static void asBytes(long[] x, byte[] z) { Pack.longToBigEndian(x, z, 0); }
public static BigInteger toBigInteger64(long[] x) { byte[] bs = new byte[32]; for (int i = 0; i < 4; ++i) { long x_i = x[i]; if (x_i != 0L) { Pack.longToBigEndian(x_i, bs, (3 - i) << 3); } } return new BigInteger(1, bs); }
public int doFinal( byte[] out, int outOff) { finish(); Pack.longToBigEndian(H1, out, outOff); Pack.longToBigEndian(H2, out, outOff + 8); Pack.longToBigEndian(H3, out, outOff + 16); Pack.longToBigEndian(H4, out, outOff + 24); Pack.longToBigEndian(H5, out, outOff + 32); Pack.longToBigEndian(H6, out, outOff + 40); Pack.longToBigEndian(H7, out, outOff + 48); Pack.longToBigEndian(H8, out, outOff + 56); reset(); return DIGEST_LENGTH; }
public static BigInteger toBigInteger64(long[] x) { byte[] bs = new byte[72]; for (int i = 0; i < 9; ++i) { long x_i = x[i]; if (x_i != 0L) { Pack.longToBigEndian(x_i, bs, (8 - i) << 3); } } return new BigInteger(1, bs); } }
public static BigInteger toBigInteger64(long[] x) { byte[] bs = new byte[56]; for (int i = 0; i < 7; ++i) { long x_i = x[i]; if (x_i != 0L) { Pack.longToBigEndian(x_i, bs, (6 - i) << 3); } } return new BigInteger(1, bs); } }
public static BigInteger toBigInteger64(long[] x) { byte[] bs = new byte[24]; for (int i = 0; i < 3; ++i) { long x_i = x[i]; if (x_i != 0L) { Pack.longToBigEndian(x_i, bs, (2 - i) << 3); } } return new BigInteger(1, bs); }
public static BigInteger toBigInteger64(long[] x) { byte[] bs = new byte[16]; for (int i = 0; i < 2; ++i) { long x_i = x[i]; if (x_i != 0L) { Pack.longToBigEndian(x_i, bs, (1 - i) << 3); } } return new BigInteger(1, bs); }
public static BigInteger toBigInteger64(long[] x) { byte[] bs = new byte[40]; for (int i = 0; i < 5; ++i) { long x_i = x[i]; if (x_i != 0L) { Pack.longToBigEndian(x_i, bs, (4 - i) << 3); } } return new BigInteger(1, bs); } }
public int doFinal( byte[] out, int outOff) { finish(); Pack.longToBigEndian(H1, out, outOff); Pack.longToBigEndian(H2, out, outOff + 8); Pack.longToBigEndian(H3, out, outOff + 16); Pack.longToBigEndian(H4, out, outOff + 24); Pack.longToBigEndian(H5, out, outOff + 32); Pack.longToBigEndian(H6, out, outOff + 40); reset(); return DIGEST_LENGTH; }
private static byte[] generateDefaultPersonalizationString(byte[] seed) { return Arrays.concatenate(Strings.toByteArray("Default"), seed, Pack.longToBigEndian(Thread.currentThread().getId()), Pack.longToBigEndian(System.currentTimeMillis())); }
public void addSeedMaterial(long seed) { addSeedMaterial(Pack.longToBigEndian(seed)); }
protected void populateState(byte[] state) { System.arraycopy(xBuf, 0, state, 0, xBufOff); Pack.intToBigEndian(xBufOff, state, 4); Pack.longToBigEndian(byteCount, state, 8); }
private static TlsNonceGenerator createNonceGenerator(TlsCrypto crypto, SecurityParameters securityParameters) { byte[] additionalSeedMaterial = new byte[16]; Pack.longToBigEndian(nextCounterValue(), additionalSeedMaterial, 0); Pack.longToBigEndian(Times.nanoTime(), additionalSeedMaterial, 8); additionalSeedMaterial[0] = (byte)securityParameters.entity; return crypto.createNonceGenerator(additionalSeedMaterial); }
protected byte[] toByteArray() { byte[] byteRepresentation = new byte[32]; Pack.intToBigEndian(layerAddress, byteRepresentation, 0); Pack.longToBigEndian(treeAddress, byteRepresentation, 4); Pack.intToBigEndian(type, byteRepresentation, 12); Pack.intToBigEndian(keyAndMask, byteRepresentation, 28); return byteRepresentation; }
/** * Construct a X9.31 secure random generator using the passed in engine and key. If predictionResistant is true the * generator will be reseeded on each request. * * @param engine a block cipher to use as the operator. * @param key the block cipher key to initialise engine with. * @param predictionResistant true if engine to be reseeded on each use, false otherwise. * @return a SecureRandom. */ public X931SecureRandom build(BlockCipher engine, KeyParameter key, boolean predictionResistant) { if (dateTimeVector == null) { dateTimeVector = new byte[engine.getBlockSize()]; Pack.longToBigEndian(System.currentTimeMillis(), dateTimeVector, 0); } engine.init(true, key); return new X931SecureRandom(random, new X931RNG(engine, dateTimeVector, entropySourceProvider.get(engine.getBlockSize() * 8)), predictionResistant); } }