#cryptography #tink #prf

tink-prf

PRF functionality for Rust port of Google’s Tink cryptography library

7 releases

0.2.4 Mar 25, 2022
0.2.3 Jan 3, 2022
0.2.1 Oct 8, 2021
0.2.0 May 24, 2021
0.1.0 Jan 21, 2021

#837 in Cryptography

Download history 473/week @ 2022-06-08 382/week @ 2022-06-15 235/week @ 2022-06-22 269/week @ 2022-06-29 190/week @ 2022-07-06 249/week @ 2022-07-13 243/week @ 2022-07-20 554/week @ 2022-07-27 424/week @ 2022-08-03 247/week @ 2022-08-10 232/week @ 2022-08-17 111/week @ 2022-08-24 180/week @ 2022-08-31 240/week @ 2022-09-07 195/week @ 2022-09-14 280/week @ 2022-09-21

917 downloads per month
Used in 6 crates (2 directly)

Apache-2.0

240KB
4K SLoC

Tink-Rust: Pseudo-Random Functions

Docs MSRV

This crate provides pseudo-random function (PRF) functionality, as described in the upstream Tink documentation.

Usage

fn main() -> Result<(), Box<dyn Error>> {
    tink_prf::init();
    let kh = tink_core::keyset::Handle::new(&tink_prf::hmac_sha256_prf_key_template())?;
    let m = tink_prf::Set::new(&kh)?;

    let pt = b"need pseudo-random data deterministically produced from this input";
    let out = m.compute_primary_prf(pt, 16)?;
    println!("'{}' => {}", String::from_utf8_lossy(pt), hex::encode(&out));
    assert_eq!(out.len(), 16);
    Ok(())
}

License

Apache License, Version 2.0

Disclaimer

This is not an officially supported Google product.

Dependencies

~4MB
~61K SLoC