Initializes TEA key from password.
Unit
Syntax
ParametersAPassword [in, opt] User password.
ASalt [in, opt] Optional salt value. It is recommended to always use/specify salt when possible - to defend against dictionary and pre-computed rainbow table attacks. Use InitSalt function to create new salt for encryption and store salt with encrypted data. Use stored salt to decrypt data.
AData [in] Pointer to binary password to initialize the key.
ADataSize [in] Size of AData in bytes.
Return valueTEA key derived from APassword and (optionally) ASalt.
You do not need to free/release/dispose this key - it does not contain any allocated memory. However, it is strongly recommended to call TEADestroyKey function once you have finished working with key - to erase it with zeros.
This value is always the same for the same APassword (and same ASalt).
RemarksThis function converts APassword to UTF-8, attaches ASalt (if specified), then uses the resulting RAW binary string to initialize the key. This function uses MD5(ASalt + APassword) to derive key.
You do not need to call this function if you already have RAW binary TEA key (TTEAKey).
You do not need to free/release/dispose this key - it does not contain any allocated memory. However, it is strongly recommended to call TEADestroyKey function once you have finished working with key - to erase it with zeros.
Overloaded variant lets you initialize key from any binary password. It is usually used in conjunction with asymmetric cipher when generating random passwords for symmetric cipher.
Tiny Encryption Algorithm (TEA) is a block cipher notable for its simplicity of description and implementation, typically a few lines of code. TEA operates on two 32-bit unsigned integers (could be derived from a 64-bit data block) and uses a 128-bit key.
Examples
See also
|