You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AES support 3 modes: GCM, CBC, and CTR - first parameter is mode, second is hex-encoded key, third is hex-encoded initialization vector or nonce - depending on the mode, and forth is hex-encoded plain text or ciphertext.
11
+
AES support 3 modes: GCM, CBC, and CTR - first parameter is mode, second is hex-encoded key, third is hex-encoded
12
+
initialization vector or nonce - depending on the mode, and forth is hex-encoded plain text or ciphertext.
13
+
14
+
Since lua strings are binary safe, you can use any binary data as input and output and, for your convenience, the
15
+
library also provides hex-encoded versions of the encrypt and decrypt functions. The first argument (the mode string)
16
+
can be one of the following: "GCM", "CBC", or "CTR" (case-insensitive) and is not hex-encoded for the hex variants.
10
17
11
18
## Examples
12
19
13
20
```lua
14
-
localcrypto=require("crypto")
21
+
localcrypto=require'crypto'
15
22
16
23
-- md5
17
24
ifnot(crypto.md5("1\n") =="b026324c6904b2a9cb4b88d6d61c81d1") then
@@ -23,18 +30,46 @@ if not(crypto.sha256("1\n") == "4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9
0 commit comments