This topic describes the syntax, features, parameters, and return values of cipher algorithm functions. This topic also provides examples of these functions.
aes_new
The following table describes the details about this function.
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 |
Parameters | The
|
Return value | If the function succeeds, an AES object (dictionary type) is returned. Otherwise, |
Example |
|
aes_enc
The following table describes the details about this function.
Item | Description |
Syntax |
|
Description | Encrypts data by using the AES encryption algorithm. |
Parameters |
|
Return value | Returns the ciphertext after the text specified by the |
Example |
|
aes_dec
The following table describes the details about this function.
Item | Description |
Syntax |
|
Description | Decrypts data by using the AES encryption algorithm. |
Parameters |
|
Return value | Returns the plaintext after the text specified by the |
Example |
|
sha1
The following table describes the details about this function.
Item | Description |
Syntax |
|
Description | Calculates an SHA-1 digest. |
Parameters | s: the string for which you want to calculate a digest. |
Return value | Returns an SHA-1 digest in the binary format. |
Example |
|
sha2
The following table describes the details about this function.
Item | Description |
Syntax |
|
Description | Calculates an SHA-2 digest. |
Parameters |
|
Return value | Returns an SHA-2 digest in the binary format. |
Example |
|
hmac
The following table describes the details about this function.
Item | Description |
Syntax |
|
Description | Calculates an HMAC digest. |
Parameters |
|
Return value | Returns an HMAC digest in the binary format calculated by using the corresponding algorithm. |
Example |
|
hmac_sha1
The following table describes the details about this function.
Item | Description |
Syntax |
|
Description | Calculates an HMAC-SHA-1 digest. |
Parameters |
|
Return value | Returns an HMAC-SHA-1 digest in the binary format. |
Example |
|
md5
The following table describes the details about this function.
Item | Description |
Syntax |
|
Description | Calculates an MD5 digest. |
Parameters | s: the string for which you want to calculate a digest. |
Return value | Returns an MD5 digest in the hexadecimal format. |
Example |
|
md5_bin
The following table describes the details about this function.
Item | Description |
Syntax |
|
Description | Calculates an MD5 digest. |
Parameters | s: the string for which you want to calculate a digest. |
Return value | Returns an MD5 digest in the binary format. |
Example |
|