dcrypt.crypto.ciphers.RC4
Summary
Syntax
class RC4 : StreamCipher
Remarks
Implementation of RC4 designed by Ron Rivest of RSA Security.
Inherits from
Conforms to
None
Publically imports
None
References
Members
Fields
ENCRYPT
Syntax
public static const bool ENCRYPT
Remarks
Constant whose value is true. Intended to be passed to the init method of ciphers. (Inherited from Cipher.)
DECRYPT
Syntax
public static const bool DECRYPT
Remarks
Constant whose value is false. Intended to be passed to the init method of ciphers. (Inherited from Cipher.)
Properties
name
Syntax
public char[] name()
Remarks
The name of the cipher. (Inherited from Cipher.)
initialized
Syntax
public bool initialized()
Remarks
Whether or not the cipher has been initialized. (Inherited from Cipher.)
Methods
init
Syntax
public void init(bool encrypt, CipherParameters params)
Remarks
Initialize a cipher. (Inherited from Cipher.)
reset
Syntax
public void reset()
Remarks
Reset a cipher. (Inherited from Cipher.)
update
Syntax
public uint update(void[] input_, void[] output_)
Remarks
Process a block of data from the input array and place it in the output array. Returns the amount of data processed in bytes. (Inherited from Cipher.)
returnByte
Syntax
public ubyte returnByte()
Remarks
Return a single byte from the keystream. (Inherited from StreamCipher.)
Example
// dcrypt does NOT rely on Phobos or Tango import tango.io.Console; import dcrypt.misc.Util; import dcrypt.crypto.params.SymmetricKey; import dcrypt.crypto.ciphers.RC4; void main() { RC4 rc4 = new RC4; // Create a simple test vector ubyte[] testBytes = new ubyte[56]; // Initialize the cipher and encrypt the test vector rc4.init(RC4.ENCRYPT, new SymmetricKey(testBytes)); rc4.update(testBytes, testBytes); Cout(Util.ubytesToHex(testBytes)); }