encryption

package
v0.0.0-...-db3cac9 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashMD5

func HashMD5(target string) (string, error)

HashMD5 hashes by MD5 message-digest algorithm

func HashSHA1

func HashSHA1(target string) (string, error)

HashSHA1 hashes by SHA1

func HashSHA256

func HashSHA256(target string) (string, error)

HashSHA256 hashes by SHA256

Types

type Crypt

type Crypt interface {
	Encrypt(src []byte) []byte
	Decrypt(src []byte) []byte
	EncryptBase64(plainText string) string
	DecryptBase64(base64String string) (string, error)
}

Crypt interface

func NewCrypt

func NewCrypt(key, iv string) (Crypt, error)

NewCrypt returns Crypt interface key size should be 16,24,32 iv size should be 16

func NewCryptWithEnv

func NewCryptWithEnv() (Crypt, error)

NewCryptWithEnv returns Crypt interface created by environment variable.

type Hasher

type Hasher interface {
	Hash(target string) string
}

Hasher interface

type MD5

type MD5 interface {
	Hash(target string) (string, error)
	HashWith(target, additional string) (string, error)
}

MD5 interface

func NewMD5

func NewMD5(salt1, salt2 string) MD5

NewMD5 returns MD5 interface

type Scrypt

type Scrypt interface {
	Hash(target string) string
}

Scrypt interface

func NewScrypt

func NewScrypt(salt string) Scrypt

NewScrypt returns Scrypt interface

Jump to

Keyboard shortcuts

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