[][src]Enum pwhash::bcrypt::BcryptVariant

pub enum BcryptVariant {
    V2a,
    V2b,
    V2y,
}

Identifiers of algorithm variants which can be produced.

Bcrypt has a long history of use, during which a number bugs were found and fixed in the widely-used implementations. Some bugs were serious enough to warrant a change in the minor version number of the algorithm identifier.

There are two major bcrypt implementations: OpenBSD (the original, used in all *BSDs) and Openwall. A short history of variants is as follows:

  • 2 is the original OpenBSD version, which was very quickly replaced by

  • 2a, which fixed a bug that caused passwords with repeated strings to produce the same hash as those with a single string ("abab" hashed the same as "ab".) This was the most widely used version, until

  • 2y, produced by Openwall, which fixed a sign-extension bug that caused certain passwords with high-bit-set characters to produce weak keys. OpenBSD didn't have this bug, and their logic can transparently handle the 2y hashes. The Openwall fix also introduced

  • 2x, meant for unambiguously identifying pre-fix 2a hashes as those produced by the buggy algorithm. OpenBSD doesn't treat 2x hashes specially, which means that it won't be able to verify buggy hashes. Some time later, a wraparound bug was found in OpenBSD, leading to

  • 2b, which fixed the bug. As the problem involved unrealistically long passwords, the bug was, fortunately, mostly theoretical. This variant is the current default in most implementations.

This crate has a single bcrypt algorithm implementation which is equivalent to the 2b variant. It accepts 2a and 2y on input, and can generate both on output, but doesn't treat them specially in any way.

Variants

V2a

Second OpenBSD variant, fixed repeated string hashing.

V2b

Third OpenBSD variant, fixed a wraparound bug.

V2y

Openwall variant, fixed a sign extension bug.

Trait Implementations

impl Display for BcryptVariant[src]

Auto Trait Implementations

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