-1

so i found this code online and if the value set is changed to a bigger value it throws me an error

import bit
import tqdm
import time
import random
from bit import *
from tqdm import tqdm
from time import sleep
t = time.ctime()
print('',t)
sleep(1)
print('\n ================= ================= ================= ================= =================')
print('\n\n RANDOM BITCOIN PREDATOR \n #64: 8000000000000000...ffffffffffffffff\n\n')
f=[]
i=0
a=4000000
print('\n Generate',str(a),'random Keys and sort....')
while i < a:
    f.clear()
    print('\n\n WAIT! ', end='\r')
    sleep(1)
    start = time.time()
    f = random.sample(range(9223372036854775808,18446744073709551615), a)
    f.sort()
    end = time.time()
    print('',str(a),'Keys DONE !!','{:5.3f}s'.format(end-start),'\n')
    sleep(1)
    print (' start scanning... ', end='\r')
    sleep(2)
    for line in tqdm(f):
        line!='\n'
        pass
        key = Key.from_int(line)
        addr = key.address

        if addr.startswith('16jY7') or addr.endswith('jyXQN'):
            print('\n\n',hex(line),'|', addr)
            sleep(1)
            print('\n continue...\n')
            sleep(1)

        if addr == "16jY7qLJnxb7CHZyqBP8qca9d51gAjyXQN":
            print('\n\n Target found!!' + hex(line) + ' \n ' + addr,'\n')
            file=open(u"16j.Target.Info.txt","a")
            file.write('\n ' + hex(line) + ' | ' + addr)
            file.close()
            sleep(2)
            wait = input("Press Enter to Exit.")
            sleep(1)
            exit()

error that it throws if i try to add 73786976294838206464,147573952589676412927 insted of (the default) 9223372036854775808,18446744073709551615

this is the error

Traceback (most recent call last):
  File "main.py", line 22, in <module>
    f = random.sample(range(73786976294838206464,147573952589676412927), a)
  File "/usr/lib/python3.8/random.py", line 361, in sample
    n = len(population)
OverflowError: Python int too large to convert to C ssize_t

so the question is how do i change the "f" variable to a bigger value..?? and not get

OverflowError: Python int too large to convert to C ssize_t
5
  • @ArkistarvhKltzuonstev: How could that answer the question when no question was asked? Feb 10, 2022 at 14:06
  • @ScottHunter Added on the assumption that op is interested to know why this code throws this error and maybe forgot to add his question. Feb 10, 2022 at 14:09
  • @ArkistarvhKltzuonstev correct so the question is how do i change it to bigger value..??
    – terminal
    Feb 10, 2022 at 14:12
  • That dupe doesn't seem appropriate. There is a difference in trying to cram a huge number into an explicitly n-bit int versus trying to sample from a huge range. The former is broken due to ones own expectations, the latter due to an implementation detail. It is possible to sample from a huge range, but not to cram a 66 bit number into a 64 bit number. Feb 10, 2022 at 14:30
  • That said, this question would benefit from having a minimal reproducible example instead. There are exactly two lines needed to show the issue, not 50 lines with 2 non-standard dependencies wasting lots of CPU cycles when the code actually runs. Feb 10, 2022 at 14:33

1 Answer 1

-1

I'm pretty sure those numbers are specific values in the module you are using and any integer bigger is not accepted in the the conversion to the C ssize_t.

Not the answer you're looking for? Browse other questions tagged or ask your own question.