PBKDF
public class PBKDF
Derives key material from a password or passphrase.
-
Enumerates available pseudo random algorithms
See moreDeclaration
Swift
public enum PseudoRandomAlgorithm
-
Determines the (approximate) number of iterations of the key derivation algorithm that need to be run to achieve a particular delay (or calculation time).
Declaration
Swift
public class func calibrate(passwordLength: Int, saltLength: Int, algorithm: PseudoRandomAlgorithm, derivedKeyLength: Int, msec: UInt32) -> UInt
Parameters
passwordLength
Password length in bytes
saltLength
Salt length in bytes
algorithm
The PseudoRandomAlgorithm to use
derivedKeyLength
The desired key length
msec
The desired calculation time
Return Value
The number of times the algorithm should be run
-
Derives key material from a password and salt.
Declaration
Swift
public class func deriveKey(fromPassword password: String, salt: String, prf: PseudoRandomAlgorithm, rounds: uint, derivedKeyLength: UInt) throws -> [UInt8]
Parameters
password
The password string, will be converted using UTF8
salt
The salt string will be converted using UTF8
prf
The pseudo random function
round
The number of rounds
derivedKeyLength
The length of the desired derived key, in bytes.
Return Value
The derived key
-
Derives key material from a password and salt.
Declaration
Swift
public class func deriveKey(fromPassword password: String, salt: [UInt8], prf: PseudoRandomAlgorithm, rounds: uint, derivedKeyLength: UInt) throws -> [UInt8]
Parameters
password
The password string, will be converted using UTF8
salt
The salt array of bytes
prf
The pseudo random function
round
The number of rounds
derivedKeyLength
The length of the desired derived key, in bytes.
Return Value
The derived key
-
Derives key material from a password buffer.
Declaration
Swift
public class func deriveKey(fromPassword password: UnsafePointer<Int8>, passwordLen: Int, salt: UnsafePointer<UInt8>, saltLen: Int, prf: PseudoRandomAlgorithm, rounds: uint, derivedKey: UnsafeMutablePointer<UInt8>, derivedKeyLen: Int) throws
Parameters
password
Pointer to the password buffer
passwordLength
Password length in bytes
salt
Pointer to the salt buffer
saltLength
Salt length in bytes
prf
The PseudoRandomAlgorithm to use
rounds
The number of rounds of the algorithm to use
derivedKey
Pointer to the derived key buffer.
derivedKeyLength
The desired key length
Return Value
The number of times the algorithm should be run