unimportant

This commit is contained in:
Cosmin Apreutesei
2019-11-06 16:34:48 +02:00
parent 31ce83700b
commit e8e6ed49bf
2 changed files with 20 additions and 3 deletions
+14 -3
View File
@@ -2,6 +2,12 @@
local ffi = require "ffi"
local C = ffi.load'md5'
if not ... then
require'md5_test'
require'md5_hmac_test'
return
end
ffi.cdef[[
typedef struct {
uint32_t lo, hi;
@@ -33,11 +39,16 @@ local function sum(data, size)
local d = digest(); d(data, size); return d()
end
if not ... then require'md5_test' end
return {
local md5 = {
digest = digest,
sum = sum,
C = C,
}
function md5.hmac(message, key)
local hmac = require'hmac'
md5.hmac = hmac.new(sum, 64)
return md5.hmac(message, key)
end
return md5
+6
View File
@@ -0,0 +1,6 @@
local hmac = require'md5'.hmac
local glue = require'glue'
local unit = require'unit'
test(glue.tohex(hmac('dude', 'key')), 'e9ecd7d5b2d9dc558d1c2cd173be7c38')
test(glue.tohex(hmac('what do ya want for nothing?', 'Jefe')), '750c783e6ab0b503eaa86e310a5db738')