Encryption – Decryption finally works

With the help of this debugger and that debugger, changing the data from this:

into this:

make the code works. It’s because the data occupied more space than the capacity of the number of words.


lss-67-39:Rosing Experiments CG chika$ ./test_elgamal_CG
poly_prime =
8 0 0 0 0 c9
setting up curve

the curve after setting up:
form: 1
a2: 0 0 0 0 0 2
a6: 0 0 0 0 0 1

counter = 0
inc = 5
Base point
x: 5 63323eab 10fc68f8 254d4d11 d2d518f2 9979dd24
y: 4 883e6269 de8bf93e f6c224e3 330dbf7f 2dd25ec1

create side 2's private key

Side 2 secret:
5 5d0be8bb a913fcdb 91edee60 4da6d486 295d85ac

Generate side 2's public key

Side 2 public key
x: 0 60838c40 7580aec4 b658d152 729f7f67 51d694bd
y: 0 1be3f90c c4a81de1 848ff01b d63e97a4 6b46c459
data =
0 68616c6c 6f0a0000 0 0 60000000

Hide data on curve and send from side 1 to side 2

curve before send_elgamal:
form: 1
a2: 0 0 0 0 0 2
a6: 0 0 0 0 0 1

Their_public before send_elgamal:
x: 0 60838c40 7580aec4 b658d152 729f7f67 51d694bd
y: 0 1be3f90c c4a81de1 848ff01b d63e97a4 6b46c459
=====IN send_elgamal=====
data (in send_gamal function) :
0 68616c6c 6f0a0000 0 0 60000000
Base point
x: 5 63323eab 10fc68f8 254d4d11 d2d518f2 9979dd24
y: 4 883e6269 de8bf93e f6c224e3 330dbf7f 2dd25ec1
Base curve
form: 1
a2: 0 0 0 0 0 2
a6: 0 0 0 0 0 1

random value:
5 3a0f94f6 e0caf9a7 2d189f04 8591c5e5 3935d4dc
Random point C1
x: 2 d6670f0 ab08aca3 8818adbe cf36881d 83accc06
y: 2 cad560f5 72c889b5 226934a2 733455c8 c53a15a6
counter = 0
inc = 0
raw point M (after poly_embed)
x: 0 68616c6c 6f0a0000 0 0 60000000
y: 0 7a64a103 a296a42d 4130d375 23ef2cf2 3f1a3ec0
Their_public:
x: 0 60838c40 7580aec4 b658d152 729f7f67 51d694bd
y: 0 1be3f90c c4a81de1 848ff01b d63e97a4 6b46c459
hidden point (after poly_elptic_mul)
x: 7 1f5fceb7 8269106c c1708600 cde8821b 38e0c7ee
y: 2 d752fec4 40840001 be4a3e7f 347e7013 7f36ce97
Hidden data (C2):
x: 6 a8a348b9 60a911b7 852a3bb9 8ba949df 5a157ae
y: 0 239b098 7584aea3 af4431db 2f3fa3f4 312c5ea9
Random point (C1):
x: 2 d6670f0 ab08aca3 8818adbe cf36881d 83accc06
y: 2 cad560f5 72c889b5 226934a2 733455c8 c53a15a6
=====OUT send_elgamal

AFTER send_elgamal
curve after send_elgamal:
form: 1
a2: 0 0 0 0 0 2
a6: 0 0 0 0 0 1

Hidden data (C2)
x: 6 a8a348b9 60a911b7 852a3bb9 8ba949df 5a157ae
y: 0 239b098 7584aea3 af4431db 2f3fa3f4 312c5ea9
Random point (C1)
x: 2 d6670f0 ab08aca3 8818adbe cf36881d 83accc06
y: 2 cad560f5 72c889b5 226934a2 733455c8 c53a15a6

Recover transmitted message

IN receive_elgamal
Base curve in receive_elgamal
form: 1
a2: 0 0 0 0 0 2
a6: 0 0 0 0 0 1

Hidden_data (in receive_elgamal) :
x: 6 a8a348b9 60a911b7 852a3bb9 8ba949df 5a157ae
y: 0 239b098 7584aea3 af4431db 2f3fa3f4 312c5ea9
Random point
x: 2 d6670f0 ab08aca3 8818adbe cf36881d 83accc06
y: 2 cad560f5 72c889b5 226934a2 733455c8 c53a15a6
hidden_point (d*C1):
x: 7 1f5fceb7 8269106c c1708600 cde8821b 38e0c7ee
y: 2 d752fec4 40840001 be4a3e7f 347e7013 7f36ce97
&raw_point:
x: 0 68616c6c 6f0a0000 0 0 60000000
y: 0 7a64a103 a296a42d 4130d375 23ef2cf2 3f1a3ec0
raw_point.x
0 68616c6c 6f0a0000 0 0 60000000
&raw_data (point):
x: bffff630 bbe72787 d25ef6fb 139332fc 90db35c4 fd129391
y: 0 2 d6670f0 ab08aca3 8818adbe cf36881d
raw_data (point):
x: 0 68616c6c 6f0a0000 0 0 60000000
y: 0 68616c6c 6f0a0000 0 0 60000000
&raw_data (field):
bffff630 bbe72787 d25ef6fb 139332fc 90db35c4 fd129391
raw_data (field):
0 68616c6c 6f0a0000 0 0 60000000
=====OUT receive elgamal

sent data
0 68616c6c 6f0a0000 0 0 60000000
received data (field)
0 68616c6c 6f0a0000 0 0 60000000

Advertisements