sm4

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const BlockSize = 16

Variables

Functions

func NewCipher

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

NewCipher creates and returns a new cipher.Block.

func SetIV

func SetIV(iv []byte) error

func Sm4CFB

func Sm4CFB(key []byte, in []byte, mode bool) (out []byte, err error)

密码反馈模式(Cipher FeedBack (CFB)) https://blog.csdn.net/zy_strive_2012/article/details/102520356 https://blog.csdn.net/sinat_23338865/article/details/72869841

func Sm4Cbc

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

func Sm4Ecb

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

func Sm4OFB

func Sm4OFB(key []byte, in []byte, mode bool) (out []byte, err error)

输出反馈模式(Output feedback, OFB) https://blog.csdn.net/chengqiuming/article/details/82390910 https://blog.csdn.net/sinat_23338865/article/details/72869841

Types

type SM4Key

type SM4Key []byte

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