# Stream cipher

Cipher

The `Cipher` class is a base class that is used to implement a cipher. A cipher is used to encrypt or decrypt a message. There are basically two types of ciphers, namelly symmetric cipher and asymmetric cipher. For the base class operation, only the cipher name and key is needed. A reverse flag controls whether or not an encryption operation must be reversed. A reset method can also be used to reset the internal cipher state.

cipher-p
Nameable
reset
none
none

The `reset` method reset the cipher internal state.

stream
Integer
OutputStream InputStream

The `stream` method process an input stream and write into an output stream. The method returns the number of character processed. The first argument is the output stream used to write the coded characters. The second argument is the input stream used to read the characters.

set-key
none
Key

The `set-key` method sets the cipher key. The first argument is the key to set.

get-key
Key
none

The `get-key` method returns the cipher key.

set-reverse
none
Boolean

The `set-reverse` method sets the cipher reverse flag. The first argument is the flag to set. If the flag is true, the cipher operates in reverse mode. If the flag is false, the cipher operates in direct mode.

get-reverse
Boolean
none

The `get-reverse` method returns the cipher reverse flag. If the flag is true, the cipher operates in reverse mode. If the flag is false, the cipher operates in direct mode.