encrypt

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hashid

func Hashid(id, minLength int, salt string) string

func HashidInt64

func HashidInt64(id int64, minLength int, salt string) string

func Md5Byte

func Md5Byte(in []byte, b ...byte) string

func Md5String

func Md5String(in string) string

func NewECBDecrypter

func NewECBDecrypter(self cipher.Block) cipher.BlockMode

NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.

func PKCS5Padding added in v0.7.1

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

func PKCS5UnPadding added in v0.7.1

func PKCS5UnPadding(origData []byte) []byte

func Unhashid

func Unhashid(hashedid string, minLength int, salt string) int

func UnhashidInt64

func UnhashidInt64(hashedid string, minLength int, salt string) int64

Types

type AesCbc added in v0.7.1

type AesCbc struct {
	Key string
	Iv  string
}

Work well with cryptojs

func (*AesCbc) Decrypt added in v0.7.1

func (self *AesCbc) Decrypt(src string) (string, error)

func (*AesCbc) Encrypt added in v0.7.1

func (self *AesCbc) Encrypt(src string) (string, error)

16 bytes - AES-128 24 bytes - AES-192 32 bytes - AES-256

func (*AesCbc) PKCS7Padding added in v0.7.2

func (a *AesCbc) PKCS7Padding(data []byte) []byte

func (*AesCbc) PKCS7UnPadding added in v0.7.2

func (a *AesCbc) PKCS7UnPadding(data []byte) []byte

type AesEcb added in v0.7.1

type AesEcb struct{}

func (*AesEcb) Decrypt added in v0.7.1

func (self *AesEcb) Decrypt(crypted, key []byte) ([]byte, error)

func (*AesEcb) Encrypt added in v0.7.1

func (self *AesEcb) Encrypt(src, key string) ([]byte, error)

type DesCbc added in v0.7.1

type DesCbc struct{}

func (*DesCbc) Decrypt added in v0.7.1

func (self *DesCbc) Decrypt(src, key, iv string) string

func (*DesCbc) Encrypt added in v0.7.1

func (self *DesCbc) Encrypt(src, key, iv string) string

type DesEcb added in v0.7.3

type DesEcb struct{}

func (*DesEcb) Decrypt added in v0.7.3

func (self *DesEcb) Decrypt(src, key string) string

func (*DesEcb) Encrypt added in v0.8.1

func (self *DesEcb) Encrypt(src, key string) string

type Ecb added in v0.7.1

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

Jump to

Keyboard shortcuts

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