Trait secp256kfun::hash::Tagged[][src]

pub trait Tagged: Default + Clone {
    fn tagged(&self, tag: &[u8]) -> Self;
}
Expand description

Extension trait to “tag” a hash as described in BIP-340.

Required methods

Returns the tagged (domain separated) SHA256 instance. This is meant be used on SHA256 state with an empty buffer.

Example

use digest::Digest;
use secp256kfun::hash::Tagged;
let mut hash = sha2::Sha256::default().tagged(b"my-domain/my-purpose");
hash.update(b"hello world");
println!("{:?}", hash.finalize());

Implementors