dimanche 20 octobre 2019

How to fix the code in the values so that there are random numbers?

I don’t know in programming, I need to fix the code, in the values of "M" and "L" I need to make random numbers consisting of 128 bits substituted?

def extended_gcd(aa, bb):
    lastremainder, remainder = abs(aa), abs(bb)
    x, lastx, y, lasty = 0, 1, 1, 0
    while remainder:
        lastremainder, (quotient, remainder) = remainder, divmod(lastremainder, remainder)
        x, lastx = lastx - quotient*x, x
        y, lasty = lasty - quotient*y, y
    return lastremainder, lastx * (-1 if aa < 0 else 1), lasty * (-1 if bb < 0 else 1)

def modinv(a, m):
    g, x, y = extended_gcd(a, m)
    if g != 1:
        raise ValueError
    return x % m

M = 0x5FFDF9E967A054B02E0C56CDCF816A98
L = 0x45C42EF3369B5F069C57B4FF54F307F1

with open("results.txt", 'w') as f:
    print(hex(M*L), file=f)



Aucun commentaire:

Enregistrer un commentaire