unchained

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2018 License: MIT Imports: 3 Imported by: 0

README

Unchained Build Status GoDoc Go Report Card

Django password hashers for Go

About

This project aims to implement Django Hashers in Go to perform user validation against Django legacy databases.

If you're looking for a port of Django's auth application check djinn.

Install

go get github.com/alexandrevicenzi/unchained
go get golang.org/x/crypto/pbkdf2

Supported Hashers

Hasher Encode Decode
argon2
bcrypt
bcrypt_sha256
crypt
md5
pbkdf2_sha1
pbkdf2_sha256
sha1
unsalted_md5
unsalted_sha1

Others hashers are planned to be implemented.

Example

package main

import "github.com/alexandrevicenzi/unchained"

func main() {
    valid, err := unchained.CheckPassword("admin", "pbkdf2_sha256$24000$JMO9TJawIXB1$5iz40fwwc+QW6lZY+TuNciua3YVMV3GXdgkhXrcvWag=")

    if (valid) {
        // do something
    } else {
        // error
    }
}

Reference

Documentation

Overview

Package unchained implements Django password hashers in Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password string, encoded string) (bool, error)

CheckPassword validate if the raw password matches the encoded digest. This is a shortcut that discovers the algorithm used in the encoded digest to perform the correct validation.

func IsPasswordUsable

func IsPasswordUsable(encoded string) bool

IsPasswordUsable returns true if encoded password is usable.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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