[][src]Enum phc::Salt

pub enum Salt {
    Ascii(String),
    Binary(Vec<u8>),
}

Salt value used in hashing.

Variants

Ascii(String)

A string with characters in the range [a-zA-Z0-9/+.-].

Binary(Vec<u8>)

A binary value encoded as Base64.

Methods

impl Salt[src]

pub fn into_binary(self) -> Salt[src]

Returns a version of this salt interpreted as binary.

Examples

use phc::Salt;
let salt = Salt::from("c29tZSBzYWx0");
assert_eq!(salt.into_binary(), Salt::from(b"some salt"));

If the salt is invalid ascii, it's returned without change.

use phc::Salt;
let salt = Salt::from("Not salt!");
assert_eq!(salt.clone().into_binary(), salt);

Trait Implementations

impl From<String> for Salt[src]

impl<'_> From<&'_ str> for Salt[src]

impl From<Vec<u8>> for Salt[src]

impl<'_> From<&'_ [u8]> for Salt[src]

impl<'_> From<&'_ [u8; 0]> for Salt[src]

impl From<[u8; 0]> for Salt[src]

impl<'_> From<&'_ [u8; 1]> for Salt[src]

impl From<[u8; 1]> for Salt[src]

impl<'_> From<&'_ [u8; 2]> for Salt[src]

impl From<[u8; 2]> for Salt[src]

impl<'_> From<&'_ [u8; 3]> for Salt[src]

impl From<[u8; 3]> for Salt[src]

impl<'_> From<&'_ [u8; 4]> for Salt[src]

impl From<[u8; 4]> for Salt[src]

impl<'_> From<&'_ [u8; 5]> for Salt[src]

impl From<[u8; 5]> for Salt[src]

impl<'_> From<&'_ [u8; 6]> for Salt[src]

impl From<[u8; 6]> for Salt[src]

impl<'_> From<&'_ [u8; 7]> for Salt[src]

impl From<[u8; 7]> for Salt[src]

impl<'_> From<&'_ [u8; 8]> for Salt[src]

impl From<[u8; 8]> for Salt[src]

impl<'_> From<&'_ [u8; 9]> for Salt[src]

impl From<[u8; 9]> for Salt[src]

impl<'_> From<&'_ [u8; 10]> for Salt[src]

impl From<[u8; 10]> for Salt[src]

impl<'_> From<&'_ [u8; 11]> for Salt[src]

impl From<[u8; 11]> for Salt[src]

impl<'_> From<&'_ [u8; 12]> for Salt[src]

impl From<[u8; 12]> for Salt[src]

impl<'_> From<&'_ [u8; 13]> for Salt[src]

impl From<[u8; 13]> for Salt[src]

impl<'_> From<&'_ [u8; 14]> for Salt[src]

impl From<[u8; 14]> for Salt[src]

impl<'_> From<&'_ [u8; 15]> for Salt[src]

impl From<[u8; 15]> for Salt[src]

impl<'_> From<&'_ [u8; 16]> for Salt[src]

impl From<[u8; 16]> for Salt[src]

impl Clone for Salt[src]

impl PartialEq<Salt> for Salt[src]

impl Debug for Salt[src]

impl Display for Salt[src]

impl StructuralPartialEq for Salt[src]

Auto Trait Implementations

impl Send for Salt

impl Sync for Salt

impl Unpin for Salt

impl UnwindSafe for Salt

impl RefUnwindSafe for Salt

Blanket Implementations

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

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

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 = !

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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