Encrypts "clear text" data by using Twofish cipher.
Unit
Syntax
ParametersAKey [in] A key for encryption. Comes from TwofishDeriveKey function or TwofishInitKey function.
AData [in] A data to encrypt. Data will be padded with PKCS#5.
AEncryptedData [out] An encrypted AData's data. Must be deleted with FreeMem function (but we recommend to use SecureFree function instead). Will have different size from AData. Data is returned in little-endian format.
ADataSize [in, out] On input: size of AData. On output: size of AEncryptedData (will be different).
AInitVector [in, opt] An optional initialization vector (IV) from TwofishInitIV function.
Default is nil - which means using ECB encryption mode (not recommended).
Specified (non-nil) value means using CBC encryption mode.
AData [in] String "clear text" data to encrypt. Data will be padded with PKCS#5.
Return valueEncrypted AData's data in a string form. Data is returned in little-endian format.
RemarksThis function encrypts data passed in AData parameter with key of symmetric Twofish cipher and outputs encrypted data back to AEncryptedData parameter. AEncryptedData expected to have different size from original AData. In other words, symmetric encryption with Twofish does change the size of the data.
The overload variant with RawByteString encrypts AData parameter and outputs encrypted data as function's result.
See also
|