aboutsummaryrefslogtreecommitdiff
path: root/tests/hash.lua
diff options
context:
space:
mode:
authorame <[email protected]>2024-03-26 13:03:34 -0500
committerame <[email protected]>2024-03-26 13:03:34 -0500
commitc6e8e66aa91bffa649e9192d3e4e0658d78d0ad6 (patch)
tree92c3ca36793550864bbb32cf13ea0e606eab999b /tests/hash.lua
parentdc51f7b892ff5a6790a7d728a3acac363588ede2 (diff)
docs and rolling adler
Diffstat (limited to 'tests/hash.lua')
-rw-r--r--tests/hash.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/hash.lua b/tests/hash.lua
index c72d08c..ca9d85c 100644
--- a/tests/hash.lua
+++ b/tests/hash.lua
@@ -2,6 +2,7 @@ require "llib"
function test(name,b,exp,oargs)
local hash
+ local hash2
local add = ""
if oargs == nil then
hash = llib.crypto[name](b)
@@ -9,6 +10,18 @@ function test(name,b,exp,oargs)
hash = llib.crypto[name](b,table.unpack(oargs))
add = table.concat(oargs, ", ")
end
+
+ if(llib.crypto[name.."_init"] ~= nil) then
+ local t = llib.crypto[name.."_init"]()
+ llib.crypto[name.."_update"](t, b)
+ hash2 = llib.crypto[name.."_final"](t)
+ if(hash2 ~= hash) then
+ llib.io.error(name.." init-update-final method not working, got:\n\t"..hash2.." other was:\n\t"..hash)
+ else
+ llib.io.log(name.." alt method working")
+ end
+ end
+
if not (hash == exp) then
llib.io.error(name.." not working, got:\n\t"..hash.." wanted:\n\t"..exp.."\n\twith args: {"..add.."}")
else