Module crypto
Data Types
cipher_iv()
cipher_iv() = aes_128_cbc | aes_192_cbc | aes_256_cbc | aes_128_cfb128 | aes_192_cfb128 | aes_256_cfb128 | aes_128_ctr | aes_192_ctr | aes_256_ctr
cipher_no_iv()
cipher_no_iv() = aes_128_ecb | aes_192_ecb | aes_256_ecb
crypto_opt()
crypto_opt() = {encrypt, boolean()} | {padding, padding()}
crypto_opts()
crypto_opts() = [crypto_opt()]
digest()
digest() = binary()
hash_algorithm()
hash_algorithm() = md5 | sha | sha224 | sha256 | sha384 | sha512
padding()
padding() = none | pkcs_padding
Function Index
| crypto_one_time/4 | Encrypted/decrypt data using given cipher and key. |
| crypto_one_time/5 | Encrypted/decrypt data using given cipher, key, IV. |
| hash/2 | Hash data using a specified hash algorithm. |
| strong_rand_bytes/1 | Generate N cryptographically secure random octets and return the result in a binary. |
Function Details
crypto_one_time/4
crypto_one_time(Cipher::cipher_no_iv(), Key::iodata(), Data::iodata(), FlagOrOptions::crypto_opts()) -> binary()
Cipher: a supported cipherKey: the encryption / decryption keyData: to be crypted or encryptedFlagOrOptions: either just true for encryption (or false for decryption), or a proplist
for any additional option
returns: Returns crypted or encrypted data.
Encrypted/decrypt data using given cipher and key
crypto_one_time/5
crypto_one_time(Cipher::cipher_iv(), Key::iodata(), IV::iodata(), Data::iodata(), FlagOrOptions::crypto_opts()) -> binary()
Cipher: a supported cipher that makes use of IVKey: the encryption / decryption keyIV: an initialization vectorData: to be crypted or encryptedFlagOrOptions: either just true for encryption (or false for decryption), or a proplist
for any additional option such as padding.
returns: Returns crypted or encrypted data.
Encrypted/decrypt data using given cipher, key, IV.
hash/2
hash(Type::hash_algorithm(), Data::iolist()) -> digest()
Type: the hash algorithmData: the data to hash
returns: Returns the result of hashing the supplied data using the supplied hash algorithm.
Hash data using a specified hash algorithm.
strong_rand_bytes/1
strong_rand_bytes(N::non_neg_integer()) -> binary()
N: desired length of cryptographically secure random data
returns: Returns Cryptographically secure random data of length N
Generate N cryptographically secure random octets and return the result in a binary.