Move to base32 check strings instead
This commit is contained in:
parent
86c97b4ac0
commit
4bc207967d
|
@ -111,7 +111,7 @@ def auth_hash(client_pubkey, server_pubkey):
|
|||
combined_hash = sha512(client_pubkey_hash + server_pubkey_hash)
|
||||
|
||||
truncated_hash = combined_hash[:32]
|
||||
hash_check = sha512(truncated_hash)[:4]
|
||||
hash_check = sha512(truncated_hash)[:5]
|
||||
return truncated_hash + hash_check
|
||||
|
||||
def chunk(sliceable, length):
|
||||
|
@ -119,9 +119,9 @@ def chunk(sliceable, length):
|
|||
yield sliceable[i:i + length]
|
||||
|
||||
def format_hash(hash_bytes):
|
||||
hash_base64 = base64.b64encode(hash_bytes).decode()
|
||||
chunked_base64 = chunk(hash_base64, 4)
|
||||
return '-'.join(chunked_base64)
|
||||
hash_base32 = base64.b32encode(hash_bytes).decode().lower().replace('=', '')
|
||||
chunked_base32 = chunk(hash_base32, 5)
|
||||
return '-'.join(chunked_base32)
|
||||
|
||||
def verify(client_pubkey, server_pubkey):
|
||||
own_hash = auth_hash(client_pubkey, server_pubkey)
|
||||
|
|
Loading…
Reference in New Issue