diff options
author | Shengkai Sun <shengkai.sun01@gmail.com> | 2023-04-18 18:15:11 +0800 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2023-04-23 15:38:33 +0200 |
commit | b94766f775aa3cdc541a66355cb00e439aab3e55 (patch) | |
tree | 6c69a9b5f2d94fe1ff177561a383f47d42d27a1f /rsa | |
parent | 5045b149ba255349730e1c7ad78c61700427c5da (diff) | |
download | rsa-git-b94766f775aa3cdc541a66355cb00e439aab3e55.tar.gz |
modified: Fixed a bug in rsa/core.py where the message should not be equals to the modulus
modified: Added test cases in tests/test_integers.py
Diffstat (limited to 'rsa')
-rw-r--r-- | rsa/core.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rsa/core.py b/rsa/core.py index 84ed3f8..4acfa3a 100644 --- a/rsa/core.py +++ b/rsa/core.py @@ -36,7 +36,7 @@ def encrypt_int(message: int, ekey: int, n: int) -> int: if message < 0: raise ValueError("Only non-negative numbers are supported") - if message > n: + if message >= n: raise OverflowError("The message %i is too long for n=%i" % (message, n)) return pow(message, ekey, n) |