scrypto

package module
v0.0.0-...-9278017 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2015 License: MIT Imports: 7 Imported by: 1

README

Scrypto GoDoc Project progress

Scrypt functions for Go

Scrypto provides functions to create and compare passwords using scrypt.

Quick Start

Install using "go get":

go get github.com/codehack/scrypto

Then import from your source:

import "github.com/codehack/scrypto"

Documentation

The full code documentation is located at GoDoc:

http://godoc.org/github.com/codehack/scrypto

Credits

Scrypto is Copyright (c) 2014-present Codehack. Published under MIT License

Documentation

Overview

Package scrypto provides simple functions to hash passwords with scrypt and compare plaintext ones for validity.

Index

Constants

View Source
const (
	// SaltLen is the default length of the random salt.
	SaltLen = 32
	// DefaultN is the default value for Scrypt N.
	DefaultN = 16384
	// DefaultR is the default value for Scrypt r.
	DefaultR = 8
	// DefaultP is the default value for Scrypt p.
	DefaultP = 1
	// KeyLen is the length for the generated key.
	KeyLen = 32
)
View Source
const Version = "0.1.0"

Version is the version of this package.

Variables

This section is empty.

Functions

func Compare

func Compare(password, hpass string) bool

Compare compares a plaintext password to a hashed password. password is a plaintext password. hpass is hashed password string in $s0$ format. returns true if passwords match, false otherwise.

func Hash

func Hash(password string, args ...int) (string, error)

Hash hashes a password with optional scrypt values N, r, and p. password is a plaintext password. args corresponds to N, r, p values. This returns the hashed password using the format: $s0$VALUES$SALT$HASH On failure, empty string and error are returned.

func NewSalt

func NewSalt(size int) ([]byte, error)

NewSalt returns a randomly generated salt of 'size' length. On failure, this returns nil and the error.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL