java.lang.Object
com.coderslagoon.crypto.estreamj.ciphers.dragon.Dragon
All Implemented Interfaces:
ICipher

public class Dragon extends Object implements ICipher
First version of Dragon with both 128bit and 256bit key support. Unrolling the main loop and maybe using local integers instead of the NLFSR array might increase the speed quite significantly. However one must also consider the increased code size then. Yet it is definitely a TODO since even the less optimized version performs quite well. Maybe we should to keep two implementations (compact+slower and big+faster) around?
  • Constructor Details

    • Dragon

      public Dragon(boolean use256bit)
  • 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()