public Mac() { super(new org.spongycastle.crypto.macs.Poly1305()); } }
long tp0 = mul32x32_64(h0,r0) + mul32x32_64(h1,s4) + mul32x32_64(h2,s3) + mul32x32_64(h3,s2) + mul32x32_64(h4,s1); long tp1 = mul32x32_64(h0,r1) + mul32x32_64(h1,r0) + mul32x32_64(h2,s4) + mul32x32_64(h3,s3) + mul32x32_64(h4,s2); long tp2 = mul32x32_64(h0,r2) + mul32x32_64(h1,r1) + mul32x32_64(h2,r0) + mul32x32_64(h3,s4) + mul32x32_64(h4,s3); long tp3 = mul32x32_64(h0,r3) + mul32x32_64(h1,r2) + mul32x32_64(h2,r1) + mul32x32_64(h3,r0) + mul32x32_64(h4,s4); long tp4 = mul32x32_64(h0,r4) + mul32x32_64(h1,r3) + mul32x32_64(h2,r2) + mul32x32_64(h3,r1) + mul32x32_64(h4,r0);
Pack.longToLittleEndian(additionalDataLength & 0xFFFFFFFFL, lengths, 0); Pack.longToLittleEndian(ciphertextLength & 0xFFFFFFFFL, lengths, 8); mac.update(lengths, 0, 16); mac.doFinal(output, outputOffset + ciphertextLength); Pack.longToLittleEndian(additionalDataLength & 0xFFFFFFFFL, calculatedMAC, 0); Pack.longToLittleEndian(ciphertextLength & 0xFFFFFFFFL, calculatedMAC, 8); mac.update(calculatedMAC, 0, 16); mac.doFinal(calculatedMAC, 0);
processBlock(); Pack.intToLittleEndian((int)f3, out, outOff + 12); reset(); return BLOCK_SIZE;
public void update(final byte[] in, final int inOff, final int len) throws DataLengthException, IllegalStateException { int copied = 0; while (len > copied) { if (currentBlockOffset == BLOCK_SIZE) { processBlock(); currentBlockOffset = 0; } int toCopy = Math.min((len - copied), BLOCK_SIZE - currentBlockOffset); System.arraycopy(in, copied + inOff, currentBlock, currentBlockOffset, toCopy); copied += toCopy; currentBlockOffset += toCopy; } }
protected void initMAC() { byte[] firstBlock = new byte[64]; cipher.processBytes(firstBlock, 0, 64, firstBlock, 0); mac.init(new KeyParameter(firstBlock, 0, 32)); Arrays.fill(firstBlock, (byte)0); }
public Poly1305() { super(new org.spongycastle.crypto.macs.Poly1305(new NoekeonEngine())); } }
public void update(final byte in) throws IllegalStateException { singleByte[0] = in; update(singleByte, 0, 1); }
public Poly1305() { super(new org.spongycastle.crypto.macs.Poly1305(new CAST6Engine())); } }
public Poly1305() { super(new org.spongycastle.crypto.macs.Poly1305(new AESEngine())); } }
public Poly1305() { super(new org.spongycastle.crypto.macs.Poly1305(new TwofishEngine())); } }
public Poly1305() { super(new org.spongycastle.crypto.macs.Poly1305(new SEEDEngine())); } }
public Poly1305() { super(new org.spongycastle.crypto.macs.Poly1305(new ARIAEngine())); } }
public Poly1305() { super(new org.spongycastle.crypto.macs.Poly1305(new TwofishEngine())); } }
public Poly1305() { super(new org.spongycastle.crypto.macs.Poly1305(new SM4Engine())); } }
public Poly1305() { super(new org.spongycastle.crypto.macs.Poly1305(new CamelliaEngine())); } }
public Poly1305() { super(new org.spongycastle.crypto.macs.Poly1305(new RC6Engine())); } }
protected byte[] calculateRecordMAC(KeyParameter macKey, byte[] additionalData, byte[] buf, int off, int len) { Mac mac = new Poly1305(); mac.init(macKey); updateRecordMACText(mac, additionalData, 0, additionalData.length); updateRecordMACText(mac, buf, off, len); updateRecordMACLength(mac, additionalData.length); updateRecordMACLength(mac, len); byte[] output = new byte[mac.getMacSize()]; mac.doFinal(output, 0); return output; }