cipher

package module
v0.0.0-...-5ec1f79 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: MIT Imports: 3 Imported by: 4

README

go-cipher

cipher interface for Go

Documentation

Index

Constants

View Source
const (
	// UnknownCipherType 未知加密
	UnknownCipherType = iota
	// SimpleCipherType 简单加密
	SimpleCipherType
	// AES128CipherType AES128加密
	AES128CipherType
)

Variables

View Source
var DefaultCipher func() Cipher

DefaultCipher 默认Cipher的构造方法

Functions

func ParseCipherType

func ParseCipherType(txt string) int

ParseCipherType 将字符串转化为加密类型

Types

type Cipher

type Cipher interface {
	Encrypt([]byte)
	Decrypt([]byte)
	SetKey(string) error
}

Cipher 加密器

type SimpleCipher

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

SimpleCipher 简单加密

func (*SimpleCipher) Decrypt

func (sc *SimpleCipher) Decrypt(data []byte)

Decrypt 解密

func (*SimpleCipher) Encrypt

func (sc *SimpleCipher) Encrypt(data []byte)

Encrypt 加密

func (*SimpleCipher) SetKey

func (sc *SimpleCipher) SetKey(key string) error

SetKey 设置密码

Jump to

Keyboard shortcuts

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