Crates.io | tink-prf |
lib.rs | tink-prf |
version | 0.3.0 |
source | src |
created_at | 2021-01-21 11:16:08.26411 |
updated_at | 2024-11-28 11:34:40.954576 |
description | PRF functionality for Rust port of Google's Tink cryptography library |
homepage | |
repository | https://github.com/project-oak/tink-rust |
max_upload_size | |
id | 344844 |
size | 41,893 |
This crate provides pseudo-random function (PRF) functionality, as described in the upstream Tink documentation.
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(())
}
This is not an officially supported Google product.