All Projects → agnivade → easy-scrypt

agnivade / easy-scrypt

Licence: MIT License
This is a nice and simple wrapper in Go over the scrypt password based key derivation algorithm.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to easy-scrypt

CryptoKnight
CryptoKnight is a general purpose cryptography desktop app
Stars: ✭ 18 (-14.29%)
Mutual labels:  hashing, scrypt
Password4j
Password4j is a user-friendly cryptographic library that supports Argon2, Bcrypt, Scrypt, PBKDF2 and various cryptographic hash functions.
Stars: ✭ 124 (+490.48%)
Mutual labels:  hashing, scrypt
Masterpassword
Project moved to https://gitlab.com/spectre.app
Stars: ✭ 1,122 (+5242.86%)
Mutual labels:  scrypt, passwords
noble-hashes
Audited & minimal JS implementation of SHA2, SHA3, RIPEMD, BLAKE2/3, HMAC, HKDF, PBKDF2 & Scrypt
Stars: ✭ 213 (+914.29%)
Mutual labels:  hashing, scrypt
riddler
Riddler is a lightweight, performant microservice that checks passwords against the NCSC top list of the most common passwords
Stars: ✭ 31 (+47.62%)
Mutual labels:  passwords
laravel-hashid
HashId Implementation on Laravel Eloquent ORM
Stars: ✭ 23 (+9.52%)
Mutual labels:  hashing
smhasher
No description or website provided.
Stars: ✭ 65 (+209.52%)
Mutual labels:  hashing
InterviewBit
Collection of solution for problems on InterviewBit
Stars: ✭ 77 (+266.67%)
Mutual labels:  hashing
laravel-pwned-passwords
Simple Laravel validation rule that allows you to prevent or limit the re-use of passwords that are known to be pwned (unsafe). Based on TroyHunt's Have I Been Pwned (https://haveibeenpwned.com)
Stars: ✭ 67 (+219.05%)
Mutual labels:  passwords
sph-lib
more than 80 gpl3+ licensed guile scheme libraries
Stars: ✭ 15 (-28.57%)
Mutual labels:  scrypt
marscoin
Marscoin source tree
Stars: ✭ 37 (+76.19%)
Mutual labels:  scrypt
pthash
Fast and compact minimal perfect hash functions in C++.
Stars: ✭ 62 (+195.24%)
Mutual labels:  hashing
bncsutil
The Classic Battle.net™ client library
Stars: ✭ 19 (-9.52%)
Mutual labels:  passwords
brutas
Wordlists and passwords handcrafted with ♥
Stars: ✭ 32 (+52.38%)
Mutual labels:  passwords
server
Hashtopolis - A Hashcat wrapper for distributed hashcracking
Stars: ✭ 954 (+4442.86%)
Mutual labels:  passwords
DemoInPutPasswordView
仿微信支付密码输入框 (A input password alert view like wechat pay.)
Stars: ✭ 44 (+109.52%)
Mutual labels:  passwords
TripleSecManaged
A C# port of the TripleSec encryption scheme created by Chris Coyne, Maxwell Krohn, and Filippo Valsorda
Stars: ✭ 18 (-14.29%)
Mutual labels:  scrypt
agent-python
Official python agent for using the distributed hashcracker Hashtopolis
Stars: ✭ 39 (+85.71%)
Mutual labels:  hashing
xxhashdir
⚡Fast filysystem fingerprinting using xxHash
Stars: ✭ 47 (+123.81%)
Mutual labels:  hashing
privnote-cli
🔑 the power of privnote.com in your terminal
Stars: ✭ 43 (+104.76%)
Mutual labels:  passwords

easy-scrypt Build Status Go Report Card codecov GoDoc

This is a nice and simple wrapper in Go over the raw scrypt libraries available. There are just 2 calls exposed by the library(and should be!) which makes it super easy to embed in any of your projects.

You can use it to -

  1. Safely hash passwords.
  2. Hash a passphrase to get a derived key.
  3. Let me know if you find other uses .. :)

Quick start

package main

import (
	"fmt"
	"github.com/agnivade/easy-scrypt"
)

func main() {
	passphrase := "Hello there this is a sample passphrase"

	key, err := scrypt.DerivePassphrase(passphrase, 32)
	if err != nil {
		fmt.Errorf("Error returned: %s\n", err)
	}

	fmt.Printf("Key returned - %v\n", key)
	var result bool

	result, err = scrypt.VerifyPassphrase(passphrase, key)
	if err != nil {
		fmt.Errorf("Error returned: %s\n", err)
	}
	if !result {
		fmt.Errorf("Passphrase did not match\n")
	} else {
		fmt.Printf("Passphrase matched successfully\n")
	}
}

Implementation Details

The scrypt call is invoked with these params - N = 16384 r = 8 p = 1

The salt is randomly generated from the crypto/rand library which generates a cryptographically secure pseudorandom number.

The returned key will be of x+60 bytes in length where x is the key length passed to the call. The key returned is of this format -

array index starts from left.
<-----x-----><----16----><--4--><--4--><--4--><----32---->
    dKey          salt      N      r      p   sha-256 hash

A SHA-256 of the entire content(dKey+salt+n+r+p) is computed and stored at the end to just verify the integrity of the content.

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].