public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier) { return new GOST3411Digest(); } });
private void fw(byte[] in) { cpyBytesToShort(in, wS); w_S[15] = (short)(wS[0] ^ wS[1] ^ wS[2] ^ wS[3] ^ wS[12] ^ wS[15]); System.arraycopy(wS, 1, w_S, 0, 15); cpyShortToBytes(w_S, in); }
public void update(byte in) { xBuf[xBufOff++] = in; if (xBufOff == xBuf.length) { sumByteArray(xBuf); // calc sum M processBlock(xBuf, 0); xBufOff = 0; } byteCount++; }
public void update(byte[] in, int inOff, int len) { while ((xBufOff != 0) && (len > 0)) { update(in[inOff]); inOff++; len--; } while (len > xBuf.length) { System.arraycopy(in, inOff, xBuf, 0, xBuf.length); sumByteArray(xBuf); // calc sum M processBlock(xBuf, 0); inOff += xBuf.length; len -= xBuf.length; byteCount += xBuf.length; } // load in the remainder. while (len > 0) { update(in[inOff]); inOff++; len--; } }
private void finish() { Pack.longToLittleEndian(byteCount * 8, L, 0); // get length into L (byteCount * 8 = bitCount) while (xBufOff != 0) { update((byte)0); } processBlock(L, 0); processBlock(Sum, 0); }
/** * Copy constructor. This will copy the state of the provided * message digest. */ public GOST3411Digest(GOST3411Digest t) { reset(t); }
public void update(byte[] in, int inOff, int len) { while ((xBufOff != 0) && (len > 0)) { update(in[inOff]); inOff++; len--; } while (len > xBuf.length) { System.arraycopy(in, inOff, xBuf, 0, xBuf.length); sumByteArray(xBuf); // calc sum M processBlock(xBuf, 0); inOff += xBuf.length; len -= xBuf.length; byteCount += xBuf.length; } // load in the remainder. while (len > 0) { update(in[inOff]); inOff++; len--; } }
public void update(byte in) { xBuf[xBufOff++] = in; if (xBufOff == xBuf.length) { sumByteArray(xBuf); // calc sum M processBlock(xBuf, 0); xBufOff = 0; } byteCount++; }
private void finish() { Pack.longToLittleEndian(byteCount * 8, L, 0); // get length into L (byteCount * 8 = bitCount) while (xBufOff != 0) { update((byte)0); } processBlock(L, 0); processBlock(Sum, 0); }
public void reset(Memoable other) { GOST3411Digest t = (GOST3411Digest)other; this.sBox = t.sBox; cipher.init(true, new ParametersWithSBox(null, sBox)); reset(); System.arraycopy(t.H, 0, this.H, 0, t.H.length); System.arraycopy(t.L, 0, this.L, 0, t.L.length); System.arraycopy(t.M, 0, this.M, 0, t.M.length); System.arraycopy(t.Sum, 0, this.Sum, 0, t.Sum.length); System.arraycopy(t.C[1], 0, this.C[1], 0, t.C[1].length); System.arraycopy(t.C[2], 0, this.C[2], 0, t.C[2].length); System.arraycopy(t.C[3], 0, this.C[3], 0, t.C[3].length); System.arraycopy(t.xBuf, 0, this.xBuf, 0, t.xBuf.length); this.xBufOff = t.xBufOff; this.byteCount = t.byteCount; } }
public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier) { return new GOST3411Digest(); } });
private void fw(byte[] in) { cpyBytesToShort(in, wS); w_S[15] = (short)(wS[0] ^ wS[1] ^ wS[2] ^ wS[3] ^ wS[12] ^ wS[15]); System.arraycopy(wS, 1, w_S, 0, 15); cpyShortToBytes(w_S, in); }
/** * Copy constructor. This will copy the state of the provided * message digest. */ public GOST3411Digest(GOST3411Digest t) { this.sBox = t.sBox; cipher.init(true, new ParametersWithSBox(null, sBox)); reset(); System.arraycopy(t.H, 0, this.H, 0, t.H.length); System.arraycopy(t.L, 0, this.L, 0, t.L.length); System.arraycopy(t.M, 0, this.M, 0, t.M.length); System.arraycopy(t.Sum, 0, this.Sum, 0, t.Sum.length); System.arraycopy(t.C[1], 0, this.C[1], 0, t.C[1].length); System.arraycopy(t.C[2], 0, this.C[2], 0, t.C[2].length); System.arraycopy(t.C[3], 0, this.C[3], 0, t.C[3].length); System.arraycopy(t.xBuf, 0, this.xBuf, 0, t.xBuf.length); this.xBufOff = t.xBufOff; this.byteCount = t.byteCount; }
public Digest() { super(new GOST3411Digest()); }
/** * Constructor to allow use of a particular sbox with GOST28147 * @see GOST28147Engine#getSBox(String) */ public GOST3411Digest(byte[] sBoxParam) { sBox = Arrays.clone(sBoxParam); cipher.init(true, new ParametersWithSBox(null, sBox)); reset(); }
public Memoable copy() { return new GOST3411Digest(this); }