sm4

package
v0.0.0-...-c88c6a2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BlockSize = 16

block length and cipher key length are both of 128 bits

Variables

This section is empty.

Functions

This section is empty.

Types

type IterativeMode

type IterativeMode uint8
const (
	IterativeECB IterativeMode = iota
	IterativeCBC
)

type PaddingMode

type PaddingMode uint8
const (
	NoPadding PaddingMode = iota
	PaddingPKCS7
)

type SM4

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

func NewSM4

func NewSM4(opt ...Sm4Option) (*SM4, error)

func (*SM4) Decrypt

func (c *SM4) Decrypt(src []byte) ([]byte, error)

func (*SM4) Encrypt

func (c *SM4) Encrypt(src []byte) ([]byte, error)

type Sm4Option

type Sm4Option func(*sm4Options)

func WithIterCBC

func WithIterCBC(iv []byte) Sm4Option

func WithIterECB

func WithIterECB() Sm4Option

func WithKey

func WithKey(k []byte) Sm4Option

func WithNoPadding

func WithNoPadding() Sm4Option

func WithPKCS7Padding

func WithPKCS7Padding() Sm4Option

func WithSalt

func WithSalt(s []byte) Sm4Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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