File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 1818encoded_oid_ecPublicKey = der .encode_oid (* oid_ecPublicKey )
1919
2020if sys .version > '3' :
21- entropy_to_bits = lambda ent_256 : '' . join ( bin (x ) [2 :].zfill (8 ) for x in ent_256 )
21+ entropy_to_bits = lambda ent_256 : bin (int . from_bytes ( ent_256 , 'big' )) [2 :].zfill (len ( ent_256 ) * 8 )
2222else :
2323 entropy_to_bits = lambda ent_256 : '' .join (bin (ord (x ))[2 :].zfill (8 ) for x in ent_256 )
2424if sys .version < '2.7' : #Can't add a method to a built-in type so we are stuck with this
@@ -47,7 +47,7 @@ def randrange(order, entropy=None):
4747 if entropy is None :
4848 entropy = os .urandom
4949 upper_2 = bit_length (order - 2 )
50- upper_256 = int ( upper_2 / 8 + 1 );
50+ upper_256 = upper_2 // 8 + 1
5151 while True : #I don't think this needs a counter with bit-wise randrange
5252 ent_256 = entropy (upper_256 )
5353 ent_2 = entropy_to_bits (ent_256 )
You can’t perform that action at this time.
0 commit comments