The crypto
module provides various cryptographic functionalities, including hashing and encryption/decryption.
Generates an MD5 hash for the given input.
input
: The data to hash (byte array).
Returns the MD5 hash as a hexadecimal string.
Generates a SHA-1 hash for the given input.
input
: The data to hash (byte array).
Returns the SHA-1 hash as a hexadecimal string.
Generates a SHA-256 hash for the given input.
input
: The data to hash (byte array).
Returns the SHA-256 hash as a hexadecimal string.
Generates a SHA-512 hash for the given input.
input
: The data to hash (byte array).
Returns the SHA-512 hash as a hexadecimal string.
Generates a SHA3-256 hash for the given input.
input
: The data to hash (byte array).
Returns the SHA3-256 hash as a hexadecimal string.
The aes
module provides functionalities for AES encryption and decryption.
Encrypts the given plaintext using the specified key.
plaintext
: The data to encrypt (byte array).key
: The encryption key (byte array).
Returns the encrypted data as a byte array.
Decrypts the given ciphertext using the specified key.
ciphertext
: The data to decrypt (byte array).key
: The decryption key (byte array).
Returns the decrypted data as a byte array.
The block size of the AES cipher.
import "crypto"
// Hashing examples
md5hash := crypto.md5("example_data")
println(md5hash)