Skip to content

Commit

Permalink
small updates to BBS benchmark scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromil committed Aug 16, 2024
1 parent c21812f commit 219ee64
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/benchmark/bbs/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

all: keygen.png sign_verify.png zkp.png
all: keygen.png sign_verify.png zkp.png entropy.png
../../../src/zenroom -l common.lua sizes.lua

%.png: %.txt %.gnuplot
sed 's/TERM/pngcairo dashed rounded size 1024,768/' \
Expand Down
7 changes: 7 additions & 0 deletions test/benchmark/bbs/entropy.gnuplot
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set title "Hamming distance between unlinkable proofs"
set style fill transparent solid 0.25 border
# set style fill pattern
set terminal TERM
set xlabel "hamming distance in bits"
set ylabel "frequency"
plot for[col=1:2] 'entropy.txt' using 1:col title columnheader smooth frequency with fillsteps linetype col
29 changes: 29 additions & 0 deletions test/benchmark/bbs/entropy.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
print 'BBS+ entropy benchmarks'
print ''

TOTAL = 10
B3 = BBS.ciphersuite'shake256'

local kp = keygen(B3)



local msg = { OCTET.random(512) }
local idx = { 1 }

local signed = sign(B3, kp, msg)

print "Proof \t Rand"

local prev = create_proof(B3, kp.pk, signed, msg, idx)
local rlen = #prev
for i=1,TOTAL do
local proof = create_proof(B3, kp.pk, signed, msg, idx)
local ham = O.hamming(proof, prev)
local rand = O.hamming(O.random(rlen), O.random(rlen))
print(ham.." \t "..rand)
prev = proof
end


print ("shannon "..prev:entropy())
32 changes: 32 additions & 0 deletions test/benchmark/bbs/sizes.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
print 'BBS+ size benchmarks'
print ''

B3 = BBS.ciphersuite'shake256'
local T, start
start = os.clock()
local kp = keygen(B3)
print('TIME: '..os.clock()-start)
I.print(kp)
print''


local m = { OCTET.random(512) }
local i = { 1 }

start = os.clock()
local signed = sign(B3, kp, m)
print('TIME: '..os.clock()-start)
I.print({signature=signed})
print''

start = os.clock()
local proof = create_proof(B3, kp.pk, signed, m, i)
print('TIME: '..os.clock()-start)
I.print({proof=proof})
print''

print'verification'
disclosed = disclosed_messages(m, i)
start = os.clock()
assert( verify_proof(B3, kp.pk, proof, disclosed, i) )
print('TIME: '..os.clock()-start)

0 comments on commit 219ee64

Please sign in to comment.