Module mac
mac module perform Message Authentication Code operations.
It base on EVP_MAC in OpenSSL v3.
Usage:
hamc = require('openssl').mac
Info:
- Author: george zhao <zhaozg(at)gmail.com>
Functions
new (alg, key[, engine]) | get mac_ctx object |
mac (digest, message, key) | compute mac one step, in module openssl.hamc |
update (msg) | feed data to do digest |
final ([last[, raw]]) | get result of mac |
size (msg) | return size of mac value |
Functions
- new (alg, key[, engine])
-
get mac_ctx object
Parameters:
- alg string, integer or asn1_object name, nid or object identity
- key string secret key
- engine engine , nothing with default engine (optional)
Returns:
-
mac_ctx
object mapping MAC_CTX in openssl
- mac (digest, message, key)
-
compute mac one step, in module openssl.hamc
Parameters:
Returns:
-
string
result binary string
- update (msg)
-
feed data to do digest
Parameters:
- msg string data
- final ([last[, raw]])
-
get result of mac
Parameters:
- last string last part of data (optional)
- raw boolean binary or hex encoded result, default true for binary result (optional)
Returns:
-
string
val hash result
- size (msg)
-
return size of mac value
Parameters:
- msg string data