gosrp

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hashbyte

func Hashbyte(a ...[]byte) []byte

hash byte stream and return as bytes

func Hashstring

func Hashstring(a ...string) string

func MatchPassword

func MatchPassword(password string, phash PasswordHash) bool

func Pbkdf2

func Pbkdf2(password []byte, salt []byte, iterations int, hash func() hash.Hash, outlen int) (out []byte)

Calculate password hash with PKCS#5 PBKDF2 method using the given hash function as HMAC.

func SessionKey

func SessionKey(rawkey []byte, keylen int) []byte

Generate a session key from the raw key

func Verifier

func Verifier(I, p []byte, bits int) (Ih, salt, v []byte, err error)

Generate a password veririer for user I and passphrase p Return tuple containing hashed identity, salt, verifier. Caller is expected to store the tuple in some persistent DB

Types

type GoSrp

type GoSrp struct {
	State  int
	Salt_s []byte
	Xv_s   []byte
	Salt   *big.Int
	Xv     *big.Int
	XN     *big.Int
	Xg     *big.Int
	Xk     *big.Int
	Key_s  string
	Xb     *big.Int
	Xb_s   string
	XB     *big.Int
	XB_s   string
	Xa     *big.Int
	Xa_s   string
	XA     *big.Int
	XA_s   string
	XI_s   []byte
	XS     *big.Int
	XS_s   string
	XM     string
	XHAMK  string
	Xu     *big.Int
	Xu_s   string
	Xavu   *big.Int
}

func GoSrpNew

func GoSrpNew(C []byte) (rv *GoSrp)

func (*GoSrp) CalculateA

func (gs *GoSrp) CalculateA() string

func (*GoSrp) IssueChallenge

func (gs *GoSrp) IssueChallenge(A_s string) (B_s []byte)

func (*GoSrp) Setup

func (gs *GoSrp) Setup(verifier []byte, salt []byte)

match with __construct

func (*GoSrp) TestDump1

func (gs *GoSrp) TestDump1()

echo "ST/bits= [{$this->ST}/{$this->bits}]\n\n"; echo "verifier= [{$this->verifier}]\n\n"; echo "salt= [{$this->salt}]\n\n"; echo "Nhex= [{$this->Nhex}]\n\n"; echo "g= [{$this->g}]\n\n"; echo "khex= [{$this->khex}]\n\n"; echo "vhex= [{$this->vhex}]\n\n"; echo "key= [{$this->key}]\n\n"; echo "bhex= [{$this->bhex}]\n\n"; echo "Bhex= [{$this->Bhex}]\n\n";

func (*GoSrp) TestDump2

func (gs *GoSrp) TestDump2()

echo "Simulated Client\n\n"; echo "ST/bits= [{$this->ST}/{$this->bits}]\n\n"; echo "ahex= [{$this->ahex}]\n\n"; echo "Ahex= [{$this->Ahex}]\n\n";

func (*GoSrp) TestDump3

func (gs *GoSrp) TestDump3()
public function dumpVars3() {
	echo "ST/bits=  [{$this->ST}/{$this->bits}]\n\n";
	echo "Ahex=     [{$this->Ahex}]\n\n";
	echo "Shex=     [{$this->Shex}]\n\n";
	echo "M=        [{$this->M}]\n\n";
	echo "HAMK=     [{$this->HAMK}]\n\n";
	echo "key=      [{$this->key}]\n\n";
}

type PasswordHash

type PasswordHash struct {
	Salt []byte
	Hash []byte
}

func HashPassword

func HashPassword(password string) (out PasswordHash)

Call Pbkdf2 password hash with reasonable defaults (9999 iterations + SHA1 + 64 bytes output).

func HashPasswordWith

func HashPasswordWith(salt []byte, password string) (out PasswordHash)

Call Pbkdf2 with reasonable defaults (9999 iterations + SHA1 + 64 bytes output).

Directories

Path Synopsis
Package big implements multi-precision arithmetic (big numbers).
Package big implements multi-precision arithmetic (big numbers).

Jump to

Keyboard shortcuts

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