From 027c7a7622a4aa4d0ed6483ba495ab91e0c68991 Mon Sep 17 00:00:00 2001 From: ame Date: Thu, 11 Jul 2024 12:27:06 -0500 Subject: fixes to ub:33 hashes now safe --- tests/hash.lua | 9 ++++++++- tests/net.lua | 5 ++--- tests/s.lua | 14 ++++++-------- 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'tests') 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 diff --git a/tests/net.lua b/tests/net.lua index 88b551e..617d299 100644 --- a/tests/net.lua +++ b/tests/net.lua @@ -12,7 +12,6 @@ local wowa = 5 _G._llib = _G.llib --_G.ww = llib --llib.io.pprint(_G) -a = llib.crypto.md5 llib.net.listen( function(server) --llib = nil @@ -20,7 +19,7 @@ llib.net.listen( llib.io.pprint("online") _G.server = server server:all("/", function(res, req) - b = a("hello") + b = llib.crypto.md5("hello") --llib.io.pprint(a + '5') res:send(b) @@ -58,7 +57,7 @@ llib.net.listen( print(req._bytes .. "/" .. req["Content-Length"]) --print(a) end - --_G.llib.io.pprint(req.files) + llib.io.pprint(req) --_G.llib.io.pprint(req) --_G.llib.io.pprint("hi") --res:send("done") diff --git a/tests/s.lua b/tests/s.lua index 929c127..01ca4f7 100644 --- a/tests/s.lua +++ b/tests/s.lua @@ -2,14 +2,12 @@ local t = function (a) end require "llib" -a = llib.crypto.md5() +local a = llib.crypto.md5() -for i = 1,200 do - --llib.io.pprint(function (a) end) - llib.thread.async(function(a) end)--:await() -end +b = llib.thread.buffer(a) -if a:final() ~= "d41d8cd98f00b204e9800998ecf8427e" then - print(a:final()) -end +b:mod(function(e) + return e:update("meow") +end) +print(b:get():final()) -- cgit v1.2.3