Help us shape the future of Go! Take the 2026 Go Developer Survey

auth

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckScrambledPassword

func CheckScrambledPassword(salt, hpwd, auth []byte) bool

CheckScrambledPassword check scrambled password received from client. The new authentication is performed in following manner:

SERVER:  public_seed=create_random_string()
         send(public_seed)
CLIENT:  recv(public_seed)
         hash_stage1=sha1("password")
         hash_stage2=sha1(hash_stage1)
         reply=xor(hash_stage1, sha1(public_seed,hash_stage2)
         // this three steps are done in scramble()
         send(reply)
SERVER:  recv(reply)
         hash_stage1=xor(reply, sha1(public_seed,hash_stage2))
         candidate_hash2=sha1(hash_stage1)
         check(candidate_hash2==hash_stage2)
         // this three steps are done in check_scramble()

func DecodePassword

func DecodePassword(pwd string) ([]byte, error)

DecodePassword converts hex string password without prefix '*' to byte array.

func EncodePassword

func EncodePassword(pwd string) string

EncodePassword converts plaintext password to hashed hex string.

func Sha1Hash

func Sha1Hash(bs []byte) []byte

Sha1Hash is an util function to calculate sha1 hash.

Types

type UserIdentity

type UserIdentity struct {
	Username string
	Hostname string
}

UserIdentity represents username and hostname.

func (*UserIdentity) String

func (user *UserIdentity) String() string

String converts UserIdentity to the format user@host.

Jump to

Keyboard shortcuts

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