cryptext

package
v0.0.439 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const LatestPassHashVersion = 5

Variables

This section is empty.

Functions

func BytesSha256

func BytesSha256(v []byte) string

func DecryptAESSimple added in v0.0.66

func DecryptAESSimple(password []byte, encText string) ([]byte, error)

func EncryptAESSimple added in v0.0.66

func EncryptAESSimple(password []byte, data []byte, rounds int) (string, error)

func PronouncablePassword added in v0.0.374

func PronouncablePassword(len int) string

func PronouncablePasswordExt added in v0.0.374

func PronouncablePasswordExt(rng io.Reader, pwlen int) (string, float64)

func PronouncablePasswordSeeded added in v0.0.374

func PronouncablePasswordSeeded(seed int64, len int) string

func StrSha256

func StrSha256(v string) string

Types

type PassHash added in v0.0.47

type PassHash string

PassHash - [v0]: plaintext password ( `0|...` ) // simple, used to write PW's directly in DB - [v1]: sha256(plaintext) // simple hashing - [v2]: seed | sha256<seed>(plaintext) // add seed - [v3]: seed | sha256<seed>(plaintext) | [hex(totp)] // add TOTP support - [v4]: bcrypt(plaintext) | [hex(totp)] // use proper bcrypt - [v5]: bcrypt(sha512(plaintext)) | [hex(totp)] // hash pw before bcrypt (otherwise max pw-len = 72)

func HashPassword added in v0.0.47

func HashPassword(plainpass string, totpSecret []byte) (PassHash, error)

func HashPasswordV0 added in v0.0.47

func HashPasswordV0(plainpass string) (PassHash, error)

func HashPasswordV1 added in v0.0.47

func HashPasswordV1(plainpass string) (PassHash, error)

func HashPasswordV2 added in v0.0.47

func HashPasswordV2(plainpass string) (PassHash, error)

func HashPasswordV3 added in v0.0.47

func HashPasswordV3(plainpass string, totpSecret []byte) (PassHash, error)

func HashPasswordV4 added in v0.0.47

func HashPasswordV4(plainpass string, totpSecret []byte) (PassHash, error)

func HashPasswordV5 added in v0.0.171

func HashPasswordV5(plainpass string, totpSecret []byte) (PassHash, error)

func (PassHash) Change added in v0.0.53

func (ph PassHash) Change(newPlainPass string) (PassHash, error)

func (PassHash) ClearTOTP added in v0.0.52

func (ph PassHash) ClearTOTP() (PassHash, error)

func (PassHash) Data added in v0.0.47

func (ph PassHash) Data() (_version int, _seed []byte, _payload []byte, _totp bool, _totpsecret []byte, _valid bool)

func (PassHash) HasTOTP added in v0.0.47

func (ph PassHash) HasTOTP() bool

func (PassHash) NeedsPasswordUpgrade added in v0.0.47

func (ph PassHash) NeedsPasswordUpgrade() bool

func (PassHash) String added in v0.0.47

func (ph PassHash) String() string

func (PassHash) Upgrade added in v0.0.47

func (ph PassHash) Upgrade(plainpass string) (PassHash, error)

func (PassHash) Valid added in v0.0.47

func (ph PassHash) Valid() bool

func (PassHash) Verify added in v0.0.47

func (ph PassHash) Verify(plainpass string, totp *string) bool

func (PassHash) WithTOTP added in v0.0.52

func (ph PassHash) WithTOTP(totpSecret []byte) (PassHash, error)

Jump to

Keyboard shortcuts

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