#prf #tink

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

#1351 in Cryptography

Download history 9909/week @ 2024-11-21 15606/week @ 2024-11-28 15956/week @ 2024-12-05 23075/week @ 2024-12-12 813/week @ 2024-12-19 33/week @ 2024-12-26 10388/week @ 2025-01-02 18641/week @ 2025-01-09 15592/week @ 2025-01-16 6274/week @ 2025-01-23 10262/week @ 2025-01-30 15073/week @ 2025-02-06 8748/week @ 2025-02-13 18068/week @ 2025-02-20 15884/week @ 2025-02-27 16124/week @ 2025-03-06

63,725 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.7–4MB
~62K SLoC