diff options
Diffstat (limited to 'rsa/core.py')
-rw-r--r-- | rsa/core.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/rsa/core.py b/rsa/core.py index b3114d9..23032e3 100644 --- a/rsa/core.py +++ b/rsa/core.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# # Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,17 +18,15 @@ This is the actual core RSA implementation, which is only defined mathematically on integers. """ -from rsa._compat import is_integer - -def assert_int(var, name): - if is_integer(var): +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__)) -def encrypt_int(message, ekey, n): +def encrypt_int(message: int, ekey: int, n: int) -> int: """Encrypts a message using encryption key 'ekey', working modulo n""" assert_int(message, 'message') @@ -46,7 +42,7 @@ def encrypt_int(message, ekey, n): return pow(message, ekey, n) -def decrypt_int(cyphertext, dkey, n): +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') |