Skip to content

Repository files navigation

Bcrypt

A native, dependency and Foundation free Swift implementation of the bcrypt password hashing algorithm, based on the OpenBSD implementation.

Installation

.package(url:"https://github.com/ptoffy/bcrypt.git", branch:"main")
.product(name:"Bcrypt",package:"bcrypt")

Usage

import Bcrypt
letpassword="password"lethash=tryBcrypt.hash(password: password)letisValid=tryBcrypt.verify(password: password, hash: hash)

Performance

Currently these are the benchmarks for hashing the password "password" with cost factor 12, compared to Vapor's C Bcrypt implementation. Measurements were taken on an M2 MacBook Air.

Release msDebug msAllocations ReleaseAllocations Debug
vapor/authentication215ms337ms~13,700~13,800
bcrypt195ms453ms~13,400~13,500

About

Native, dependency free Swift Bcrypt implementation

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages