#tink #prf

tink-prf

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

9 releases

0.3.0 Nov 28, 2024
0.2.5 Mar 14, 2023
0.2.4 Mar 25, 2022
0.2.1 Oct 8, 2021
0.1.0 Jan 21, 2021

#1382 in Cryptography

Download history 8545/week @ 2024-08-17 13377/week @ 2024-08-24 6429/week @ 2024-08-31 9974/week @ 2024-09-07 7213/week @ 2024-09-14 8855/week @ 2024-09-21 16619/week @ 2024-09-28 3206/week @ 2024-10-05 13543/week @ 2024-10-12 7741/week @ 2024-10-19 11584/week @ 2024-10-26 1564/week @ 2024-11-02 22439/week @ 2024-11-09 30154/week @ 2024-11-16 6113/week @ 2024-11-23 19103/week @ 2024-11-30

79,176 downloads per month
Used in 6 crates (2 directly)

Apache-2.0

255KB
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

~1.4–3.5MB
~52K SLoC