vendredi 23 août 2019

OverflowErro cannot fit 'int' into an index-sized integer

I am trying to convert an int of size n bits to bytes. This returns an overflow error

Trying to convert the int to bytes to be used later with TCP

def diffie_hellman():
    global a,g,n
    a = random.randint(1,5000)
    g = random.getrandbits(4000)
    n = sympy.randprime(1, 100)
    #print(a,g,n)

def diffie_send(a,g,n):
    clientsocket.send(bytes(a))
    clientsocket.send(bytes(g))
    clientsocket.send(bytes(n))


I expect it to just convert to bytes but again all i get is an overflow error.




Aucun commentaire:

Enregistrer un commentaire