File: pbkdf2.rs

package info (click to toggle)
rust-commoncrypto 0.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 100 kB
  • sloc: makefile: 2
file content (16 lines) | stat: -rw-r--r-- 450 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern crate commoncrypto;
extern crate hex;

use commoncrypto::pbkdf2::{pbkdf2, CCPseudoRandomAlgorithm};
use hex::ToHex;

#[test]
fn derive_pbkdf2() {
    let derived = pbkdf2(b"password",
                         b"salt",
                         CCPseudoRandomAlgorithm::kCCPRFHmacAlgSHA1,
                         1,
                         20)
        .unwrap();
    assert_eq!("0c60c80f961f0e71f3a9b524af6012062fe037a6", derived.to_hex());
}