Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions csr-gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ def det_orchid(raa, hda, hi):
# print("HID:", b_hid)

# perform hash with cSHAKE using input data
h_orchid_left = unhexlify(b_prefix + b_hid + b_ogaid)
h_orchid_left = hex(int(b_prefix + b_hid + b_ogaid, 2))[2:]
# print(h_orchid_left.hex())
shake = cSHAKE128.new(custom = ContextID)
# print(type(h_orchid_left))
# print("HI:", type(hi), hi)
print("HI:", hi)
shake.update((h_orchid_left + hi))
shake.update((unhexlify(h_orchid_left) + unhexlify(hi)))
h_hash = shake.read(8).hex()

# format orchid in binary
h_orchid = hex(int(b_prefix + b_hid + b_ogaid, 2))[2:] + h_hash
h_orchid = h_orchid_left + h_hash
orchid = 2

print("DET:", h_orchid)
Expand Down
6 changes: 3 additions & 3 deletions hda-endorse.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ def det_orchid(raa, hda, hi):
# print("HID:", b_hid)

# perform hash with cSHAKE using input data
h_orchid_left = unhexlify(b_prefix + b_hid + b_ogaid)
h_orchid_left = hex(int(b_prefix + b_hid + b_ogaid, 2))[2:]
# print(h_orchid_left.hex())
shake = cSHAKE128.new(custom = ContextID)
# print(type(h_orchid_left),h_orchid_left)
# print("hi",type(hi), hi)
shake.update((h_orchid_left + hi))
shake.update((unhexlify(h_orchid_left) + unhexlify(hi)))
h_hash = shake.read(8).hex()

# format orchid in binary
Expand Down Expand Up @@ -208,7 +208,7 @@ def det_orchid(raa, hda, hi):

pleasesign = hex(int(vnbtime))[2:].zfill(8) + hex(int(vnatime))[2:].zfill(8) + det.zfill(32) + ua_hihex.zfill(64) + DETofHDA
#print(pleasesign)
pleasesignb = bytes(pleasesign, 'utf-8')
pleasesignb = unhexlify(pleasesign)
#print(type(pleasesignb),pleasesignb)
signature = hda_prkey.sign(pleasesignb)
#print(type(signature.hex()),signature.hex())
Expand Down
4 changes: 2 additions & 2 deletions raa-endorse.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def det_orchid(raa, hda, hi):
# print("HID:", b_hid)

# perform hash with cSHAKE using input data
h_orchid_left = unhexlify(b_prefix + b_hid + b_ogaid)
h_orchid_left = hex(int(b_prefix + b_hid + b_ogaid, 2))[2:]
# print(h_orchid_left.hex())
shake = cSHAKE128.new(custom = ContextID)
# print(type(h_orchid_left),h_orchid_left)
Expand Down Expand Up @@ -212,7 +212,7 @@ def det_orchid(raa, hda, hi):

pleasesign = hex(int(vnbtime))[2:].zfill(8) + hex(int(vnatime))[2:].zfill(8) + det.zfill(32) + hda_hihex.zfill(64) + DETofRAA
#print(pleasesign)
pleasesignb = bytes(pleasesign, 'utf-8')
pleasesignb = unhexlify(pleasesign)
#print(type(pleasesignb),pleasesignb)
signature = raa_prkey.sign(pleasesignb)
#print(type(signature.hex()),signature.hex())
Expand Down