All Projects → t3hnar → Scala Bcrypt

t3hnar / Scala Bcrypt

Licence: other
Scala wrapper for jBcrypt + pom.xml inside

Programming Languages

scala
5932 projects

Labels

Projects that are alternatives of or similar to Scala Bcrypt

Resume-Generator
A Resume builder which allows users to build their own custom resumes with details like experience,projects , skills ,education etc. Users can also have the feature to download their resumes . To contribute send PR at development branch from where it will be merged in master once checked.
Stars: ✭ 28 (-80.56%)
Mutual labels:  bcrypt
Bcrypt.net
BCrypt.Net - Bringing updates to the original bcrypt package
Stars: ✭ 422 (+193.06%)
Mutual labels:  bcrypt
Unchained
Secure password hashers for Go compatible with Django
Stars: ✭ 46 (-68.06%)
Mutual labels:  bcrypt
weweibuy-framework
基于Springboot 封装的基础组件, 包括: Http请求响应日志,日志脱敏,APM, 加解密,签名(AES,BCrypt,RSA,JWT),数据库脱敏,报文脱敏,下滑线风格URL传参,统一异常处理,feign mock,feign日志,feign报文风格转换,跨应用异常上抛,自动补偿组件,幂等组件,RocketMq客户端
Stars: ✭ 24 (-83.33%)
Mutual labels:  bcrypt
Quora
Building An Exclusive Community of PEC Graduates and Students.The main features of the website are “PEC Quora” and “PEC Connect”
Stars: ✭ 26 (-81.94%)
Mutual labels:  bcrypt
Upash
🔒Unified API for password hashing algorithms
Stars: ✭ 484 (+236.11%)
Mutual labels:  bcrypt
nestjs-prisma-starter
Starter template for NestJS 😻 includes GraphQL with Prisma Client, Passport-JWT authentication, Swagger Api and Docker
Stars: ✭ 1,107 (+668.75%)
Mutual labels:  bcrypt
Angular Full Stack
Angular Full Stack project built using Angular, Express, Mongoose and Node. Whole stack in TypeScript.
Stars: ✭ 1,261 (+775.69%)
Mutual labels:  bcrypt
Hashes
Magic hashes – PHP hash "collisions"
Stars: ✭ 278 (+93.06%)
Mutual labels:  bcrypt
Phpauth
PHPAuth is a secure PHP Authentication class that easily integrates into any site.
Stars: ✭ 748 (+419.44%)
Mutual labels:  bcrypt
bcrypt
Fast JavaScript implementation of bCrypt
Stars: ✭ 15 (-89.58%)
Mutual labels:  bcrypt
nestjs-auth-starter-kit
NestJS Auth Starter Kit (typescript / typeorm / swagger / passport / bcrypt)
Stars: ✭ 37 (-74.31%)
Mutual labels:  bcrypt
Wp Password Bcrypt
WordPress plugin to implement secure bcrypt hashed passwords
Stars: ✭ 520 (+261.11%)
Mutual labels:  bcrypt
food-help
A clone of popular food and business review web app yelp
Stars: ✭ 24 (-83.33%)
Mutual labels:  bcrypt
Comeonin
Password hashing specification for the Elixir programming language
Stars: ✭ 1,166 (+709.72%)
Mutual labels:  bcrypt
golang-graphql-mongodb
Golang+GraphQL+MongoDB
Stars: ✭ 31 (-78.47%)
Mutual labels:  bcrypt
Permissions2
🔐 Middleware for keeping track of users, login states and permissions
Stars: ✭ 423 (+193.75%)
Mutual labels:  bcrypt
Password4j
Password4j is a user-friendly cryptographic library that supports Argon2, Bcrypt, Scrypt, PBKDF2 and various cryptographic hash functions.
Stars: ✭ 124 (-13.89%)
Mutual labels:  bcrypt
Passwords Evolved
WordPress password authentication for the modern era
Stars: ✭ 74 (-48.61%)
Mutual labels:  bcrypt
Nestjs Prisma Starter
Starter template for NestJS 😻 includes GraphQL with Prisma Client, Passport-JWT authentication, Swagger Api and Docker
Stars: ✭ 547 (+279.86%)
Mutual labels:  bcrypt

Scala Bcrypt Build Status Coverage Status Codacy Badge Version

Scala Bcrypt is a scala friendly wrapper of jBCRYPT

Examples

Safe APIs

The safe APIs will result in scala.util.Failures and scala.util.Successs when executing operations to explicitly indicate the possibility that certain bcrypt operations can fail due to providing incorrect salt versions or number of rounds (eg. > 30 rounds).

Encrypt password

    scala>  import com.github.t3hnar.bcrypt._
    import com.github.t3hnar.bcrypt._

    scala>  "password".bcryptSafeBounded
    res1: Try[String] = Success($2a$10$iXIfki6AefgcUsPqR.niQ.FvIK8vdcfup09YmUxmzS/sQeuI3QOFG)

Validate password

    scala>  "password".isBcryptedSafeBounded("$2a$10$iXIfki6AefgcUsPqR.niQ.FvIK8vdcfup09YmUxmzS/sQeuI3QOFG")
    res2: Try[Boolean] = Success(true)

Composition

Since Try is monadic, you can use a for-comprehension to compose operations that return Success or Failure with fail-fast semantics. You can also use the desugared notation (flatMaps and maps) if you prefer.

    scala>  val bcryptAndVerify = for {
      bcrypted <- "hello".bcryptBounded(12)
      result <- "hello".isBcryptedSafeBounded(bcrypted)
    } yield result
    res: Try[Boolean] = Success(true)

Advanced usage

By default, the salt generated internally, and developer does not need to generate and store salt. But if you decide that you need to manage salt, you can use bcrypt in the following way:

    scala>  val salt = generateSalt
    salt: String = $2a$10$8K1p/a0dL1LXMIgoEDFrwO

    scala>  "password".bcryptBounded(salt)
    res3: Try[String] = Success($2a$10$8K1p/a0dL1LXMIgoEDFrwOfMQbLgtnOoKsWc.6U6H0llP3puzeeEu)

Unsafe APIs

The Unsafe APIs will result in Exceptions being thrown when executing operations as certain bcrypt operations can fail due to providing incorrect salt versions or number of rounds (eg. > 30 rounds or password longer than 71 bytes). These Unsafe APIs are present for backwards compatibility reasons and should be avoided if possible.

Encrypt password

    scala>  import com.github.t3hnar.bcrypt._
    import com.github.t3hnar.bcrypt._

    scala>  "password".bcryptBounded
    res1: String = $2a$10$iXIfki6AefgcUsPqR.niQ.FvIK8vdcfup09YmUxmzS/sQeuI3QOFG

Validate password

    scala>  "password".isBcryptedBounded("$2a$10$iXIfki6AefgcUsPqR.niQ.FvIK8vdcfup09YmUxmzS/sQeuI3QOFG")
    res2: Boolean = true

Advanced usage

    scala>  val salt = generateSalt
    salt: String = $2a$10$8K1p/a0dL1LXMIgoEDFrwO

    scala>  "password".bcryptBounded(salt)
    res3: String = $2a$10$8K1p/a0dL1LXMIgoEDFrwOfMQbLgtnOoKsWc.6U6H0llP3puzeeEu

Setup

SBT

libraryDependencies += "com.github.t3hnar" %% "scala-bcrypt" % "4.1"

Maven

<dependency>
    <groupId>com.github.t3hnar</groupId>
    <artifactId>scala-bcrypt_2.13</artifactId>
    <version>4.1</version>
</dependency>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].