srp

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Generator  = BigNumFromInt(7)
	Multiplier = BigNumFromInt(3)
	Prime      = NewBigNumFromHex("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7")
)

Functions

func CalculateVerifier

func CalculateVerifier(auth []byte, g, N, salt *BigNum) (x *BigNum, v *BigNum)

Compute auth := H('username' + ':' + 'pass') g := 7 .... x := H(salt, auth) v := (g^x) % N

func Credentials

func Credentials(username, password string) []byte

func HashCredentials

func HashCredentials(username, password string) []byte

func HashPrimeAndGenerator

func HashPrimeAndGenerator(N, g *BigNum) []byte

Ngh = XOR(H(N), H(g))

func ServerGenerateEphemeralValues

func ServerGenerateEphemeralValues(g, N, v *BigNum) (b *BigNum, B *BigNum)

func ServerLogonProof

func ServerLogonProof(username string, A, M1, b, B, s, N, v *BigNum) ([]byte, bool, []byte)

Types

type BigNum

type BigNum struct {
	X *big.Int
}

func BigNumFromArray

func BigNumFromArray(arr []byte) *BigNum

func BigNumFromInt

func BigNumFromInt(i int64) *BigNum

func BigNumFromRand

func BigNumFromRand(l int) *BigNum

func HashCalculate

func HashCalculate(username string, auth, _B, _N, salt []byte) (*BigNum, []byte, []byte, []byte)

func NewBigNum

func NewBigNum() *BigNum

func NewBigNumFromHex

func NewBigNumFromHex(hx string) *BigNum

Big-Endian.

func SRPCalculate

func SRPCalculate(username, password string, _B, n, salt []byte) (*BigNum, []byte, []byte, []byte)

func (*BigNum) Add

func (x *BigNum) Add(y *BigNum) *BigNum

func (*BigNum) Copy

func (x *BigNum) Copy() *BigNum

func (*BigNum) Divide

func (x *BigNum) Divide(y *BigNum) *BigNum

func (*BigNum) Equals

func (x *BigNum) Equals(y *BigNum) bool

func (*BigNum) Mod

func (x *BigNum) Mod(y *BigNum) *BigNum

func (*BigNum) ModExp

func (x *BigNum) ModExp(y, m *BigNum) *BigNum

func (*BigNum) Multiply

func (x *BigNum) Multiply(y *BigNum) *BigNum

func (*BigNum) String

func (x *BigNum) String() string

func (*BigNum) Subtract

func (x *BigNum) Subtract(y *BigNum) *BigNum

func (*BigNum) ToArray

func (x *BigNum) ToArray(ln ...int) []byte

func (*BigNum) ToHex

func (x *BigNum) ToHex() string

Big-Endian.

func (*BigNum) ToHexLE

func (x *BigNum) ToHexLE(ln ...int) string

Jump to

Keyboard shortcuts

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