java.lang.Object
com.coderslagoon.crypto.estreamj.ciphers.salsa20.Salsa20
All Implemented Interfaces:
ICipher

public class Salsa20 extends Object implements ICipher
  • Constructor Details

    • Salsa20

      public Salsa20()
  • Method Details

    • erase

      public void erase()
      Description copied from interface: ICipher
      Erases all sensitive data. Instance MUST be abadonned afterwards.
      Specified by:
      erase in interface ICipher
    • getKeySize

      public int getKeySize()
      Specified by:
      getKeySize in interface ICipher
      Returns:
      key size in bytes
    • getNonceSize

      public int getNonceSize()
      Specified by:
      getNonceSize in interface ICipher
      Returns:
      nonce size in bytes.
    • getWordSize

      public int getWordSize()
      Specified by:
      getWordSize in interface ICipher
      Returns:
      alignment of data needed during calls into process()
    • isPatented

      public boolean isPatented()
      Specified by:
      isPatented in interface ICipher
      Returns:
      true: algorithm is patented, check with vendor for license details / false: free to use in private and commercial applications
    • process

      public void process(byte[] inBuf, int inOfs, byte[] outBuf, int outOfs, int len) throws ESJException
      Description copied from interface: ICipher
      Processes data.
      Specified by:
      process in interface ICipher
      Parameters:
      inBuf - input buffer
      inOfs - where to start reading from the input buffer
      outBuf - output buffer
      outOfs - where to start writing in the output buffer
      len - number of bytes to process, must be aligned to the cipher's word size except on the last call where an arbitrary size can be used
      Throws:
      ESJException - in any error occurred
    • reset

      public void reset() throws ESJException
      Description copied from interface: ICipher
      Resets the instance, so it can be reused.
      Specified by:
      reset in interface ICipher
      Throws:
      ESJException - if any error occurs
    • setupKey

      public void setupKey(int mode, byte[] key, int ofs) throws ESJException
      Description copied from interface: ICipher
      Sets up a new key with the existing instance.
      Specified by:
      setupKey in interface ICipher
      Parameters:
      mode - see MODE_xxx
      key - buffer with key material
      ofs - where the key starts
      Throws:
      ESJException - if any error occurs
    • setupNonce

      public void setupNonce(byte[] nonce, int ofs) throws ESJException
      Description copied from interface: ICipher
      Sets up a new nonce with the existing cipher instance.
      Specified by:
      setupNonce in interface ICipher
      Parameters:
      nonce - buffer with nonce material
      ofs - where the nonce starts
      Throws:
      ESJException - if any error occurs
    • register

      public static void register()