This topic describes the syntax, features, parameters, and return values of cipher algorithm functions. This topic also provides examples of these functions.
aes_new | aes_enc | aes_dec | sha1 | sha2 | hmac | hmac_sha1 | md5 | md5_bin
aes_new
Item | Description |
Syntax |
|
Description | Creates an Advanced Encryption Standard (AES) object, which is used for subsequent encryption and decryption operations. To perform encryption, call the |
Parameter | The
|
Return value | If the function succeeds, an AES object (dictionary type) is returned. Otherwise, |
Example |
|
aes_enc
Item | Description |
Syntax |
|
Description | Encrypts data by using the AES encryption algorithm. |
Parameter |
|
Return value | Returns the ciphertext after the text specified by the |
Example |
|
aes_dec
Item | Description |
Syntax |
|
Description | Decrypts data by using the AES encryption algorithm. |
Parameter |
|
Return value | Returns the plaintext after the text specified by the |
Example |
|
sha1
Item | Description |
Syntax |
|
Description | Calculates an SHA-1 digest. |
Parameter | s: the string for which you want to calculate a digest. |
Return value | An SHA-1 digest in the binary format. |
Example |
Output:
|
sha2
Item | Description |
Syntax |
|
Description | Calculates an SHA-2 digest. |
Parameter |
|
Return value | An SHA-2 digest in the binary format. |
Example |
Output:
|
hmac
Item | Description |
Syntax |
|
Description | Calculates an HMAC digest. |
Parameter |
|
Return value | An HMAC digest in the binary format calculated by using the corresponding algorithm. |
Example |
Output:
|
hmac_sha1
Item | Description |
Syntax |
|
Description | Calculates an HMAC-SHA-1 digest. |
Parameter |
|
Return value | An HMAC-SHA-1 digest in the binary format. |
Example |
Output:
|
md5
Item | Description |
Syntax |
|
Description | Calculates an MD5 digest. |
Parameter | s: the string for which you want to calculate a digest. |
Return value | An MD5 digest in the hexadecimal format. |
Example |
Output:
|
md5_bin
Item | Description |
Syntax |
|
Description | Calculates an MD5 digest. |
Parameter | s: the string for which you want to calculate a digest. |
Return value | An MD5 digest in the binary format. |
Example |
Output:
|