BCryptPasswordEncoder class
Implementation of PasswordEncoder that uses the BCrypt strong hashing function. Clients can optionally supply a "version" ($2a, $2b, $2y) and a "strength" (a.k.a. log rounds in BCrypt) and a SecureRandom instance. The larger the strength parameter the more work will have to be done (exponentially) to hash the passwords. The default value is 10.
- Inheritance
- Implemented types
Constructors
- BCryptPasswordEncoder({BCryptVersion version = BCryptVersion.$2A, int strength = -1, Random? random})
Properties
- bcryptPattern → RegExp
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- version → BCryptVersion
-
final
Methods
-
bind(
Stream< String> stream) → Stream<String> -
Transforms the provided
stream
.inherited -
cast<
RS, RT> () → Converter< RS, RT> -
Provides a
Converter<RS, RT>
view of this stream transformer.inherited -
convert(
String input) → String -
Converts
input
and returns the result of the conversion.override -
encode(
String rawPassword) → String -
Encode the raw password. Generally, a good encoding algorithm applies a SHA-1 or
greater hash combined with an 8-byte or greater randomly generated salt.
override
-
fuse<
TT> (Converter< String, TT> other) → Converter<String, TT> -
Fuses
this
withother
.inherited -
matches(
String rawPassword, String encodedPassword) → bool -
Verify the encoded password obtained from storage matches the submitted raw
password after it too is encoded. Returns true if the passwords match, false if
they do not. The stored password itself is never decoded.
@param rawPassword the raw password to encode and match
@param encodedPassword the encoded password from storage to compare with
@return true if the raw password, after encoding, matches the encoded password from
storage
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
startChunkedConversion(
Sink< String> sink) → Sink<String> -
Starts a chunked conversion.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
upgradeEncoding(
String encodedPassword) → bool -
Returns true if the encoded password should be encoded again for better digest,
else false. The default implementation always returns false.
@param encodedPassword the encoded password to check
@return true if the encoded password should be encoded again for better digest,
else false.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited