Skip to Content
oxcrypto

bcrypt-pbkdf

Derive key bytes for formats such as OpenSSH encrypted private keys.

from secrets import token_bytes

from oxcrypto.password.bcrypt_pbkdf import BCRYPT_PBKDF

algorithm = BCRYPT_PBKDF.BCRYPT_PBKDF
key = algorithm.derive(b"passphrase", salt=token_bytes(16), rounds=64, length=32)

rounds is the iteration count and length is the output size in bytes. Keep the salt and rounds with the encrypted data.