Try   HackMD

ZKHack IV Puzzles #3 Chaos Theory

Puzzle: https://zkhack.dev/zkhackIV/puzzleF3.html
Solution: https://github.com/flyq/puzzle-chaos-theory

ElGamal encryption

Key generation

Alice:

  • secret key:
    x
  • public key:
    H=xG

Encryption

Bob:

  • M=F(m)
    , the
    m
    is the message, and the
    M
    is the element in
    G
    .
  • ephemeral key:
    y
  • shared secret:
    S=Hy=xyG
  • C1=yG
  • C2=S+M

if someone knows

(C1,C2) and
M
, the
S=C2M

Decryption

Alice:

  • S=C1x=xyG
  • M=C2S
  • m=F1(M)

Sender(Bob):

y and
C1=yG1

Receiver(Alice):
H
in
G1
group
Message:
M
in
G1
group
ElGamal:
(C1,C2)
in
G1
group,
H((C1,C2))=hash_to_curve((C1,C2))Q
in
G2
group

s:

T=yH((C1,C2))

  • send:
    C1
    ,
    C2=Hy+M=S+M
  • authenticate:
    H((C1,C2))y
  • check_auth:
    e(G1,T)=e(C1,H((C1,C2)))

blob:

C1,(C1,C2),T,H