[go: up one dir, main page]

commoncrypto 0.2.0

Idiomatic Rust wrappers for Mac OS X's CommonCrypto library
Documentation
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());
}