algorithm

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PBEAlgorithm

type PBEAlgorithm interface {
	// Name 返回算法名称
	Name() string

	// KeySize 返回密钥大小(字节)
	KeySize() int

	// BlockSize 返回块大小(字节)
	BlockSize() int

	// IVSize 返回IV大小(字节)
	IVSize() int

	// RequiresIV 是否需要IV
	RequiresIV() bool

	// GenerateKey 生成密钥
	GenerateKey(password, salt []byte, iterations int) ([]byte, error)

	// CreateEncryptor 创建加密器
	CreateEncryptor(key []byte) (cipher.Block, error)

	// CreateDecryptor 创建解密器
	CreateDecryptor(key []byte) (cipher.Block, error)

	// CreateEncryptMode 创建加密模式
	CreateEncryptMode(block cipher.Block, iv []byte) cipher.BlockMode

	// CreateDecryptMode 创建解密模式
	CreateDecryptMode(block cipher.Block, iv []byte) cipher.BlockMode
}

PBEAlgorithm PBE算法接口

type PBEWithHMACSHA256AndAES256

type PBEWithHMACSHA256AndAES256 struct{}

PBEWithHMACSHA256AndAES256 实现PBEWithHMACSHA256AndAES_256算法

func (*PBEWithHMACSHA256AndAES256) BlockSize

func (a *PBEWithHMACSHA256AndAES256) BlockSize() int

func (*PBEWithHMACSHA256AndAES256) CreateDecryptMode

func (a *PBEWithHMACSHA256AndAES256) CreateDecryptMode(block cipher.Block, iv []byte) cipher.BlockMode

func (*PBEWithHMACSHA256AndAES256) CreateDecryptor

func (a *PBEWithHMACSHA256AndAES256) CreateDecryptor(key []byte) (cipher.Block, error)

func (*PBEWithHMACSHA256AndAES256) CreateEncryptMode

func (a *PBEWithHMACSHA256AndAES256) CreateEncryptMode(block cipher.Block, iv []byte) cipher.BlockMode

func (*PBEWithHMACSHA256AndAES256) CreateEncryptor

func (a *PBEWithHMACSHA256AndAES256) CreateEncryptor(key []byte) (cipher.Block, error)

func (*PBEWithHMACSHA256AndAES256) GenerateKey

func (a *PBEWithHMACSHA256AndAES256) GenerateKey(password, salt []byte, iterations int) ([]byte, error)

func (*PBEWithHMACSHA256AndAES256) IVSize

func (a *PBEWithHMACSHA256AndAES256) IVSize() int

func (*PBEWithHMACSHA256AndAES256) KeySize

func (a *PBEWithHMACSHA256AndAES256) KeySize() int

func (*PBEWithHMACSHA256AndAES256) Name

func (*PBEWithHMACSHA256AndAES256) RequiresIV

func (a *PBEWithHMACSHA256AndAES256) RequiresIV() bool

type PBEWithMD5AndDES

type PBEWithMD5AndDES struct{}

PBEWithMD5AndDES 实现PBEWithMD5AndDES算法

func (*PBEWithMD5AndDES) BlockSize

func (a *PBEWithMD5AndDES) BlockSize() int

func (*PBEWithMD5AndDES) CreateDecryptMode

func (a *PBEWithMD5AndDES) CreateDecryptMode(block cipher.Block, iv []byte) cipher.BlockMode

func (*PBEWithMD5AndDES) CreateDecryptor

func (a *PBEWithMD5AndDES) CreateDecryptor(key []byte) (cipher.Block, error)

func (*PBEWithMD5AndDES) CreateEncryptMode

func (a *PBEWithMD5AndDES) CreateEncryptMode(block cipher.Block, iv []byte) cipher.BlockMode

func (*PBEWithMD5AndDES) CreateEncryptor

func (a *PBEWithMD5AndDES) CreateEncryptor(key []byte) (cipher.Block, error)

func (*PBEWithMD5AndDES) GenerateKey

func (a *PBEWithMD5AndDES) GenerateKey(password, salt []byte, iterations int) ([]byte, error)

func (*PBEWithMD5AndDES) IVSize

func (a *PBEWithMD5AndDES) IVSize() int

func (*PBEWithMD5AndDES) KeySize

func (a *PBEWithMD5AndDES) KeySize() int

func (*PBEWithMD5AndDES) Name

func (a *PBEWithMD5AndDES) Name() string

func (*PBEWithMD5AndDES) RequiresIV

func (a *PBEWithMD5AndDES) RequiresIV() bool

type PBEWithSHA1AndDESede

type PBEWithSHA1AndDESede struct{}

PBEWithSHA1AndDESede 实现PBEWithSHA1AndDESede算法(Triple DES)

func (*PBEWithSHA1AndDESede) BlockSize

func (a *PBEWithSHA1AndDESede) BlockSize() int

func (*PBEWithSHA1AndDESede) CreateDecryptMode

func (a *PBEWithSHA1AndDESede) CreateDecryptMode(block cipher.Block, iv []byte) cipher.BlockMode

func (*PBEWithSHA1AndDESede) CreateDecryptor

func (a *PBEWithSHA1AndDESede) CreateDecryptor(key []byte) (cipher.Block, error)

func (*PBEWithSHA1AndDESede) CreateEncryptMode

func (a *PBEWithSHA1AndDESede) CreateEncryptMode(block cipher.Block, iv []byte) cipher.BlockMode

func (*PBEWithSHA1AndDESede) CreateEncryptor

func (a *PBEWithSHA1AndDESede) CreateEncryptor(key []byte) (cipher.Block, error)

func (*PBEWithSHA1AndDESede) GenerateKey

func (a *PBEWithSHA1AndDESede) GenerateKey(password, salt []byte, iterations int) ([]byte, error)

func (*PBEWithSHA1AndDESede) IVSize

func (a *PBEWithSHA1AndDESede) IVSize() int

func (*PBEWithSHA1AndDESede) KeySize

func (a *PBEWithSHA1AndDESede) KeySize() int

func (*PBEWithSHA1AndDESede) Name

func (a *PBEWithSHA1AndDESede) Name() string

func (*PBEWithSHA1AndDESede) RequiresIV

func (a *PBEWithSHA1AndDESede) RequiresIV() bool

Jump to

Keyboard shortcuts

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