Commit 112e591c authored by Jaromil's avatar Jaromil
Browse files

small notes and adjustements testing elgamal contracts

parent 75d91310
...@@ -5,8 +5,6 @@ order = ECP.order() -- get the curves order in a big ...@@ -5,8 +5,6 @@ order = ECP.order() -- get the curves order in a big
rng = RNG.new() rng = RNG.new()
H = HASH.new('sha256') H = HASH.new('sha256')
local DATA_TABLE = JSON.decode(DATA)
local KEYS_TABLE = JSON.decode(KEYS)
function readBig(str) function readBig(str)
return BIG.new(hex(str)) return BIG.new(hex(str))
...@@ -41,6 +39,7 @@ end ...@@ -41,6 +39,7 @@ end
-- Creates a ZKP that (a,b) encrypts a value of 0 -- Creates a ZKP that (a,b) encrypts a value of 0
-- Fiat Shamir Heuristic
function provezero(a, b) function provezero(a, b)
local wx = rng:big() local wx = rng:big()
...@@ -50,7 +49,7 @@ function provezero(a, b) ...@@ -50,7 +49,7 @@ function provezero(a, b)
local c = to_challenge({g, h, public, a, b, Aw, Bw}) local c = to_challenge({g, h, public, a, b, Aw, Bw})
local rx = (wx - c:modmul(private, order)) % order local rx = (wx - c:modmul(private, order)) % order
-- (wx - (c * private)) % order
return c, rx return c, rx
end end
...@@ -88,6 +87,9 @@ lookupTable = generateLookupTable(100) ...@@ -88,6 +87,9 @@ lookupTable = generateLookupTable(100)
-- Load public data -- Load public data
DATA_TABLE = JSON.decode(DATA)
KEYS_TABLE = JSON.decode(KEYS)
public = readEcp(DATA_TABLE["public"]) public = readEcp(DATA_TABLE["public"])
private = readBig(KEYS_TABLE["private"]) private = readBig(KEYS_TABLE["private"])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment