diff --git a/csr-gen.py b/csr-gen.py index 44e7f82..e2890d2 100644 --- a/csr-gen.py +++ b/csr-gen.py @@ -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) diff --git a/hda-endorse.py b/hda-endorse.py index 806f23a..67cdc8f 100644 --- a/hda-endorse.py +++ b/hda-endorse.py @@ -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 @@ -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()) diff --git a/raa-endorse.py b/raa-endorse.py index 8898914..755076c 100644 --- a/raa-endorse.py +++ b/raa-endorse.py @@ -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) @@ -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())