Use """ instead of ''' for docstrings.
This commit is contained in:
parent
7c53d5e42d
commit
059f819c9c
1 changed files with 4 additions and 4 deletions
|
@ -104,11 +104,11 @@ def str_to_a32(b):
|
||||||
|
|
||||||
|
|
||||||
def mpi_to_int(s):
|
def mpi_to_int(s):
|
||||||
'''
|
"""
|
||||||
A Multi-precision integer is encoded as a series of bytes in big-endian
|
A Multi-precision integer is encoded as a series of bytes in big-endian
|
||||||
order. The first two bytes are a header which tell the number of bits in
|
order. The first two bytes are a header which tell the number of bits in
|
||||||
the integer. The rest of the bytes are the integer.
|
the integer. The rest of the bytes are the integer.
|
||||||
'''
|
"""
|
||||||
return int(binascii.hexlify(s[2:]), 16)
|
return int(binascii.hexlify(s[2:]), 16)
|
||||||
|
|
||||||
def extended_gcd(a, b):
|
def extended_gcd(a, b):
|
||||||
|
@ -119,10 +119,10 @@ def extended_gcd(a, b):
|
||||||
return (g, x - (b // a) * y, y)
|
return (g, x - (b // a) * y, y)
|
||||||
|
|
||||||
def modular_inverse(a, m):
|
def modular_inverse(a, m):
|
||||||
'''
|
"""
|
||||||
Thank you Mart Bakhoff for this solution.
|
Thank you Mart Bakhoff for this solution.
|
||||||
https://stackoverflow.com/a/9758173
|
https://stackoverflow.com/a/9758173
|
||||||
'''
|
"""
|
||||||
g, x, y = extended_gcd(a, m)
|
g, x, y = extended_gcd(a, m)
|
||||||
if g != 1:
|
if g != 1:
|
||||||
raise Exception('modular inverse does not exist')
|
raise Exception('modular inverse does not exist')
|
||||||
|
|
Loading…
Reference in a new issue