diff options
Diffstat (limited to 'rsa/core.py')
-rw-r--r-- | rsa/core.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/rsa/core.py b/rsa/core.py index 23032e3..84ed3f8 100644 --- a/rsa/core.py +++ b/rsa/core.py @@ -23,18 +23,18 @@ def assert_int(var: int, name: str) -> None: if isinstance(var, int): return - raise TypeError('%s should be an integer, not %s' % (name, var.__class__)) + raise TypeError("%s should be an integer, not %s" % (name, var.__class__)) def encrypt_int(message: int, ekey: int, n: int) -> int: """Encrypts a message using encryption key 'ekey', working modulo n""" - assert_int(message, 'message') - assert_int(ekey, 'ekey') - assert_int(n, 'n') + assert_int(message, "message") + assert_int(ekey, "ekey") + assert_int(n, "n") if message < 0: - raise ValueError('Only non-negative numbers are supported') + raise ValueError("Only non-negative numbers are supported") if message > n: raise OverflowError("The message %i is too long for n=%i" % (message, n)) @@ -45,9 +45,9 @@ def encrypt_int(message: int, ekey: int, n: int) -> int: def decrypt_int(cyphertext: int, dkey: int, n: int) -> int: """Decrypts a cypher text using the decryption key 'dkey', working modulo n""" - assert_int(cyphertext, 'cyphertext') - assert_int(dkey, 'dkey') - assert_int(n, 'n') + assert_int(cyphertext, "cyphertext") + assert_int(dkey, "dkey") + assert_int(n, "n") message = pow(cyphertext, dkey, n) return message |