All Projects → aldy505 → phc-crypto

aldy505 / phc-crypto

Licence: MIT license
Hashing algorithms simplified (supports Argon2, Bcrypt, Scrypt, and PBKDF2)

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to phc-crypto

hash-wasm
Lightning fast hash functions using hand-tuned WebAssembly binaries
Stars: ✭ 382 (+1636.36%)
Mutual labels:  scrypt, argon2, hash, pbkdf2, bcrypt
Password4j
Password4j is a user-friendly cryptographic library that supports Argon2, Bcrypt, Scrypt, PBKDF2 and various cryptographic hash functions.
Stars: ✭ 124 (+463.64%)
Mutual labels:  scrypt, argon2, hash, bcrypt
CppSecurity
C++ Security Library
Stars: ✭ 24 (+9.09%)
Mutual labels:  scrypt, argon2, pbkdf2, bcrypt
noble-hashes
Audited & minimal JS implementation of SHA2, SHA3, RIPEMD, BLAKE2/3, HMAC, HKDF, PBKDF2 & Scrypt
Stars: ✭ 213 (+868.18%)
Mutual labels:  scrypt, hash, pbkdf2
crypthash-net
CryptHash.NET is a .NET multi-target library to encrypt/decrypt/hash/encode/decode strings and files, with an optional .NET Core multiplatform console utility.
Stars: ✭ 33 (+50%)
Mutual labels:  argon2, hash, bcrypt
Scrypt
A .NET implementation of scrypt password hash algorithm.
Stars: ✭ 90 (+309.09%)
Mutual labels:  scrypt, hash, bcrypt
Bcrypt
A Java standalone implementation of the bcrypt password hash function. Based on the Blowfish cipher it is the default password hash algorithm for OpenBSD and other systems including some Linux distributions. Includes a CLI Tool.
Stars: ✭ 207 (+840.91%)
Mutual labels:  hash, bcrypt
Unchained
Secure password hashers for Go compatible with Django
Stars: ✭ 46 (+109.09%)
Mutual labels:  argon2, bcrypt
Comeonin
Password hashing specification for the Elixir programming language
Stars: ✭ 1,166 (+5200%)
Mutual labels:  argon2, bcrypt
heimdall
Secure Password Storage
Stars: ✭ 38 (+72.73%)
Mutual labels:  hash, pbkdf2
Argon2 Browser
Argon2 library compiled for browser runtime
Stars: ✭ 197 (+795.45%)
Mutual labels:  argon2, hash
Simple Scrypt
A convenience library for generating, comparing and inspecting password hashes using the scrypt KDF in Go 🔑
Stars: ✭ 168 (+663.64%)
Mutual labels:  scrypt, hash
Bcrypt.net
BCrypt.Net - Bringing updates to the original bcrypt package
Stars: ✭ 422 (+1818.18%)
Mutual labels:  hash, bcrypt
password-dart
A set of high-level APIs over PointyCastle and CryptoUtils to hash and verify passwords securely.
Stars: ✭ 40 (+81.82%)
Mutual labels:  hash, pbkdf2
bcrypt
BCrypt is a password hashing function
Stars: ✭ 138 (+527.27%)
Mutual labels:  hash, bcrypt
CryptoKnight
CryptoKnight is a general purpose cryptography desktop app
Stars: ✭ 18 (-18.18%)
Mutual labels:  scrypt, bcrypt
deno-bcrypt
A port of jBCrypt to TypeScript for use as a Deno module
Stars: ✭ 56 (+154.55%)
Mutual labels:  hash, bcrypt
bcrypt
Swift implementation of the BCrypt password hashing function
Stars: ✭ 30 (+36.36%)
Mutual labels:  hash, bcrypt
Crypto Password
Library for securely hashing passwords
Stars: ✭ 185 (+740.91%)
Mutual labels:  scrypt, bcrypt
bookshelf-secure-password
A Bookshelf.js plugin for handling secure passwords
Stars: ✭ 24 (+9.09%)
Mutual labels:  hash, bcrypt

PHC Crypto

GitHub release (latest SemVer including pre-releases) Go Reference Go Report Card GitHub codecov CodeFactor Codacy Badge Build test Build test

Inspired by Upash, also implementing PHC string format

Usage

Currently there are two options of using this package:

  1. Import all
  2. Import specific hash function

Bear in mind, these usage function might changed in the near future.

Currently supported formats

  • Bcrypt
  • Argon2i & Argon2id
  • PBKDF2
  • Scrypt

For details regarding configs, please refer to their own directory.

Option 1 - Import all

import (
  "fmt"
  "github.com/aldy505/phc-crypto"
)

func main() {
  // Create a crypto instance
  // Change the scope name to your prefered hashing algorithm
  // Available options are: Bcrypt, Scrypt, Argon2, PBKDF2
  crypto, err := phccrypto.Use(phccrypto.Scrypt, phccrypto.Config{})
  
  hash, err := crypto.Hash("password123")
  if err != nil {
    fmt.Println(err)
  }
  fmt.Println(hash) // returns string ($scrypt$v=0$p=1,ln=32768,r=8$402ffb0b23cd3d3a$62daeae2ac...)

  verify, err := crypto.Verify(hash, "password123")
  if err != nil {
    fmt.Println(err)
  }
  fmt.Println(verify) // returns boolean (true/false)
}

Option 2 - Import specific hash function

import "github.com/aldy505/phc-crypto/scrypt"

func main() {
  // Change the scope name to your prefered hashing algorithm
  hash, err := scrypt.Hash("password123", scrypt.Config{})
  if err != nil {
    fmt.Println(err)
  }
  fmt.Println(hash) // returns string ($scrypt$v=0$p=1,ln=32768,r=8$402ffb0b23cd3d3a$62daeae2ac...)

  verify, err := scrypt.Verify(hash, "password123")
  if err != nil {
    fmt.Println(err)
  }
  fmt.Println(verify) // returns boolean (true/false)
}

Contribute

Yes please! I'm still new to Go and I create this module (or package if you will) to help me fulfill a need on my project. Feel free to refactor, add new feature, fix unknown bugs, and have fun!

LICENSE

MIT License

Copyright (c) 2021-present Reinaldy Rafli and PHC Crypto collaborators

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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].