#tink #prf

tink-prf

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

8 releases

0.2.5 Mar 14, 2023
0.2.4 Mar 25, 2022
0.2.3 Jan 3, 2022
0.2.1 Oct 8, 2021
0.1.0 Jan 21, 2021

#832 in Cryptography

Download history 4191/week @ 2024-07-22 3256/week @ 2024-07-29 3545/week @ 2024-08-05 7126/week @ 2024-08-12 8552/week @ 2024-08-19 13414/week @ 2024-08-26 6986/week @ 2024-09-02 9360/week @ 2024-09-09 7269/week @ 2024-09-16 9131/week @ 2024-09-23 16290/week @ 2024-09-30 3201/week @ 2024-10-07 13854/week @ 2024-10-14 7457/week @ 2024-10-21 11567/week @ 2024-10-28 1630/week @ 2024-11-04

34,516 downloads per month
Used in 6 crates (2 directly)

Apache-2.0

260KB
4.5K 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

~3–5.5MB
~98K SLoC