Package com.goterl.lazysodium.interfaces
Interface GenericHash.Lazy
-
- All Known Implementing Classes:
LazySodium,LazySodiumJava
- Enclosing interface:
- GenericHash
public static interface GenericHash.Lazy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringcryptoGenericHash(java.lang.String in)Hash a string without a key.java.lang.StringcryptoGenericHash(java.lang.String in, Key key)Hash a string with a key, so later on you can verify the hashed string with the key.java.lang.StringcryptoGenericHashFinal(byte[] state, int outLen)Finalise the hashing operation.booleancryptoGenericHashInit(byte[] state, Key key, int outLen)Initialise a multi-part hashing operation.KeycryptoGenericHashKeygen()Generate a hashing key.KeycryptoGenericHashKeygen(int size)Generate a hashing key with a size.booleancryptoGenericHashUpdate(byte[] state, java.lang.String in)Hash a part of a multi-part hash.
-
-
-
Method Detail
-
cryptoGenericHashKeygen
Key cryptoGenericHashKeygen()
Generate a hashing key.- Returns:
- A hashing key.
-
cryptoGenericHashKeygen
Key cryptoGenericHashKeygen(int size) throws SodiumException
Generate a hashing key with a size.- Parameters:
size- The size of the hashing key betweenGenericHash.KEYBYTESandGenericHash.KEYBYTES_MAX.- Returns:
- A hashing key.
- Throws:
SodiumException
-
cryptoGenericHash
java.lang.String cryptoGenericHash(java.lang.String in) throws SodiumExceptionHash a string without a key.- Parameters:
in- The string to hash.- Returns:
- The hashed string.
- Throws:
SodiumException
-
cryptoGenericHash
java.lang.String cryptoGenericHash(java.lang.String in, Key key) throws SodiumExceptionHash a string with a key, so later on you can verify the hashed string with the key. If you're hashing a password please seePwHash.Lazy.cryptoPwHashStr(String, long, NativeLong)} instead.- Parameters:
in- The string to hash.key- Can be null.- Returns:
- A hashed string.
- Throws:
SodiumException
-
cryptoGenericHashInit
boolean cryptoGenericHashInit(byte[] state, Key key, int outLen)Initialise a multi-part hashing operation.- Parameters:
state- The state which holds the key and operation.key- The key as generated bycryptoGenericHashKeygen().outLen- The size of the final hash.- Returns:
- True if initialised.
-
cryptoGenericHashUpdate
boolean cryptoGenericHashUpdate(byte[] state, java.lang.String in) throws SodiumExceptionHash a part of a multi-part hash.- Parameters:
state- State as put intocryptoGenericHashInit(byte[], Key, int).in- A part of a string to hash.- Returns:
- True if hashed successfully.
- Throws:
SodiumException
-
cryptoGenericHashFinal
java.lang.String cryptoGenericHashFinal(byte[] state, int outLen) throws SodiumExceptionFinalise the hashing operation.- Parameters:
state- State as put intocryptoGenericHashInit(byte[], Key, int).outLen- The size of the final hash.- Returns:
- The final hash.
- Throws:
SodiumException
-
-