crypto

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidKey        = errors.New("invalid_key")
	ErrInvalidCiphertext = errors.New("invalid_ciphertext")
)
View Source
var (
	ErrInvalidHash         = errors.New("invalid_argon_hash")
	ErrIncompatibleVersion = errors.New("incompatible_argon_version")
	DefaultArgonParams     = ArgonParams{
							// contains filtered or unexported fields
	}
)
View Source
var (
	ErrPemDecodeFailed    = errors.New("pem_data_decode_failed")
	ErrPemKeyDecodeFailed = errors.New("pem_key_decode_failed")
)

Functions

func ArgonCompareHash

func ArgonCompareHash(password, encodedPassword string) (bool, error)

func ArgonDummyCompare

func ArgonDummyCompare()

func ArgonHash

func ArgonHash(password string, p ArgonParams) (string, error)

func Hash

func Hash(b []byte) string

func HashBytes

func HashBytes(bs ...[]byte) string

func ParsePrivateKey

func ParsePrivateKey(source io.Reader) (*rsa.PrivateKey, error)

func ParsePublicKey

func ParsePublicKey(source io.Reader) (*rsa.PublicKey, error)

func RandomBytes

func RandomBytes(n uint) ([]byte, error)

func RandomString

func RandomString(n uint) (string, error)

func ReadRandomBytes

func ReadRandomBytes(o []byte) error

func Sign

func Sign(message []byte, key *rsa.PrivateKey) ([]byte, error)

func Verify

func Verify(message, signature []byte, key *rsa.PublicKey) error

Types

type AES

type AES struct {
	// contains filtered or unexported fields
}

func NewAES

func NewAES(key []byte) (*AES, error)

func (*AES) Decrypt

func (a *AES) Decrypt(ciphertext []byte) ([]byte, error)

func (*AES) Encrypt

func (a *AES) Encrypt(plaintext []byte) ([]byte, error)

type ArgonParams

type ArgonParams struct {
	// contains filtered or unexported fields
}

type HMAC

type HMAC struct {
	// contains filtered or unexported fields
}

func NewHMAC

func NewHMAC(key []byte) *HMAC

func (*HMAC) Generate

func (h *HMAC) Generate(message []byte) []byte

func (*HMAC) Validate

func (h *HMAC) Validate(message, digest []byte) bool

Jump to

Keyboard shortcuts

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