go-argon2

Go bindings for Argon2

  • Owner: tvdburgt/go-argon2
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

go-argon2

GoDoc

Go bindings for the reference C implementation of
Argon2, the winner of the
Password Hash Competition.

Installation

$ go get -d github.com/tvdburgt/go-argon2

This package depends on libargon2, specifically libargon2.so and argon2.h.
Make sure the library files are available in /usr:

$ git clone https://github.com/P-H-C/phc-winner-argon2.git argon2
$ cd argon2
$ git checkout tags/20171227 # switch to latest release
$ sudo make install

Test everything is installed correctly:

$ cd $GOPATH/src/github.com/tvdburgt/go-argon2/
$ go test

Usage

Raw hash with default configuration

hash, err := argon2.Hash(argon2.NewContext(), []byte("password"), []byte("somesalt"))
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%x\n", hash)

Encoded hash with custom configuration

ctx := &argon2.Context{
	Iterations:  5,
	Memory:      1 << 16,
	Parallelism: 2,
	HashLen:     32,
	Mode:        argon2.ModeArgon2i,
	Version:     argon2.Version13,
}

s, err := argon2.HashEncoded(ctx, []byte("password"), []byte("somesalt"))
if err != nil {
	log.Fatal(err)
}

fmt.Println(s)

Main metrics

Overview
Name With Ownertvdburgt/go-argon2
Primary LanguageGo
Program languageGo (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2016-01-10 20:51:20
Pushed At2018-11-09 17:53:42
Last Commit At2018-11-09 18:53:29
Release Count0
用户参与
Stargazers Count138
Watchers Count7
Fork Count13
Commits Count42
Has Issues Enabled
Issues Count9
Issue Open Count2
Pull Requests Count4
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private