Difference between revisions of "Cryptography.pbkdf2"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2023.12<br/> '''Class:''' Cryptography<br/> === Description === Password-Based Key Derivation Function 2 (PBKDF2). <syntaxhighlig...")
 
 
Line 4: Line 4:
  
 
=== Description ===
 
=== Description ===
Password-Based Key Derivation Function 2 (PBKDF2).
+
Password-Based Key Derivation Function 2 ('''PBKDF2''').
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
(string) = Cryptography.pbkdf2(password,salt,iterations,outputLength)
 
(string) = Cryptography.pbkdf2(password,salt,iterations,outputLength)

Latest revision as of 19:36, 15 December 2023

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