Interface GenericHash.Native

All Known Implementing Classes:
LazySodium, LazySodiumJava
Enclosing interface:
GenericHash

public static interface GenericHash.Native
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    cryptoGenericHash(byte[] out, int outLen, byte[] in, long inLen)
    Hash a byte array without a key.
    boolean
    cryptoGenericHash(byte[] out, int outLen, byte[] in, long inLen, byte[] key, int keyLen)
    Hash a byte array.
    boolean
    cryptoGenericHashFinal(byte[] state, byte[] out, int outLen)
    Now that the hash has finalised, the hash can be put into out.
    boolean
    cryptoGenericHashInit(byte[] state, byte[] key, int keyLength, int outLen)
    Hash multiple parts of a message.
    boolean
    cryptoGenericHashInit(byte[] state, int outLen)
    Hash multiple parts of a message without a key
    void
    Generate a key.
    int
     
    boolean
    cryptoGenericHashUpdate(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 in k.
      Parameters:
      k - A place to store the generated key of size GenericHash.KEYBYTES. Though, it may be between GenericHash.KEYBYTES and GenericHash.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 is GenericHash.BYTES. You may also specify a value between GenericHash.BYTES_MIN and GenericHash.BYTES_MAX.
      outLen - Size of out.
      in - The text to hash.
      inLen - The size of in.
      key - The key generated by cryptoGenericHashKeygen(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 is GenericHash.BYTES. You may also specify a value between GenericHash.BYTES_MIN and GenericHash.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 by cryptoGenericHashKeygen(byte[]).
      keyLength - Length of the key.
      outLen - The size of the hash array. Please see the param out in cryptoGenericHash(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 param out in cryptoGenericHash(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 into out.
      Parameters:
      state - The state.
      out - The final hash.
      outLen - The length of the hash.
      Returns:
      True if hashed.
    • cryptoGenericHashStateBytes

      int cryptoGenericHashStateBytes()