diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-07-12 11:57:45 -0500 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-07-12 11:57:45 -0500 |
commit | b3d62ad126bcc974ba3265c9ecaaf752c2ef08d4 (patch) | |
tree | 1286b1d34cbc299d2432d708cb9eb7f3a4ac1309 /tests/hazmat/primitives/test_rsa.py | |
parent | 548e85ed63964c38fd450a4ee8753a5be2c956d5 (diff) | |
download | cryptography-b3d62ad126bcc974ba3265c9ecaaf752c2ef08d4.tar.gz cryptography-b3d62ad126bcc974ba3265c9ecaaf752c2ef08d4.tar.bz2 cryptography-b3d62ad126bcc974ba3265c9ecaaf752c2ef08d4.zip |
Fixed #2143 -- added __hash__ to RSA{Public,Private}Numbers
Diffstat (limited to 'tests/hazmat/primitives/test_rsa.py')
-rw-r--r-- | tests/hazmat/primitives/test_rsa.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index bfeab8dd..0c5f7042 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -1705,6 +1705,22 @@ class TestRSANumbersEquality(object): ) assert num != object() + def test_public_numbers_hash(self): + pub1 = RSAPublicNumbers(3, 17) + pub2 = RSAPublicNumbers(3, 17) + pub3 = RSAPublicNumbers(7, 21) + + assert hash(pub1) == hash(pub2) + assert hash(pub1) != hash(pub3) + + def test_private_numbers_hash(self): + priv1 = RSAPrivateNumbers(1, 2, 3, 4, 5, 6, RSAPublicNumbers(1, 2)) + priv2 = RSAPrivateNumbers(1, 2, 3, 4, 5, 6, RSAPublicNumbers(1, 2)) + priv3 = RSAPrivateNumbers(1, 2, 3, 4, 5, 6, RSAPublicNumbers(1, 3)) + + assert hash(priv1) == hash(priv2) + assert hash(priv1) != hash(priv3) + class TestRSAPrimeFactorRecovery(object): @pytest.mark.parametrize( |