encrypt

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 16 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HmacSHA1

func HmacSHA1(msg string, key string) (string, error)

func HmacSHA256

func HmacSHA256(msg string, key string) (string, error)

func ISO10126Padding added in v0.0.4

func ISO10126Padding()

ISO10126填充 原理:如果明文块少于 blockSize 个字节(按16字节分组即128bit,一般按秘钥字节数位分组步长),在明文块末尾补足相应数量的字节,最后一个字符值等于缺少的字符数,其他字符填充随机数。

func ISO10126Unpadding added in v0.0.4

func ISO10126Unpadding()

ISO10126解填充

func MD5

func MD5(msg string) (string, error)

func NewAES added in v0.0.4

func NewAES() *aseHelper

func NewRSA

func NewRSA() *rsaHelper

func PKCS5Padding added in v0.0.4

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

PKCS5Padding 原理:如果明文块少于 blockSize 个字节(按16字节分组即128bit,一般按秘钥字节数位分组步长),在明文块末尾补足相应数量的字符,且每个字节的值等于缺少的字符数。 @param []byte ciphertext @param int blockSize

@return []byte

func PKCS5Unpadding added in v0.0.4

func PKCS5Unpadding(origData []byte) []byte

PKCS5Unpadding

@param []byte origData

@return []byte

func SHA1

func SHA1(msg string) (string, error)

Types

type Mode added in v0.0.4

type Mode uint8
const (
	CBC Mode = 1 + iota
	ECB
	CFB
	OFB
	CTR
)

Jump to

Keyboard shortcuts

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