Instance Methodvapor 4.106.2Vapor
hash(_:salt:)
Bcrypt.swift:42func hash(_ plaintext: String, salt: String) throws -> String
Other members in extension
Type members
init(
) Creates a new
BCryptDigest
. Use the globalBCrypt
convenience variable.
Instance members
func hash(String, cost: Int
) throws -> String Creates a new BCrypt hash with a randomly generated salt. The result can be stored in a database.
func verify(String, created: String
) throws -> Bool Verifies an existing BCrypt hash matches the supplied plaintext value. Verification works by parsing the salt and version from the existing digest and using that information to hash the plaintext data. If hash digests match, this method returns
true
.