public int doFinal(byte[] out, int outOff) throws DataLengthException, IllegalStateException { //padding with zero while (bufOff < blockSize) { buf[bufOff] = 0; bufOff++; } byte[] sumbuf = new byte[buf.length]; System.arraycopy(buf, 0, sumbuf, 0, mac.length); if (firstStep) { firstStep = false; } else { sumbuf = CM5func(buf, 0, mac); } gost28147MacFunc(workingKey, sumbuf, 0, mac, 0); System.arraycopy(mac, (mac.length/2)-macSize, out, outOff, macSize); reset(); return macSize; }
public int doFinal(byte[] out, int outOff) throws DataLengthException, IllegalStateException { //padding with zero while (bufOff < blockSize) { buf[bufOff] = 0; bufOff++; } byte[] sumbuf = new byte[buf.length]; System.arraycopy(buf, 0, sumbuf, 0, mac.length); if (firstStep) { firstStep = false; } else { sumbuf = CM5func(buf, 0, mac); } gost28147MacFunc(workingKey, sumbuf, 0, mac, 0); System.arraycopy(mac, (mac.length/2)-macSize, out, outOff, macSize); reset(); return macSize; }
public void init( CipherParameters params) throws IllegalArgumentException { reset(); buf = new byte[blockSize]; if (params instanceof ParametersWithSBox) { ParametersWithSBox param = (ParametersWithSBox)params; // // Set the S-Box // System.arraycopy(param.getSBox(), 0, this.S, 0, param.getSBox().length); // // set key if there is one // if (param.getParameters() != null) { workingKey = generateWorkingKey(((KeyParameter)param.getParameters()).getKey()); } } else if (params instanceof KeyParameter) { workingKey = generateWorkingKey(((KeyParameter)params).getKey()); } else { throw new IllegalArgumentException("invalid parameter passed to GOST28147 init - " + params.getClass().getName()); } }
throws IllegalArgumentException reset(); buf = new byte[blockSize]; macIV = null;