jonesmarvin8 24f6f1f8ca fixes
2026-04-26 21:29:54 -04:00

16 lines
411 B
Python

import hashlib
import unicodedata
SALT = 'Keycard Pairing Password Salt'
NUMBER_OF_ITERATIONS = 50000
DKLEN = 32
def generate_pairing_token(passphrase: str) -> bytes:
norm_pass = unicodedata.normalize('NFKD', passphrase).encode('utf-8')
salt = unicodedata.normalize('NFKD', SALT).encode('utf-8')
return hashlib.pbkdf2_hmac(
'sha256', norm_pass, salt, NUMBER_OF_ITERATIONS, dklen=DKLEN)