Getting closer; fixed two off by one errors.
%+ point-add
(point-mul prev-s ecc-g)
(point-mul prev-ch (snag prev-k public-keys))
+ ~& [%added a=[prev-s ecc-g] b=[prev-ch (snag prev-k public-keys)] gs=gs]
::
=/ hs=(unit point)
?~ link-state
::
=/ ch=@
(generate-challenge message gs link-state hs)
+ ~& [%challenge-for prev-k ch]
::
?~ ss
[ch challenges]
=| count=@
=| random-s-values=(list @)
|-
- ?: =(count participants)
+ ?: =(count (sub participants 1))
[random-s-values rand]
::
=^ v=@ rand (rads:rand ecc-n)
anonymity-list
sk2-to-prev-sk
::
- k
+ (mod (add k 1) participants)
sk1
chk1
[chk1 ~]
%+ reorder
(sub participants (add k 1))
(flop reversed-chk-to-chk1)
- ~& [%ordered-challenges ordered-challenges]
+ :: ~& [%ordered-challenges ordered-challenges]
?> ?=(^ ordered-challenges)
::
=/ ordered-ss=(list @)
(sub participants k)
^- (list @)
[sk sk1 sk2-to-prev-sk]
- ~& [%ordered-ss ordered-ss]
+ :: ~& [%ordered-ss ordered-ss]
::
[i.ordered-challenges ordered-ss ?~(linkage ~ `y.u.linkage)]
:: +verify: verify signature
(point-mul s0 ecc-g)
::
(point-mul ch0.signature (head anonymity-list))
+ ~& [%added a=[s0 ecc-g] b=[ch0.signature (head anonymity-list)] z0p=z0p]
:: generate the linkage using public data, and the y point from the signature
::
=/ linkage=(unit [data=@ h=point y=point])
[ch1 ~]
==
::
- ~& [%ch0 ch0.signature]
+ ~& [%sig-ch0 ch0.signature]
~& [%challenges challenges]
::
=(ch0.signature (head challenges))
:- %say
|= [[now=time eny=@ our=ship ^] ~ ~]
:- %noun
-~& %about-to-generate-keys
:: deterministically generate keys with insecure numbers for testing purposes
::
=/ key-num=@ 2
=| keys=(list [pk=point sk=@])
::
|-
- ?: =(count 4)
+ ?: =(count 3)
keys
::
=/ sk=@ (etch:ed:crypto (scam:ed:crypto bb:ed:crypto key-num))
=/ my-public-key=point (head my-key)
=/ my-private-key=@ (tail my-key)
::
-~& %about-to-start-real-signing
+~& %start----------signing
+::
+=/ message "blah"
+::=/ scope [~ [%link-scope 52]]
+=/ scope ~
::
=/ signature
- (sign "blah" [~ [%link-scope 52]] key-set my-public-key my-private-key eny)
+ (sign message scope key-set my-public-key my-private-key eny)
::
-~& [%signature signature]
+~& %start----------verification
::
=/ verified
- (verify "blah" [~ [%link-scope 52]] key-set signature)
+ (verify message scope key-set signature)
::
+~& [%signature signature]
~& [%verified verified]
verified
