tink-prf

Crates.iotink-prf
lib.rstink-prf
version0.3.0
sourcesrc
created_at2021-01-21 11:16:08.26411
updated_at2024-11-28 11:34:40.954576
descriptionPRF functionality for Rust port of Google's Tink cryptography library
homepage
repositoryhttps://github.com/project-oak/tink-rust
max_upload_size
id344844
size41,893
(conradgrobler)

documentation

https://docs.rs/tink-prf

README

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.

Commit count: 765

cargo fmt