Interface GenericHash.Native
- All Known Implementing Classes:
LazySodium,LazySodiumJava
- Enclosing interface:
- GenericHash
public static interface GenericHash.Native
-
Method Summary
Modifier and TypeMethodDescriptionbooleancryptoGenericHash(byte[] out, int outLen, byte[] in, long inLen) Hash a byte array without a key.booleancryptoGenericHash(byte[] out, int outLen, byte[] in, long inLen, byte[] key, int keyLen) Hash a byte array.booleancryptoGenericHashFinal(byte[] state, byte[] out, int outLen) Now that the hash has finalised, the hash can be put intoout.booleancryptoGenericHashInit(byte[] state, byte[] key, int keyLength, int outLen) Hash multiple parts of a message.booleancryptoGenericHashInit(byte[] state, int outLen) Hash multiple parts of a message without a keyvoidcryptoGenericHashKeygen(byte[] k) Generate a key.intbooleancryptoGenericHashUpdate(byte[] state, byte[] in, long inLen) Update a multi-part hashing with another part.
-
Method Details
-
cryptoGenericHashKeygen
void cryptoGenericHashKeygen(byte[] k) Generate a key. Store the key ink.- Parameters:
k- A place to store the generated key of sizeGenericHash.KEYBYTES. Though, it may be betweenGenericHash.KEYBYTESandGenericHash.KEYBYTES_MAX.
-
cryptoGenericHash
boolean cryptoGenericHash(byte[] out, int outLen, byte[] in, long inLen, byte[] key, int keyLen) Hash a byte array.- Parameters:
out- A place to store the resulting byte array. You may choose the output size, however the minimum recommended output size isGenericHash.BYTES. You may also specify a value betweenGenericHash.BYTES_MINandGenericHash.BYTES_MAX.outLen- Size of out.in- The text to hash.inLen- The size of in.key- The key generated bycryptoGenericHashKeygen(byte[]).keyLen- The length of the key.- Returns:
- True if successfully hashed.
-
cryptoGenericHash
boolean cryptoGenericHash(byte[] out, int outLen, byte[] in, long inLen) Hash a byte array without a key.- Parameters:
out- A place to store the resulting byte array. You may choose the output size, however the minimum recommended output size isGenericHash.BYTES. You may also specify a value betweenGenericHash.BYTES_MINandGenericHash.BYTES_MAX.outLen- Size of out.in- The text to hash.inLen- The size of in.- Returns:
- True if successfully hashed.
- See Also:
-
cryptoGenericHashInit
boolean cryptoGenericHashInit(byte[] state, byte[] key, int keyLength, int outLen) Hash multiple parts of a message.- Parameters:
state- The state which holds the key in memory for further hashing.key- The key generated bycryptoGenericHashKeygen(byte[]).keyLength- Length of the key.outLen- The size of the hash array. Please see the paramoutincryptoGenericHash(byte[], int, byte[], long, byte[], int)for more information.- Returns:
- True if initialised.
-
cryptoGenericHashInit
boolean cryptoGenericHashInit(byte[] state, int outLen) Hash multiple parts of a message without a key- Parameters:
state- The state which holds the current state in memory for further hashing.outLen- The size of the hash array. Please see the paramoutincryptoGenericHash(byte[], int, byte[], long, byte[], int)for more information.- Returns:
- True if initialised.
-
cryptoGenericHashUpdate
boolean cryptoGenericHashUpdate(byte[] state, byte[] in, long inLen) Update a multi-part hashing with another part.- Parameters:
state- The state.in- Another hash part.inLen- The length if the hash part.- Returns:
- True if this part of the message was hashed.
-
cryptoGenericHashFinal
boolean cryptoGenericHashFinal(byte[] state, byte[] out, int outLen) Now that the hash has finalised, the hash can be put intoout.- Parameters:
state- The state.out- The final hash.outLen- The length of the hash.- Returns:
- True if hashed.
-
cryptoGenericHashStateBytes
int cryptoGenericHashStateBytes()
-