zdpgo_password

package module
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 11 Imported by: 2

README

Golang加密解密框架

专用于加密解密的组件,以HASH和AES加密解密为主

版本历史

  • v0.1.0 2022/01/01
  • v0.1.1 2022/03/02 AES加密和RSA加密
  • v1.1.0 2022/04/01 ECC加密
  • v1.1.1 2022/04/01 移除第三方依赖
  • v1.1.2 2022/04/01 项目结构优化
  • v1.1.3 2022/04/07 日志组件升级
  • v1.1.4 2022/04/07 AES的GCM加密模式便捷方法
  • v1.1.5 2022/04/09 新增不使用Key的MD5加密和校验方法
  • v1.1.6 2022/04/01 新增URL编码和解码
  • v1.1.7 2022/04/01 新增HEX编码和解码
  • v1.1.8 2022/05/04 新增:文件加密解密
  • v1.1.9 2022/05/04 优化:文件加密解密
  • v1.2.0 2022/06/02 优化:ECC加密解密
  • v1.2.1 2022/06/06 新增:ECC支持指定公钥和私钥
  • v1.2.2 2022/06/06 新增:ECC支持获取公钥和私钥
  • v1.2.3 2022/06/06 优化:多个ECC对象支持共用公钥和私钥
  • v1.2.4 2022/06/11 新增:不使用base64编码的ECC加密方式
  • v1.2.5 2022/06/14 优化:日志创建方式优化
  • v1.2.6 2022/06/21 新增:密码生成器、密码文件生成和更新
  • v1.2.7 2022/06/21 新增:加密HTTP服务信息
  • v1.2.8 2022/06/21 新增:加密字节数组
  • v1.2.9 2022/06/28 优化:移除日志组件
  • v1.3.0 2022/07/08 优化:移除ECC、RSA、File加密解密
  • v1.3.1 2022/07/08 新增:hash相关的方法

使用示例

请查看 examples 目录

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMd5 added in v1.3.1

func CheckMd5(originStr, md5Str string) bool

CheckMd5 检查加密字符串是否正确 @param md5Str md5加密后的16进制字符串 @param originStr 要检查的加密前的数据 返回一个布尔值

func CheckMd5WithKey added in v1.3.1

func CheckMd5WithKey(key, originStr, md5Str string) bool

CheckMd5WithKey 使用指定key检查字符串是否和md5加密后的字符串相同 @param key 指定的加密key @param originStr 加密前字符串 @param md5Str 加密后字符串

func CheckSha1 added in v1.3.1

func CheckSha1(originStr, md5Str string) bool

func CheckSha1WithKey added in v1.3.1

func CheckSha1WithKey(key, originStr, sha1Str string) bool

func CheckSha256WithKey added in v1.3.1

func CheckSha256WithKey(key, originStr, sha1Str string) bool

func CheckSha512WithKey added in v1.3.1

func CheckSha512WithKey(key, originStr, sha1Str string) bool

func Exists added in v1.2.0

func Exists(path string) bool

Exists 判断所给路径文件/文件夹是否存在

func GetMd5 added in v1.3.1

func GetMd5(text string) string

GetMd5 获取一个文本的md5值

func GetMd5WithKey added in v1.3.1

func GetMd5WithKey(key, data string) string

GetMd5WithKey 使用指定key获取一个文本的md5值

func GetSha1 added in v1.3.1

func GetSha1(text string) string

func GetSha1WithKey added in v1.3.1

func GetSha1WithKey(key, data string) string

func GetSha256WithKey added in v1.3.1

func GetSha256WithKey(key, data string) string

func GetSha512WithKey added in v1.3.1

func GetSha512WithKey(key, data string) string

Types

type Config added in v1.2.0

type Config struct {
	Aes     aes.AesConfig   `yaml:"aes" json:"aes"`   // AES加密核心配置
	Hash    hash.HashConfig `yaml:"hash" json:"hash"` // HASH加密核心配置
	KeyPath string          `yaml:"key_path" json:"key_path"`
}

Config 密码配置对象

type HttpServerInfo added in v1.2.7

type HttpServerInfo struct {
	Host     string                 `json:"host"`
	Port     int                    `json:"port"`
	Username string                 `json:"username"`
	Password string                 `json:"password"`
	Email    string                 `json:"email"`
	Role     int                    `json:"role"`
	IsSsl    bool                   `json:"is_ssl"`
	Data     map[string]interface{} `json:"data"`
}

HttpServerInfo HTTP服务信息

type Password added in v1.1.2

type Password struct {
	Config   *Config           // 配置对象
	Aes      *aes.Aes          // AES加密核心对象
	Hash     *hash.Hash        // HASH加密核心对象
	Url      *zurl.Url         // URL编码解码核心对象
	Hex      *hex.Hex          // 十六进制编码解码
	BytesMap map[string][]byte // 用于存放bytes数组的字典
}

Password 密码加密核心对象

func New

func New() *Password

func NewWithConfig added in v1.2.3

func NewWithConfig(config *Config) *Password

NewWithConfig 创建加密对象

Directories

Path Synopsis
examples
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.

Jump to

Keyboard shortcuts

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