aboutsummaryrefslogtreecommitdiff
path: root/tests/hash.lua
diff options
context:
space:
mode:
authorame <[email protected]>2024-07-11 12:27:06 -0500
committerame <[email protected]>2024-07-11 12:27:06 -0500
commitc57e5e58e197fca322c2840efa435eabb62e4d9d (patch)
tree7d5bc653f6bec52494604ac8c805e311bae080f4 /tests/hash.lua
parent2999d3412ccf5c7fc1a9e84695c7a2bce69d3e82 (diff)
fixes to ub:33 hashes now safe
Diffstat (limited to 'tests/hash.lua')
-rw-r--r--tests/hash.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/hash.lua b/tests/hash.lua
index 28e2323..dce011f 100644
--- a/tests/hash.lua
+++ b/tests/hash.lua
@@ -54,15 +54,22 @@ function test(name,b,exp,oargs)
functions_working = functions_working + 1
llib.io.log(name.." + method working "..hash6.." == "..exp)
end
-
+
if(oargs == nil) then
hash3 = llib.crypto[name]()
else
hash3 = llib.crypto[name](table.unpack(oargs))
end
b:gsub(".", function(c) hash3:update(c) end)
+ hash3b = hash3
hash3 = hash3:final()
+ if hash3 ~= hash3b:final() then
+ fail = true
+ functions_failed = functions_failed + 1
+ llib.io.error(name.." final not safe")
+ end
+
if(oargs == nil) then
hash4 = llib.crypto[name.."_init"]()
else