Class ChaosTextEncrypter

  • All Implemented Interfaces:
    org.refcodes.mixin.Disposable, org.refcodes.security.Encrypter<String,​String,​org.refcodes.security.EncryptionException>

    public class ChaosTextEncrypter
    extends Object
    implements org.refcodes.security.Encrypter<String,​String,​org.refcodes.security.EncryptionException>
    The ChaosTextEncrypter will use String as input and output type.
    • Constructor Detail

      • ChaosTextEncrypter

        public ChaosTextEncrypter​(int x0,
                                  int a,
                                  int s)
        Instantiates a new ChaosTextEncrypter from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructor ChaosTextEncrypter(double, double, long). You can use values in the range of Integer.MIN_VALUE and Integer.MAX_VALUE.
        Parameters:
        x0 - The value from which to calculate the valid x0 double.
        a - The value from which to calculate the valid a double.
        s - The value from which to calculate the valid s double.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(double x0,
                                  double a,
                                  long s)
        Instantiates a new ChaosTextEncrypter directly from the provided double values. Make sure your provided arguments are within the allowed bounds;
        Parameters:
        x0 - the x0: (0 <= x0 <= 1 )
        a - the a: (a <= 3.57 <= 4 )
        s - the s: (s > Long.MAX_VALUE)
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(char[] aSecret)
        Instantiates a new ChaosTextEncrypter by calculating x0, a and s from the provided char array.
        Parameters:
        aSecret - The char array (in contrast to a String, a char array can be invalidated after use by overwriting its array elements with random values) from which to calculate x0, a and s.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(String aSecret)
        Instantiates a new ChaosTextEncrypter by calculating x0, a and s from the provided String.
        Parameters:
        aSecret - The String from which to calculate x0, a and s.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(int x0,
                                  int a,
                                  int s,
                                  ChaosOptions aChaosOptions)
        Instantiates a new ChaosTextEncrypter from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructor ChaosTextEncrypter(double, double, long). You can use values in the range of Integer.MIN_VALUE and Integer.MAX_VALUE.
        Parameters:
        x0 - The value from which to calculate the valid x0 double.
        a - The value from which to calculate the valid a double.
        s - The value from which to calculate the valid s double.
        aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(double x0,
                                  double a,
                                  long s,
                                  ChaosOptions aChaosOptions)
        Instantiates a new ChaosTextEncrypter directly from the provided double values. Make sure your provided arguments are within the allowed bounds;
        Parameters:
        x0 - the x0: (0 <= x0 <= 1 )
        a - the a: (a <= 3.57 <= 4 )
        s - the s: (s > Long.MAX_VALUE)
        aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(char[] aSecret,
                                  ChaosOptions aChaosOptions)
        Instantiates a new ChaosTextEncrypter by calculating x0, a and s from the provided char array.
        Parameters:
        aSecret - The char array (in contrast to a String, a char array can be invalidated after use by overwriting its array elements with random values) from which to calculate x0, a and s.
        aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(ChaosKey aKey,
                                  boolean isVerify)
        Instantiates a new ChaosTextEncrypter using the given ChaosKey for encrypting.
        Parameters:
        aKey - The ChaosKey to use for encrypting.
        isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(int x0,
                                  int a,
                                  int s,
                                  boolean isVerify)
        Instantiates a new ChaosTextEncrypter from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructor ChaosTextEncrypter(double, double, long). You can use values in the range of Integer.MIN_VALUE and Integer.MAX_VALUE.
        Parameters:
        x0 - The value from which to calculate the valid x0 double.
        a - The value from which to calculate the valid a double.
        s - The value from which to calculate the valid s double.
        isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(double x0,
                                  double a,
                                  long s,
                                  boolean isVerify)
        Instantiates a new ChaosTextEncrypter directly from the provided double values. Make sure your provided arguments are within the allowed bounds;
        Parameters:
        x0 - the x0: (0 <= x0 <= 1 )
        a - the a: (a <= 3.57 <= 4 )
        s - the s: (s > Long.MAX_VALUE)
        isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(char[] aSecret,
                                  boolean isVerify)
        Instantiates a new ChaosTextEncrypter by calculating x0, a and s from the provided char array.
        Parameters:
        aSecret - The char array (in contrast to a String, a char array can be invalidated after use by overwriting its array elements with random values) from which to calculate x0, a and s.
        isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(String aSecret,
                                  boolean isVerify)
        Instantiates a new ChaosTextEncrypter by calculating x0, a and s from the provided String.
        Parameters:
        aSecret - The String from which to calculate x0, a and s.
        isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(char[] aSecret,
                                  ChaosOptions aChaosOptions,
                                  boolean isVerify)
        Instantiates a new ChaosTextEncrypter by calculating x0, a and s from the provided char array.
        Parameters:
        aSecret - The char array (in contrast to a String, a char array can be invalidated after use by overwriting its array elements with random values) from which to calculate x0, a and s.
        aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
        isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(String aSecret,
                                  ChaosOptions aChaosOptions,
                                  boolean isVerify)
        Instantiates a new ChaosTextEncrypter by calculating x0, a and s from the provided String.
        Parameters:
        aSecret - The String from which to calculate x0, a and s.
        aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
        isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(int x0,
                                  int a,
                                  int s,
                                  ChaosOptions aChaosOptions,
                                  boolean isVerify)
        Instantiates a new ChaosTextEncrypter from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructor ChaosTextEncrypter(double, double, long). You can use values in the range of Integer.MIN_VALUE and Integer.MAX_VALUE.
        Parameters:
        x0 - The value from which to calculate the valid x0 double.
        a - The value from which to calculate the valid a double.
        s - The value from which to calculate the valid s double.
        aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
        isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
      • ChaosTextEncrypter

        public ChaosTextEncrypter​(double x0,
                                  double a,
                                  long s,
                                  ChaosOptions aChaosOptions,
                                  boolean isVerify)
        Instantiates a new ChaosTextEncrypter directly from the provided double values. Make sure your provided arguments are within the allowed bounds;
        Parameters:
        x0 - the x0: (0 <= x0 <= 1 )
        a - the a: (a <= 3.57 <= 4 )
        s - the s: (s > Long.MAX_VALUE)
        aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
        isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
    • Method Detail

      • toEncrypted

        public String toEncrypted​(String aDecrypted)
                           throws org.refcodes.security.EncryptionException
        Specified by:
        toEncrypted in interface org.refcodes.security.Encrypter<String,​String,​org.refcodes.security.EncryptionException>
        Throws:
        org.refcodes.security.EncryptionException
      • toEncrypted

        public int toEncrypted​(byte[] aInput,
                               int aInputOffset,
                               int aInputLength,
                               byte[] aOutput,
                               int aOutputOffset)
                        throws org.refcodes.security.EncryptionException
        Specified by:
        toEncrypted in interface org.refcodes.security.Encrypter<String,​String,​org.refcodes.security.EncryptionException>
        Throws:
        org.refcodes.security.EncryptionException
      • dispose

        public void dispose()
        Specified by:
        dispose in interface org.refcodes.mixin.Disposable