sm4

package
v0.0.0-...-e28b223 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENC cryptMode = iota
	DEC
)
View Source
const BlockSize = 16

Variables

This section is empty.

Functions

func NewCipher

func NewCipher(key []byte) (cipher.Block, error)

func Sm4Cbc

func Sm4Cbc(key []byte, in []byte, mode cryptMode) (out []byte, err error)

sm4 cbc mode

func Sm4Ecb

func Sm4Ecb(key []byte, in []byte, mode cryptMode) (out []byte, err error)

sm4 ecb mode

Types

type KeySizeError

type KeySizeError int

func (KeySizeError) Error

func (k KeySizeError) Error() string

type Sm4Cipher

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

Cipher is an instance of SM4 encryption.

func (*Sm4Cipher) BlockSize

func (c *Sm4Cipher) BlockSize() int

func (*Sm4Cipher) Decrypt

func (c *Sm4Cipher) Decrypt(dst, src []byte)

func (*Sm4Cipher) Encrypt

func (c *Sm4Cipher) Encrypt(dst, src []byte)

Jump to

Keyboard shortcuts

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