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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private final byte[]
private int
private int
private int
private int
private int
private int
private int
private int
private int
private int
static final int
private int
private int
private int
private int
private int
private int
private int
private int
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
doFinal
(byte[] out, int offset) int
int
void
init
(byte[] key) private static void
packIntLE
(int value, byte[] dst, int off) private void
private void
reset()
private static int
unpackIntLE
(byte[] buf, int off) private static long
unsignedProduct
(int i1, int i2) void
update
(byte[] in, int offset, int length) void
updateUInt
(long value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
getAlgorithm
in interfaceAlgorithmNameProvider
-
init
-
update
public void update(byte[] in, int offset, int length) -
updateUInt
public void updateUInt(long value) - Specified by:
updateUInt
in interfaceMac
-
doFinal
-
processBlock
private void processBlock() -
reset
private void reset() -
getBlockSize
public int getBlockSize()- Specified by:
getBlockSize
in interfaceMacInformation
- Returns:
- MAC output block size in bytes - may be less than the default - e.g., MD5-96
-
getDefaultBlockSize
public int getDefaultBlockSize()- Specified by:
getDefaultBlockSize
in 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)
-