Package org.refcodes.security.alt.chaos
Class ChaosTextEncrypter
- java.lang.Object
-
- org.refcodes.security.alt.chaos.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>
TheChaosTextEncrypter
will useString
as input and output type.
-
-
Constructor Summary
Constructors Constructor Description ChaosTextEncrypter(char[] aSecret)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the provided char array.ChaosTextEncrypter(char[] aSecret, boolean isVerify)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the provided char array.ChaosTextEncrypter(char[] aSecret, ChaosOptions aChaosOptions)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the provided char array.ChaosTextEncrypter(char[] aSecret, ChaosOptions aChaosOptions, boolean isVerify)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the provided char array.ChaosTextEncrypter(double x0, double a, long s)
Instantiates a newChaosTextEncrypter
directly from the provided double values.ChaosTextEncrypter(double x0, double a, long s, boolean isVerify)
Instantiates a newChaosTextEncrypter
directly from the provided double values.ChaosTextEncrypter(double x0, double a, long s, ChaosOptions aChaosOptions)
Instantiates a newChaosTextEncrypter
directly from the provided double values.ChaosTextEncrypter(double x0, double a, long s, ChaosOptions aChaosOptions, boolean isVerify)
Instantiates a newChaosTextEncrypter
directly from the provided double values.ChaosTextEncrypter(int x0, int a, int s)
Instantiates a newChaosTextEncrypter
from the provided integer values.ChaosTextEncrypter(int x0, int a, int s, boolean isVerify)
Instantiates a newChaosTextEncrypter
from the provided integer values.ChaosTextEncrypter(int x0, int a, int s, ChaosOptions aChaosOptions)
Instantiates a newChaosTextEncrypter
from the provided integer values.ChaosTextEncrypter(int x0, int a, int s, ChaosOptions aChaosOptions, boolean isVerify)
Instantiates a newChaosTextEncrypter
from the provided integer values.ChaosTextEncrypter(String aSecret)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the providedString
.ChaosTextEncrypter(String aSecret, boolean isVerify)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the providedString
.ChaosTextEncrypter(String aSecret, ChaosOptions aChaosOptions)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the providedString
.ChaosTextEncrypter(String aSecret, ChaosOptions aChaosOptions, boolean isVerify)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the providedString
.ChaosTextEncrypter(ChaosKey aKey)
Instantiates a newChaosTextEncrypter
using the givenChaosKey
for encrypting.ChaosTextEncrypter(ChaosKey aKey, boolean isVerify)
Instantiates a newChaosTextEncrypter
using the givenChaosKey
for encrypting.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
int
toEncrypted(byte[] aInput, int aInputOffset, int aInputLength, byte[] aOutput, int aOutputOffset)
String
toEncrypted(String aDecrypted)
-
-
-
Constructor Detail
-
ChaosTextEncrypter
public ChaosTextEncrypter(ChaosKey aKey)
Instantiates a newChaosTextEncrypter
using the givenChaosKey
for encrypting.- Parameters:
aKey
- TheChaosKey
to use for encrypting.
-
ChaosTextEncrypter
public ChaosTextEncrypter(int x0, int a, int s)
Instantiates a newChaosTextEncrypter
from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructorChaosTextEncrypter(double, double, long)
. You can use values in the range ofInteger.MIN_VALUE
andInteger.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 newChaosTextEncrypter
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 newChaosTextEncrypter
by calculating x0, a and s from the provided char array.- Parameters:
aSecret
- The char array (in contrast to aString
, 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 newChaosTextEncrypter
by calculating x0, a and s from the providedString
.- Parameters:
aSecret
- TheString
from which to calculate x0, a and s.
-
ChaosTextEncrypter
public ChaosTextEncrypter(int x0, int a, int s, ChaosOptions aChaosOptions)
Instantiates a newChaosTextEncrypter
from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructorChaosTextEncrypter(double, double, long)
. You can use values in the range ofInteger.MIN_VALUE
andInteger.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
- TheChaosMode
(ChaosOptions
) to use to enhance Chaos-based encryption.
-
ChaosTextEncrypter
public ChaosTextEncrypter(double x0, double a, long s, ChaosOptions aChaosOptions)
Instantiates a newChaosTextEncrypter
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
- TheChaosMode
(ChaosOptions
) to use to enhance Chaos-based encryption.
-
ChaosTextEncrypter
public ChaosTextEncrypter(char[] aSecret, ChaosOptions aChaosOptions)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the provided char array.- Parameters:
aSecret
- The char array (in contrast to aString
, 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
- TheChaosMode
(ChaosOptions
) to use to enhance Chaos-based encryption.
-
ChaosTextEncrypter
public ChaosTextEncrypter(String aSecret, ChaosOptions aChaosOptions)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the providedString
.- Parameters:
aSecret
- TheString
from which to calculate x0, a and s.aChaosOptions
- TheChaosMode
(ChaosOptions
) to use to enhance Chaos-based encryption.
-
ChaosTextEncrypter
public ChaosTextEncrypter(ChaosKey aKey, boolean isVerify)
Instantiates a newChaosTextEncrypter
using the givenChaosKey
for encrypting.- Parameters:
aKey
- TheChaosKey
to use for encrypting.isVerify
- When true then the encryption is verified against an according live decryption to throw anIllegalStateException
in case encryption and decryption differ.
-
ChaosTextEncrypter
public ChaosTextEncrypter(int x0, int a, int s, boolean isVerify)
Instantiates a newChaosTextEncrypter
from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructorChaosTextEncrypter(double, double, long)
. You can use values in the range ofInteger.MIN_VALUE
andInteger.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 anIllegalStateException
in case encryption and decryption differ.
-
ChaosTextEncrypter
public ChaosTextEncrypter(double x0, double a, long s, boolean isVerify)
Instantiates a newChaosTextEncrypter
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 anIllegalStateException
in case encryption and decryption differ.
-
ChaosTextEncrypter
public ChaosTextEncrypter(char[] aSecret, boolean isVerify)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the provided char array.- Parameters:
aSecret
- The char array (in contrast to aString
, 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 anIllegalStateException
in case encryption and decryption differ.
-
ChaosTextEncrypter
public ChaosTextEncrypter(String aSecret, boolean isVerify)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the providedString
.- Parameters:
aSecret
- TheString
from which to calculate x0, a and s.isVerify
- When true then the encryption is verified against an according live decryption to throw anIllegalStateException
in case encryption and decryption differ.
-
ChaosTextEncrypter
public ChaosTextEncrypter(char[] aSecret, ChaosOptions aChaosOptions, boolean isVerify)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the provided char array.- Parameters:
aSecret
- The char array (in contrast to aString
, 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
- TheChaosMode
(ChaosOptions
) to use to enhance Chaos-based encryption.isVerify
- When true then the encryption is verified against an according live decryption to throw anIllegalStateException
in case encryption and decryption differ.
-
ChaosTextEncrypter
public ChaosTextEncrypter(String aSecret, ChaosOptions aChaosOptions, boolean isVerify)
Instantiates a newChaosTextEncrypter
by calculating x0, a and s from the providedString
.- Parameters:
aSecret
- TheString
from which to calculate x0, a and s.aChaosOptions
- TheChaosMode
(ChaosOptions
) to use to enhance Chaos-based encryption.isVerify
- When true then the encryption is verified against an according live decryption to throw anIllegalStateException
in case encryption and decryption differ.
-
ChaosTextEncrypter
public ChaosTextEncrypter(int x0, int a, int s, ChaosOptions aChaosOptions, boolean isVerify)
Instantiates a newChaosTextEncrypter
from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructorChaosTextEncrypter(double, double, long)
. You can use values in the range ofInteger.MIN_VALUE
andInteger.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
- TheChaosMode
(ChaosOptions
) to use to enhance Chaos-based encryption.isVerify
- When true then the encryption is verified against an according live decryption to throw anIllegalStateException
in case encryption and decryption differ.
-
ChaosTextEncrypter
public ChaosTextEncrypter(double x0, double a, long s, ChaosOptions aChaosOptions, boolean isVerify)
Instantiates a newChaosTextEncrypter
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
- TheChaosMode
(ChaosOptions
) to use to enhance Chaos-based encryption.isVerify
- When true then the encryption is verified against an according live decryption to throw anIllegalStateException
in case encryption and decryption differ.
-
-
Method Detail
-
toEncrypted
public String toEncrypted(String aDecrypted) throws org.refcodes.security.EncryptionException
-
toEncrypted
public int toEncrypted(byte[] aInput, int aInputOffset, int aInputLength, byte[] aOutput, int aOutputOffset) throws org.refcodes.security.EncryptionException
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceorg.refcodes.mixin.Disposable
-
-