MCPcopy Create free account
hub / github.com/archlinux/archinstall / _get_fernet

Function _get_fernet

archinstall/lib/crypt.py:79–97  ·  view source on GitHub ↗
(salt: bytes, password: str)

Source from the content-addressed store, hash-verified

77
78
79def _get_fernet(salt: bytes, password: str) -> Fernet:
80 # https://cryptography.io/en/latest/hazmat/primitives/key-derivation-functions/#argon2id
81 kdf = Argon2id(
82 salt=salt,
83 length=32,
84 iterations=1,
85 lanes=4,
86 memory_cost=64 * 1024,
87 ad=None,
88 secret=None,
89 )
90
91 key = base64.urlsafe_b64encode(
92 kdf.derive(
93 password.encode('utf-8'),
94 ),
95 )
96
97 return Fernet(key)
98
99
100def encrypt(password: str, data: str) -> str:

Callers 2

encryptFunction · 0.85
decryptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected