whoever invented tabs should swim in a bathtub full of space bars

master
George Hotz 2017-04-26 10:44:24 -07:00
parent bdc3a05a93
commit e42f03d58e
1 changed files with 10 additions and 10 deletions

View File

@ -4,18 +4,18 @@ import struct
from Crypto.PublicKey import RSA
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
def modinv(a, m):
g, x, y = egcd(a, m)
if g != 1:
raise Exception('modular inverse does not exist')
else:
return x % m
g, x, y = egcd(a, m)
if g != 1:
raise Exception('modular inverse does not exist')
else:
return x % m
def to_c_string(x):
mod = (hex(x)[2:-1].rjust(0x100, '0'))