Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to utilize Bcrypt for iOS development with Swift?

I have been searching for a library, cocoapod, or something else that allows me to implement Bcrypt in iOS using Swift.

like image 310
Bourne Avatar asked Aug 06 '15 11:08

Bourne


1 Answers

BCryptSwift - cocoapod written in Swift.

There is also a cocoapod BCrypt, it's actually a version used in the Perfect (Swift-serverside toolkit), but adopted to be used in iOS as a cocoa pod dependency.

Sample usage:

import BCrypt

let password = "mypassword"
do {
    let salt = try BCrypt.Salt()
    let hashed = try BCrypt.Hash(password, salt: salt)
    print("Hashed result is: \(hashed)")
}
catch {
    print("An error occured: \(error)")
}
like image 77
beryllium Avatar answered Sep 30 '22 19:09

beryllium