@@ -9,7 +9,7 @@ Hash a string using Lua's version of the DJB2 non-cryptographic hashing algorith
9
9
``` pluto
10
10
local crypto = require("crypto")
11
11
local str = "hello world"
12
- assert (crypto.lua(str) == 2871868277)
12
+ print (crypto.lua(str)) --> 2871868277
13
13
```
14
14
---
15
15
### ` crypto.djb2 `
@@ -21,7 +21,7 @@ An integer between 0 and 0xffffffff, inclusive.
21
21
``` pluto
22
22
local crypto = require("crypto")
23
23
local str = "hello world"
24
- assert (crypto.djb2(str) == 894552257)
24
+ print (crypto.djb2(str)) --> 894552257
25
25
```
26
26
---
27
27
### ` crypto.fnv1 `
@@ -31,7 +31,7 @@ Hash a string using the FNV1 non-cryptographic hashing algorithm.
31
31
``` pluto
32
32
local crypto = require("crypto")
33
33
local str = "hello world"
34
- assert (crypto.fnv1(str) == 9065573210506989167)
34
+ print (crypto.fnv1(str)) --> 9065573210506989167
35
35
```
36
36
---
37
37
### ` crypto.fnv1a `
@@ -41,7 +41,7 @@ Hash a string using the FNV1A non-cryptographic hashing algorithm.
41
41
``` pluto
42
42
local crypto = require("crypto")
43
43
local str = "hello world"
44
- assert (crypto.fnv1a(str) == 8618312879776256743)
44
+ print (crypto.fnv1a(str)) --> 8618312879776256743
45
45
```
46
46
---
47
47
### ` crypto.joaat `
@@ -53,7 +53,7 @@ An integer between 0 and 0xffffffff, inclusive.
53
53
``` pluto
54
54
local crypto = require("crypto")
55
55
local str = "hello world"
56
- assert (crypto.joaat(str) == 1045060183)
56
+ print (crypto.joaat(str)) --> 1045060183
57
57
```
58
58
---
59
59
### ` crypto.sdbm `
@@ -65,7 +65,7 @@ An integer between 0 and 0xffffffff, inclusive.
65
65
``` pluto
66
66
local crypto = require("crypto")
67
67
local str = "hello world"
68
- assert (crypto.sdbm(str) == 430867652)
68
+ print (crypto.sdbm(str)) --> 430867652
69
69
```
70
70
---
71
71
### ` crypto.crc32 `
@@ -78,7 +78,7 @@ An integer between 0 and 0xffffffff, inclusive.
78
78
``` pluto
79
79
local crypto = require("crypto")
80
80
local str = "hello world"
81
- assert (crypto.crc32(str) == 222957957)
81
+ print (crypto.crc32(str)) --> 222957957
82
82
```
83
83
---
84
84
### ` crypto.crc32c `
@@ -91,7 +91,7 @@ An integer between 0 and 0xffffffff, inclusive.
91
91
``` pluto
92
92
local crypto = require("crypto")
93
93
local str = "hello world"
94
- assert (crypto.crc32c(str) == 3381945770)
94
+ print (crypto.crc32c(str)) --> 3381945770
95
95
```
96
96
---
97
97
### ` crypto.adler32 `
@@ -102,7 +102,7 @@ Hash a string using the Adler-32 non-cryptographic hashing algorithm.
102
102
``` pluto
103
103
local crypto = require("crypto")
104
104
local str = "hello"
105
- assert (crypto.adler32(str) == 103547413)
105
+ print (crypto.adler32(str)) --> 103547413
106
106
```
107
107
---
108
108
### ` crypto.lookup3 `
@@ -112,7 +112,7 @@ Hash a string using the Lookup3 non-cryptographic hashing algorithm.
112
112
``` pluto
113
113
local crypto = require("crypto")
114
114
local str = "hello world"
115
- assert (crypto.lookup3(str) == 1252609637)
115
+ print (crypto.lookup3(str)) --> 1252609637
116
116
```
117
117
---
118
118
### ` crypto.times33 `
@@ -124,7 +124,7 @@ An integer between 0 and 0xffffffff, inclusive.
124
124
``` pluto
125
125
local crypto = require("crypto")
126
126
local str = "hello world"
127
- assert (crypto.times33(str) == 3889643616)
127
+ print (crypto.times33(str)) --> 3889643616
128
128
```
129
129
### ` crypto.murmur1 `
130
130
Hash a string using the Murmur1 non-cryptographic hashing algorithm.
@@ -135,7 +135,7 @@ An integer between 0 and 0xffffffff, inclusive.
135
135
``` pluto
136
136
local crypto = require("crypto")
137
137
local str = "hello world"
138
- assert (crypto.murmur1(str) == 3154674178)
138
+ print (crypto.murmur1(str)) --> 3154674178
139
139
```
140
140
---
141
141
### ` crypto.murmur2 `
@@ -147,7 +147,7 @@ An integer between 0 and 0xffffffff, inclusive.
147
147
``` pluto
148
148
local crypto = require("crypto")
149
149
local str = "hello world"
150
- assert (crypto.murmur2(str) == 1151865881)
150
+ print (crypto.murmur2(str)) --> 1151865881
151
151
```
152
152
### ` crypto.murmur2a `
153
153
Hash a string using the Murmur2A non-cryptographic hashing algorithm.
@@ -158,7 +158,7 @@ An integer between 0 and 0xffffffff, inclusive.
158
158
``` pluto
159
159
local crypto = require("crypto")
160
160
local str = "hello world"
161
- assert (crypto.murmur2a(str) == 2650573207)
161
+ print (crypto.murmur2a(str)) --> 2650573207
162
162
```
163
163
### ` crypto.murmur64a `
164
164
Hash a string using the Murmur64A non-cryptographic hashing algorithm.
@@ -167,7 +167,7 @@ Hash a string using the Murmur64A non-cryptographic hashing algorithm.
167
167
``` pluto
168
168
local crypto = require("crypto")
169
169
local str = "hello world"
170
- assert (crypto.murmur64a(str) == -3190198453633110066)
170
+ print (crypto.murmur64a(str)) --> -3190198453633110066
171
171
```
172
172
### ` crypto.murmur64b `
173
173
Hash a string using the Murmur64A non-cryptographic hashing algorithm.
@@ -176,7 +176,7 @@ Hash a string using the Murmur64A non-cryptographic hashing algorithm.
176
176
``` pluto
177
177
local crypto = require("crypto")
178
178
local str = "hello world"
179
- assert (crypto.murmur64b(str) == 7088720765356542432)
179
+ print (crypto.murmur64b(str)) --> 7088720765356542432
180
180
```
181
181
---
182
182
### ` crypto.murmur2neutral `
@@ -186,7 +186,7 @@ Hash a string using the Murmur2Neutral non-cryptographic hashing algorithm.
186
186
``` pluto
187
187
local crypto = require("crypto")
188
188
local str = "hello world"
189
- assert (crypto.murmur2neutral(str) == 1151865881)
189
+ print (crypto.murmur2neutral(str)) --> 1151865881
190
190
```
191
191
---
192
192
## Semi-Cryptographic Hashing Algorithms
@@ -198,8 +198,8 @@ Hash a string using the MD5 semi-cryptographic hashing algorithm.
198
198
``` pluto
199
199
local crypto = require("crypto")
200
200
local str = "hello world"
201
- assert (crypto.md5(str) == " 5eb63bbbe01eeed093cb22bb8f5acdc3")
202
- assert (crypto.md5(str, true) == " \x5e\xb6\x3b\xbb\xe0\x1e\xee\xd0\x93\xcb\x22\xbb\x8f\x5a\xcd\xc3")
201
+ print (crypto.md5(str)) --> 5eb63bbbe01eeed093cb22bb8f5acdc3
202
+ print (crypto.md5(str, true)) --> \x5e\xb6\x3b\xbb\xe0\x1e\xee\xd0\x93\xcb\x22\xbb\x8f\x5a\xcd\xc3
203
203
```
204
204
---
205
205
## Cryptographic Hashing Algorithms
@@ -210,8 +210,8 @@ Hash a string using the SHA-1 cryptographic hashing algorithm.
210
210
2 . When set to true, returns raw binary data. false outputs lowercase hex digits. By default, this is false.
211
211
``` pluto
212
212
local crypto = require("crypto")
213
- assert (crypto.sha1("Pluto") == " bce8c9aca4120776fad6b517874aa09c46405454")
214
- assert (crypto.sha1("Pluto", true) == " \xbc\xe8\xc9\xac\xa4\x12\x07\x76\xfa\xd6\xb5\x17\x87\x4a\xa0\x9c\x46\x40\x54\x54")
213
+ print (crypto.sha1("Pluto")) --> bce8c9aca4120776fad6b517874aa09c46405454
214
+ print (crypto.sha1("Pluto", true)) --> \xbc\xe8\xc9\xac\xa4\x12\x07\x76\xfa\xd6\xb5\x17\x87\x4a\xa0\x9c\x46\x40\x54\x54
215
215
```
216
216
---
217
217
### ` crypto.sha256 `
@@ -221,8 +221,8 @@ Hash a string using the SHA-256 cryptographic hashing algorithm.
221
221
2 . When set to true, returns raw binary data. false outputs lowercase hex digits. By default, this is false.
222
222
``` pluto
223
223
local crypto = require("crypto")
224
- assert (crypto.sha256("Pluto") == " 8dad5f6a7dd2dcd8c35ec2fd7babb499bcad60d27d73fe73eca2ce025dfd3b47")
225
- assert (crypto.sha256("Pluto", true) == " \x8d\xad\x5f\x6a\x7d\xd2\xdc\xd8\xc3\x5e\xc2\xfd\x7b\xab\xb4\x99\xbc\xad\x60\xd2\x7d\x73\xfe\x73\xec\xa2\xce\x02\x5d\xfd\x3b\x47")
224
+ print (crypto.sha256("Pluto")) --> 8dad5f6a7dd2dcd8c35ec2fd7babb499bcad60d27d73fe73eca2ce025dfd3b47
225
+ print (crypto.sha256("Pluto", true)) --> \x8d\xad\x5f\x6a\x7d\xd2\xdc\xd8\xc3\x5e\xc2\xfd\x7b\xab\xb4\x99\xbc\xad\x60\xd2\x7d\x73\xfe\x73\xec\xa2\xce\x02\x5d\xfd\x3b\x47
226
226
```
227
227
---
228
228
### ` crypto.sha384 `
@@ -232,7 +232,7 @@ Hash a string using the SHA-384 cryptographic hashing algorithm.
232
232
2 . When set to true, returns raw binary data. false outputs lowercase hex digits. By default, this is false.
233
233
``` pluto
234
234
local crypto = require("crypto")
235
- assert (crypto.sha384("Pluto", false) == " db890233a919b6745d632633c419e14540ff79f1a89bc4ac194b00e7f913f0f06d5d4d7d6cc2b4aaf9485d223afb8cf0")
235
+ print (crypto.sha384("Pluto", false)) --> db890233a919b6745d632633c419e14540ff79f1a89bc4ac194b00e7f913f0f06d5d4d7d6cc2b4aaf9485d223afb8cf0
236
236
```
237
237
---
238
238
### ` crypto.sha512 `
@@ -242,7 +242,7 @@ Hash a string using the SHA-512 cryptographic hashing algorithm.
242
242
2 . When set to true, returns raw binary data. false outputs lowercase hex digits. By default, this is false.
243
243
``` pluto
244
244
local crypto = require("crypto")
245
- assert (crypto.sha512("Pluto", false) == " ee8410a8bf9511b94fd6669b5c3e0c4b86e8e4bf7baa8dbd2773d4d6381dd1aecebbe391bef4c6158620ab3f6b794907652d4432c2301d7e1a6caf520565cdf2")
245
+ print (crypto.sha512("Pluto", false)) --> ee8410a8bf9511b94fd6669b5c3e0c4b86e8e4bf7baa8dbd2773d4d6381dd1aecebbe391bef4c6158620ab3f6b794907652d4432c2301d7e1a6caf520565cdf2
246
246
```
247
247
---
248
248
### ` crypto.ripemd160 `
@@ -251,7 +251,8 @@ Hash a string using the RIPEMD-160 cryptographic hashing algorithm.
251
251
1 . The string to hash.
252
252
2 . When set to true, returns raw binary data. false outputs lowercase hex digits. By default, this is false.
253
253
``` pluto
254
- assert(require"crypto".ripemd160("Pluto") == "c2072a85f4a691803b8942709036072086fd9550")
254
+ local crypto = require("crypto")
255
+ print(crypto.ripemd160("Pluto")) --> c2072a85f4a691803b8942709036072086fd9550
255
256
```
256
257
---
257
258
## Cryptographic PRNGs
0 commit comments