File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -265,6 +265,19 @@ local crypto = require("crypto")
265265print(crypto.ripemd160("Pluto")) --> c2072a85f4a691803b8942709036072086fd9550
266266```
267267---
268+ ### ` crypto.hmac `
269+ Authenticates a message using the HMAC construction with the given hash algorithm.
270+ #### Parameters
271+ 1 . The hash algorithm to use. ` "sha1" ` , ` "sha256" ` , ` "sha384" ` , or ` "sha512" ` .
272+ 2 . The secret key.
273+ 3 . The message to authenticate.
274+ 4 . When set to true, returns raw binary data. false outputs lowercase hex digits. By default, this is false.
275+ ``` pluto
276+ local crypto = require("crypto")
277+ local key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"a
278+ print(crypto.hmac("sha256", key, "Hi There")) --> b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7
279+ ```
280+ ---
268281## Cryptographic PRNGs
269282### ` crypto.random `
270283This is a cryptographically secure PRNG, assuming the platform's implementation of the underlying primitive is secure.
You can’t perform that action at this time.
0 commit comments