Cryptography.pbkdf2

From GiderosMobile

Available since: Gideros 2023.12
Class: Cryptography

Description

Password-Based Key Derivation Function 2 (PBKDF2).

(string) = Cryptography.pbkdf2(password,salt,iterations,outputLength)

Test Vectors: https://www.ietf.org/rfc/rfc6070.txt

Parameters

password: (string) password
salt: (string) key
iterations: (number) iterations
outputLength: (number) output length

Return values

Returns (string) pbkdf2 encoded string

Example

local data = Cryptography.pbkdf2("password", "salt", 4096, 16)
print((" %02x"):rep(#data):format(data:byte(1, #data)))
-- output: 4b 00 79 01 b7 65 48 9a be ad 49 d9 26 f7 21 d0