@@ -79,7 +79,7 @@ def hex2bin(hex_str):
7979
8080The `setRNG` function mirrors the logic of the JavaScript function. If it's a
8181string, ANY STRING, it implies a specific type is requested. In such cases,
82- it will function like the JavaScript `test_random ` RNG for testing purposes.
82+ it will function like the JavaScript `testRandom ` RNG for testing purposes.
8383
8484This adaptation aims to maintain the core functionality of the JavaScript
8585version while adhering to Python idioms and conventions. The focus is on
@@ -239,10 +239,9 @@ def base36encode(
239239
240240 return sign + base36
241241
242- share_id = int (share_id , 10 ) # Value is store as int
242+ share_id = int (share_id , 10 ) # Value is stored as int
243243 bits = bits or settings .bits
244244 bits_base36 = base36encode (bits ).upper ()
245- # id_max = 2**bits - 1
246245 id_max = settings .maxShares
247246 id_padding_len = len (hex (int (id_max ))[2 :])
248247 id_hex = padLeft (hex (int (share_id ))[2 :], id_padding_len )
@@ -386,12 +385,13 @@ def getConfig():
386385
387386
388387def extractShareComponents (share ):
388+
389389 defaults = {
390390 "minBits" : 1 ,
391391 "maxBits" : 32 ,
392392 } # Assuming defaults for minBits and maxBits
393- config = {"radix" : 16 } # Assuming radix as 16 for hex numbers
394393
394+ config = {"radix" : 16 } # Assuming radix as 16 for hex numbers
395395 bits = int (share [0 ], 36 )
396396
397397 if not (
@@ -524,6 +524,7 @@ def hex2str(hex_string, bytes_per_char=None):
524524
525525
526526def random (bits ):
527+
527528 if not isinstance (bits , int ) or bits < 2 or bits > 65536 :
528529 raise ValueError (
529530 "Number of bits must be an Integer between 2 and 65536."
0 commit comments