Struct fuzzytags::DetectionKey[][src]

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

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

impl<const GAMMA: u8> DetectionKey<{ GAMMA }>[src]

pub fn id(&self) -> String[src]

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

impl<const GAMMA: u8> DetectionKey<{ GAMMA }>[src]

pub fn false_positive_probability(&self) -> f64[src]

calculate the ideal false positive rate of this detection key

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

pub fn test_tag(&self, tag: &Tag<{ GAMMA }>) -> bool[src]

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

   use fuzzytags::RootSecret;
   let secret = RootSecret::<24>::generate();
   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();

   // 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

impl<const GAMMA: u8> Clone for DetectionKey<GAMMA>[src]

impl<const GAMMA: u8> Debug for DetectionKey<GAMMA>[src]

impl<'de, const GAMMA: u8> Deserialize<'de> for DetectionKey<GAMMA>[src]

impl<const GAMMA: u8> Display for DetectionKey<{ GAMMA }>[src]

impl<const GAMMA: u8> Serialize for DetectionKey<GAMMA>[src]

Auto Trait Implementations

impl<const GAMMA: u8> RefUnwindSafe for DetectionKey<GAMMA>[src]

impl<const GAMMA: u8> Send for DetectionKey<GAMMA>[src]

impl<const GAMMA: u8> Sync for DetectionKey<GAMMA>[src]

impl<const GAMMA: u8> Unpin for DetectionKey<GAMMA>[src]

impl<const GAMMA: u8> UnwindSafe for DetectionKey<GAMMA>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,