Tutorial by Examples

Password Based Key Derivation can be used both for deriving an encryption key from password text and saving a password for authentication purposes. There are several hash algorithms that can be used including SHA1, SHA256, SHA512 which are provided by this example code. The rounds parameter is use...
See Swift 3 example for usage information and notes func pbkdf2SHA1(password: String, salt: [UInt8], keyCount: Int, rounds: Int) -> [UInt8]? { return pbkdf2(CCPBKDFAlgorithm(kCCPRFHmacAlgSHA1), password:password, salt:salt, keyCount:keyCount, rounds:UInt32(rounds)) } func pbkdf2SHA256(p...
See Swift 3 example for usage information and notes func pbkdf2SHA1Calibrate(password:String, salt:[UInt8], msec:Int) -> UInt32 { let actualRoundCount: UInt32 = CCCalibratePBKDF( CCPBKDFAlgorithm(kCCPBKDF2), password.utf8.count, salt.count, CCPseudoRandom...
Determine the number of PRF rounds to use for a specific delay on the current platform. Several parameters are defaulted to representative values that should not materially affect the round count. password Sample password. salt Sample salt. msec Targeted duration we want to achieve f...

Page 1 of 1