Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zenroom
Zenroom
Commits
112e591c
Commit
112e591c
authored
Oct 17, 2018
by
Jaromil
Browse files
small notes and adjustements testing elgamal contracts
parent
75d91310
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/elgamal/tally.lua
View file @
112e591c
...
...
@@ -5,8 +5,6 @@ order = ECP.order() -- get the curves order in a big
rng
=
RNG
.
new
()
H
=
HASH
.
new
(
'sha256'
)
local
DATA_TABLE
=
JSON
.
decode
(
DATA
)
local
KEYS_TABLE
=
JSON
.
decode
(
KEYS
)
function
readBig
(
str
)
return
BIG
.
new
(
hex
(
str
))
...
...
@@ -41,6 +39,7 @@ end
-- Creates a ZKP that (a,b) encrypts a value of 0
-- Fiat Shamir Heuristic
function
provezero
(
a
,
b
)
local
wx
=
rng
:
big
()
...
...
@@ -50,7 +49,7 @@ function provezero(a, b)
local
c
=
to_challenge
({
g
,
h
,
public
,
a
,
b
,
Aw
,
Bw
})
local
rx
=
(
wx
-
c
:
modmul
(
private
,
order
))
%
order
-- (wx - (c * private)) % order
return
c
,
rx
end
...
...
@@ -88,6 +87,9 @@ lookupTable = generateLookupTable(100)
-- Load public data
DATA_TABLE
=
JSON
.
decode
(
DATA
)
KEYS_TABLE
=
JSON
.
decode
(
KEYS
)
public
=
readEcp
(
DATA_TABLE
[
"public"
])
private
=
readBig
(
KEYS_TABLE
[
"private"
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment