aboutsummaryrefslogtreecommitdiff
path: root/tests/hash.lua
diff options
context:
space:
mode:
authorame <[email protected]>2023-11-05 01:06:23 -0600
committerame <[email protected]>2023-11-05 01:06:23 -0600
commitd062e57c154b2bed76276d52681577028e859677 (patch)
treefe559ba7857d6dad1171571c265d88e99edde10a /tests/hash.lua
parent5cd20516567da82c60b5513c732e23db6918a4b6 (diff)
tests & hash fixes
Diffstat (limited to 'tests/hash.lua')
-rw-r--r--tests/hash.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/hash.lua b/tests/hash.lua
new file mode 100644
index 0000000..dd6d5b1
--- /dev/null
+++ b/tests/hash.lua
@@ -0,0 +1,30 @@
+require "llib"
+
+function test(name,b,exp)
+ local hash = llib.crypto[name](b)
+ if not (hash == exp) then
+ print(name.." not working, got "..hash)
+ end
+end
+
+test("adler32","meow","043c01b9")
+test("bsdchecksum","meow","24789")
+test("crc8","meow","a4")
+test("crc16","meow","6561")
+test("crc32","meow","8a106afe")
+test("crc32","meow","8a106afe")
+test("fletcher8","meow","05")
+test("fletcher16","meow","3cb9")
+test("fletcher32","meow","043801b8")
+test("md5","meow","4a4be40c96ac6314e91d93f38043a634")
+test("pearson","meow","10")
+test("sha0","meow","36a22def8a9e92a1ee73579abc389e8a21b24b61")
+test("sha1","meow","7d5c2a2d6136fbf166211d5183bf66214a247f31")
+test("sha224","meow","e28f8ee4dd8618b890df366b85a2d45d2506dd842e95272b9a598998")
+test("sha256","meow","404cdd7bc109c432f8cc2443b45bcfe95980f5107215c645236e577929ac3e52")
+test("sysvchecksum","meow","1b8")
+test("xor8","meow","48")
+test("xxh32","meow","6ba6f6f0")
+test("xxh64","meow","bc11093a30a6315f")
+
+