TF8CipherMode
F8 Cipher Mode
A chaining mode for block ciphers.
Methods
Method Start:Int(cipher:TCipher, iv:Byte Ptr, key:Byte Ptr, keylen:Int, saltKey:Byte Ptr, saltkeylen:Int, numRounds:Int)
Starts the cipher mode state using key as the secret key and iv as the counter.
It uses saltKey as the IV encryption. The salt key can be shorter than the secret key, but not longer.
Returns
CRYPT_OK if the cipher initialized correctly, otherwise, returns an error code.
Method Encrypt:Int(pt:Byte Ptr, ct:Byte Ptr, length:UInt)
Encrypts the plaintext pt of length to ct.
The length is specified in bytes and does not have to be a multiple of the ciphers block size.
Returns
CRYPT_OK on success.
Method Decrypt:Int(ct:Byte Ptr, pt:Byte Ptr, length:UInt)
Decrypts the ciphertext ct of length to pt.
The length is specified in bytes and does not have to be a multiple of the ciphers block size.
Returns
CRYPT_OK on success.
Method GetIV:Int(IV:Byte Ptr, length:UInt Var)
Reads the IV out of the chaining mode, and stores it in IV along with the length of the IV.
This works with the current IV value only and not the encrypted IV value specified during the call to Start. The purpose of this method is to be able to seek within a current session only. If you want to change the session IV you will have to call Done and then start a new state with Start.
Method SetIV:Int(IV:Byte Ptr, length:UInt)
Initializes the chaining mode state as if the original IV were the new IV specified.
The length of IV must be the size of the cipher block size.
This method is handy if you wish to change the IV without re–keying the cipher.
The IV is encrypted as if it were the prior encrypted pad.
Method Done:Int()
Terminates the cipher stream.