Fast-path good known prime in 2fa

This commit is contained in:
Lonami Exo 2018-12-24 20:17:31 +01:00
parent fb9796a293
commit deb6ca0da0

View File

@ -61,9 +61,8 @@ def check_prime_and_good(prime_bytes: bytes, g: int):
0x0D, 0x81, 0x15, 0xF6, 0x35, 0xB1, 0x05, 0xEE, 0x2E, 0x4E, 0x15, 0xD0, 0x4B, 0x24, 0x54, 0xBF,
0x6F, 0x4F, 0xAD, 0xF0, 0x34, 0xB1, 0x04, 0x03, 0x11, 0x9C, 0xD8, 0xE3, 0xB9, 0x2F, 0xCC, 0x5B))
if good_prime != prime_bytes:
if g in (3, 4, 5, 7):
return # It's good
if good_prime == prime_bytes:
return # It's good
check_prime_and_good_check(int.from_bytes(prime_bytes, 'big'), g)