summaryrefslogtreecommitdiff
path: root/rsa/pkcs1.py
diff options
context:
space:
mode:
Diffstat (limited to 'rsa/pkcs1.py')
-rw-r--r--rsa/pkcs1.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/rsa/pkcs1.py b/rsa/pkcs1.py
index 07cf85b..9adad90 100644
--- a/rsa/pkcs1.py
+++ b/rsa/pkcs1.py
@@ -34,6 +34,11 @@ from hmac import compare_digest
from . import common, transform, core, key
+if typing.TYPE_CHECKING:
+ HashType = hashlib._Hash
+else:
+ HashType = typing.Any
+
# ASN.1 codes that describe the hash algorithm used.
HASH_ASN1 = {
'MD5': b'\x30\x20\x30\x0c\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05\x05\x00\x04\x10',
@@ -44,7 +49,7 @@ HASH_ASN1 = {
'SHA-512': b'\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03\x05\x00\x04\x40',
}
-HASH_METHODS = {
+HASH_METHODS: typing.Dict[str, typing.Callable[[], HashType]] = {
'MD5': hashlib.md5,
'SHA-1': hashlib.sha1,
'SHA-224': hashlib.sha224,