@@ -22,21 +22,32 @@ def split_ints(self, secret):
2222 byte_object = bytes (secret , "utf8" )
2323 except :
2424 byte_object = bytes (secret )
25- text = str ( codecs .encode (byte_object , 'hex_codec' ).decode ('utf8' ) ) + "00" * (32 - (len (byte_object ) % 32 ))
25+ text = codecs .encode (byte_object , 'hex_codec' ).decode ('utf8' ) + "00" * (32 - (len (byte_object ) % 32 ))
2626
27- for i in range (0 , int (len (text )/ 32 )):
28- result .append (int (text [i * 32 :(i + 1 )* 32 ], 16 ))
27+ for i in range (0 , int (len (text )/ 64 )):
28+ result .append (int (text [i * 64 :(i + 1 )* 64 ], 16 ))
2929
3030 return result
3131
3232 def merge_ints (self , secrets ):
3333 result = ""
34+
3435 for secret in secrets :
3536 hex_data = hex (secret )[2 :].replace ("L" , "" )
3637 hex_data = "0" * (len (hex_data ) % 2 ) + hex_data
37- result += "00" * (32 - len (hex_data )) + hex_data
38+ hex_data = "0" * (64 - (len (hex_data ))) + hex_data
39+ result += hex_data
40+
41+ byte_object = None
42+ try :
43+ byte_object = bytes (result , "utf8" )
44+
45+ return codecs .decode (byte_object , 'hex_codec' ).decode ('utf8' ).rstrip ("\00 \x00 " )
46+ except :
47+ byte_object = bytes (result )
3848
39- return str (codecs .decode (result , 'hex_codec' ).decode ('utf8' )).rstrip ("\00 \x00 " )
49+ return codecs .decode (byte_object , 'hex_codec' ).rstrip ("\00 \x00 " )
50+ pass
4051
4152 def evaluate_polynomial (self , coefficients , value ):
4253 result = 0
0 commit comments