Struct fuzzytags::DetectionKey[][src]

pub struct DetectionKey<const GAMMA: u8>(_);
Expand description

A collection of “secret” data that can be used to determine if a FuzzyTag was intended for the derived tagging key with probability p

Implementations

a convenient id for a detection key for internal accounting purposes do not expose this to applications

calculate the ideal false positive rate of this detection key

   use fuzzytags::RootSecret;
    use rand::rngs::OsRng;
    let mut rng = OsRng;
   let secret = RootSecret::<24>::generate(&mut rng);
   let tagging_key = secret.tagging_key();
   // extract a detection key
   let detection_key = secret.extract_detection_key(5);
   detection_key.false_positive_probability();

returns true if the tag was intended for this key Example:

   use fuzzytags::RootSecret;
   use rand::rngs::OsRng;
   let mut rng = OsRng;
   let secret = RootSecret::<24>::generate(&mut rng);
   let tagging_key = secret.tagging_key();
   // extract a detection key
   let detection_key = secret.extract_detection_key(5);

   // Give tagging key to a another party...
   // and then they can do...
   let tag = tagging_key.generate_tag(&mut rng);

   // The server can now do this:
   if detection_key.test_tag(&tag) {
   // the message attached to this tag *might* be for the party associated with the detection key
   } else {
   // the message attached to this tag is definitely *not* for the party associated with the detection key.
   }

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.