Vapor Documentation Beta

Variable Bcrypt

var Bcrypt: BCryptDigest

Creates and verifies BCrypt hashes.

Use BCrypt to create hashes for sensitive information like passwords.

try BCrypt.hash("vapor", cost: 4)

BCrypt uses a random salt each time it creates a hash. To verify hashes, use the verify(_:matches) method.

let hash = try BCrypt.hash("vapor", cost: 4)
try BCrypt.verify("vapor", created: hash) // true

https://en.wikipedia.org/wiki/Bcrypt