Package org.apache.sshd.common.mac
Class Poly1305Mac
java.lang.Object
org.apache.sshd.common.mac.Poly1305Mac
- All Implemented Interfaces:
AlgorithmNameProvider,Mac,MacInformation
Poly1305 one-time message authentication code. This implementation is derived from the public domain C library
poly1305-donna.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final byte[]private intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intstatic final intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoFinal(byte[] out, int offset) intintvoidinit(byte[] key) private static voidpackIntLE(int value, byte[] dst, int off) private voidprivate voidreset()private static intunpackIntLE(byte[] buf, int off) private static longunsignedProduct(int i1, int i2) voidupdate(byte[] in, int offset, int length) voidupdateUInt(long value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sshd.common.mac.MacInformation
isEncryptThenMac
-
Field Details
-
KEY_BYTES
public static final int KEY_BYTES- See Also:
-
BLOCK_SIZE
private static final int BLOCK_SIZE- See Also:
-
r0
private int r0 -
r1
private int r1 -
r2
private int r2 -
r3
private int r3 -
r4
private int r4 -
s1
private int s1 -
s2
private int s2 -
s3
private int s3 -
s4
private int s4 -
k0
private int k0 -
k1
private int k1 -
k2
private int k2 -
k3
private int k3 -
h0
private int h0 -
h1
private int h1 -
h2
private int h2 -
h3
private int h3 -
h4
private int h4 -
currentBlock
private final byte[] currentBlock -
currentBlockOffset
private int currentBlockOffset
-
-
Constructor Details
-
Poly1305Mac
public Poly1305Mac()
-
-
Method Details
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceAlgorithmNameProvider
-
init
-
update
public void update(byte[] in, int offset, int length) -
updateUInt
public void updateUInt(long value) - Specified by:
updateUIntin interfaceMac
-
doFinal
-
processBlock
private void processBlock() -
reset
private void reset() -
getBlockSize
public int getBlockSize()- Specified by:
getBlockSizein interfaceMacInformation- Returns:
- MAC output block size in bytes - may be less than the default - e.g., MD5-96
-
getDefaultBlockSize
public int getDefaultBlockSize()- Specified by:
getDefaultBlockSizein interfaceMacInformation- Returns:
- The "natural" MAC block size in bytes
-
unpackIntLE
private static int unpackIntLE(byte[] buf, int off) -
packIntLE
private static void packIntLE(int value, byte[] dst, int off) -
unsignedProduct
private static long unsignedProduct(int i1, int i2)
-