mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-21 19:14:19 +01:00
@@ -3,31 +3,31 @@
|
|||||||
"""
|
"""
|
||||||
Implementation of https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406
|
Implementation of https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406
|
||||||
|
|
||||||
Alice (Client):
|
Bob (Mint):
|
||||||
A = a*G
|
A = a*G
|
||||||
return A
|
return A
|
||||||
|
|
||||||
Bob (Mint):
|
Alice (Client):
|
||||||
Y = hash_to_curve(secret_message)
|
Y = hash_to_curve(secret_message)
|
||||||
r = random blinding factor
|
r = random blinding factor
|
||||||
B'= Y + r*G
|
B'= Y + r*G
|
||||||
return B'
|
return B'
|
||||||
|
|
||||||
Alice:
|
Bob:
|
||||||
C' = a*B'
|
C' = a*B'
|
||||||
(= a*Y + a*r*G)
|
(= a*Y + a*r*G)
|
||||||
return C'
|
return C'
|
||||||
|
|
||||||
Bob:
|
Alice:
|
||||||
C = C' - r*A
|
C = C' - r*A
|
||||||
(= C' - a*r*G)
|
(= C' - a*r*G)
|
||||||
(= a*Y)
|
(= a*Y)
|
||||||
return C, secret_message
|
return C, secret_message
|
||||||
|
|
||||||
Alice:
|
Bob:
|
||||||
Y = hash_to_curve(secret_message)
|
Y = hash_to_curve(secret_message)
|
||||||
C == a*Y
|
C == a*Y
|
||||||
If true, C must have originated from Alice
|
If true, C must have originated from Bob
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|||||||
Reference in New Issue
Block a user