cryptus

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cryptus

type Cryptus interface {
	RandomSixDigits() string
	GenerateNonce(size int) ([]byte, error)
	GenerateNonceString(size int) string
	Pbkdf2(plainText, salt string, extra ...KdfConfig) string
	Argon2(plainText, salt string, extra ...KdfConfig) string
	EncryptAes(plainText, secret, nonce string) (string, error)
	DecryptAes(cipherText, secret, nonce string) (string, error)
	EncryptChacha20(plainText, secret, nonce string) (string, error)
	DecryptChacha20(cipherText, secret, nonce string) (string, error)
	GenerateRsaKeyPair(size int) (string, string, error)
	EncryptRsa(plainText, publicKey string) (string, error)
	DecryptRsa(cipherText, privateKey string) (string, error)
	ParseRSAPublicKeyFromPEM(publicKeyPEM string) (*rsa.PublicKey, error)
	ParseRSAPrivateKeyFromPEM(privateKeyPEM string) (*rsa.PrivateKey, error)
	Sha256(value string) string
}

func New

func New() Cryptus

type KdfConfig

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

func NewKdfConfig

func NewKdfConfig(options ...KdfOption) KdfConfig

func (KdfConfig) Iterations

func (k KdfConfig) Iterations() int64

func (KdfConfig) Length

func (k KdfConfig) Length() int64

func (KdfConfig) Memory

func (k KdfConfig) Memory() int64

func (KdfConfig) Threads

func (k KdfConfig) Threads() int64

type KdfOption

type KdfOption func(*KdfConfig)

func WithIterations

func WithIterations(val int64) KdfOption

func WithLength

func WithLength(val int64) KdfOption

func WithMemory

func WithMemory(val int64) KdfOption

func WithThreads

func WithThreads(val int64) KdfOption

Jump to

Keyboard shortcuts

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