~rootmos/lua-hack

7f43113f33edc72af30f038e87335769baf393f9 — Gustav Behm 1 year, 1 month ago 5a0b4e0
Remove development code
1 files changed, 0 insertions(+), 23 deletions(-)

D go.lua
D go.lua => go.lua +0 -23
@@ 1,23 0,0 @@
local L = require("lamport")
local b64 = require("base64")
local SHA256 = require("sha").sha256
local H = require("hex")
local CPRNG = require("random.prng").sha256
--local ser = require("ser")
local M = require("merkle")
local SA = require("seeded-array")

local keys = SA.make{
    n = 4,
    seed = "foo",
    f = function(seed) return L.generate_key(SHA256, CPRNG(seed)) end,
}

local mt = M(keys, nil, function(k) return k.id end)
print(H(mt.root))

local sig = mt[1]:sign("bar", true)
local auth = mt:proof(1)

sig:verify(auth[0], "bar")
auth:verify_hash(mt.root, auth[0])