Class CSHAKEDigest

All Implemented Interfaces:
Digest, EncodableDigest, EncodableService, ExtendedDigest, SavableDigest, Xof, Memoable

public class CSHAKEDigest extends SHAKEDigest
Customizable SHAKE function.
  • Constructor Details

    • CSHAKEDigest

      public CSHAKEDigest(int bitLength, byte[] N, byte[] S)
      Base constructor.
      Parameters:
      bitLength - security strength (in bits) of the underlying SHAKE function, 128 or 256.
      N - the function name string, note this is reserved for use by NIST. Avoid using it if not required.
      S - the customization string - available for local use.
    • CSHAKEDigest

      public CSHAKEDigest(int bitLength, CryptoServicePurpose purpose, byte[] N, byte[] S)
      Base constructor.
      Parameters:
      bitLength - security strength (in bits) of the underlying SHAKE function, 128 or 256.
      purpose - the purpose for constructing the CSHAKEDigest
      N - the function name string, note this is reserved for use by NIST. Avoid using it if not required.
      S - the customization string - available for local use.
    • CSHAKEDigest

      public CSHAKEDigest(CSHAKEDigest source)
    • CSHAKEDigest

      public CSHAKEDigest(byte[] encodedState)
  • Method Details

    • getAlgorithmName

      public String getAlgorithmName()
      Description copied from interface: Digest
      return the algorithm name
      Specified by:
      getAlgorithmName in interface Digest
      Overrides:
      getAlgorithmName in class SHAKEDigest
      Returns:
      the algorithm name
    • doOutput

      public int doOutput(byte[] out, int outOff, int outLen)
      Description copied from interface: Xof
      Start outputting the results of the final calculation for this digest. Unlike doFinal, this method will continue producing output until the Xof is explicitly reset, or signals otherwise.
      Specified by:
      doOutput in interface Xof
      Overrides:
      doOutput in class SHAKEDigest
      Parameters:
      out - output array to write the output bytes to.
      outOff - offset to start writing the bytes at.
      outLen - the number of output bytes requested.
      Returns:
      the number of bytes written
    • reset

      public void reset()
      Description copied from interface: Digest
      reset the digest back to it's initial state.
      Specified by:
      reset in interface Digest
      Overrides:
      reset in class KeccakDigest
    • getEncodedState

      public byte[] getEncodedState()
      Description copied from interface: EncodableDigest
      Return an encoded byte array for the digest's internal state
      Specified by:
      getEncodedState in interface EncodableDigest
      Specified by:
      getEncodedState in interface EncodableService
      Overrides:
      getEncodedState in class SHAKEDigest
      Returns:
      an encoding of the digests internal state.
    • copy

      public Memoable copy()
      Description copied from interface: Memoable
      Produce a copy of this object with its configuration and in its current state.

      The returned object may be used simply to store the state, or may be used as a similar object starting from the copied state.

      Specified by:
      copy in interface Memoable
      Overrides:
      copy in class SHAKEDigest
    • reset

      public void reset(Memoable other)
      Description copied from interface: Memoable
      Restore a copied object state into this object.

      Implementations of this method should try to avoid or minimise memory allocation to perform the reset.

      Specified by:
      reset in interface Memoable
      Overrides:
      reset in class SHAKEDigest
      Parameters:
      other - an object originally copied from an object of the same type as this instance.