Hash class

Constructors

Hash()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

rounds ↔ int
bcrypt cost (log rounds) for new hashes. Default: 10. Each step up doubles the time. Allowed: 4 to 31. Old hashes keep their own cost, so they still verify.
getter/setter pair

Static Methods

check(String password, String hashedPassword) → bool
same as verify, with the Laravel name
equals(String a, String b) → bool
true when a and b are the same. It takes the same time for any two values of the same length, so the time does not tell how much of a secret (an API key, a token) was right.
make(String password, {int? rounds}) → String
has the password using BCrypt technique. A password over maxBytes (72) bytes throws an ArgumentError. The error text does not hold the password, so it is safe to log. Limit the length in your DTO, like max(72).
makeAsync(String password, {int? rounds}) → Future<String>
same as make, but runs bcrypt in a new isolate, so the server can answer other requests in the meantime.
sha256(String value) → String
SHA-256 of value, as 64 hex characters.
verify(String password, String hashedPassword) → bool
verify the password with input password and stored hash string. Returns false when the hash is not a valid bcrypt hash.
verifyAsync(String password, String hashedPassword) → Future<bool>
same as verify, but runs bcrypt in a new isolate, so the server can answer other requests in the meantime.

Constants

maxBytes → const int
bcrypt uses at most 72 bytes of a password.