Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Apr 20, 2025. It is now read-only.

Commit 6b3c23d

Browse filesBrowse files
hugovksybrenstuvel
authored andcommitted
Add items directly into dicts
1 parent 282ba37 commit 6b3c23d
Copy full SHA for 6b3c23d

File tree

Expand file treeCollapse file tree

1 file changed

+6
-17
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-17
lines changed

‎rsa/pkcs1.py

Copy file name to clipboardExpand all lines: rsa/pkcs1.py
+6-17Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
"SHA-256": b"\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20",
4848
"SHA-384": b"\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02\x05\x00\x04\x30",
4949
"SHA-512": b"\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03\x05\x00\x04\x40",
50+
"SHA3-256": b"\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x08\x05\x00\x04\x20",
51+
"SHA3-384": b"\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x09\x05\x00\x04\x30",
52+
"SHA3-512": b"\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x0a\x05\x00\x04\x40",
5053
}
5154

5255
HASH_METHODS: typing.Dict[str, typing.Callable[[], HashType]] = {
@@ -56,27 +59,13 @@
5659
"SHA-256": hashlib.sha256,
5760
"SHA-384": hashlib.sha384,
5861
"SHA-512": hashlib.sha512,
62+
"SHA3-256": hashlib.sha3_256,
63+
"SHA3-384": hashlib.sha3_384,
64+
"SHA3-512": hashlib.sha3_512,
5965
}
6066
"""Hash methods supported by this library."""
6167

6268

63-
HASH_ASN1.update(
64-
{
65-
"SHA3-256": b"\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x08\x05\x00\x04\x20",
66-
"SHA3-384": b"\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x09\x05\x00\x04\x30",
67-
"SHA3-512": b"\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x0a\x05\x00\x04\x40",
68-
}
69-
)
70-
71-
HASH_METHODS.update(
72-
{
73-
"SHA3-256": hashlib.sha3_256,
74-
"SHA3-384": hashlib.sha3_384,
75-
"SHA3-512": hashlib.sha3_512,
76-
}
77-
)
78-
79-
8069
class CryptoError(Exception):
8170
"""Base class for all exceptions in this module."""
8271

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.