dashcrypt

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package dashcrypt

加解密工具

Encryption and decryption tool

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesBs64Decrypt

func AesBs64Decrypt(cipherstr string, secret []byte) ([]byte, error)

AesBs64Decrypt @Editor robotyang at 2023

AesBs64Decrypt 带Base64编码的 CBC模式解密(先base64解码,再走底层方法 AesCbcEncrypt 解密);

@Param cipherstr:明文;

@Param secret:密钥,可以是16、24或32字节,用以选择AES-128、AES-192或AES-256

func AesBs64Encrypt

func AesBs64Encrypt(plaintext, secret []byte) (string, error)

AesBs64Encrypt @Editor robotyang at 2023

AesBs64Encrypt 带Base64编码的 CBC模式加密(先走底层方法 AesCbcEncrypt 加密,再base64编码);

@Param plaintext:明文;

@Param secret:密钥,可以是16、24或32字节,用以选择AES-128、AES-192或AES-256

func AesCbcDecrypt

func AesCbcDecrypt(ciphertext, secret []byte) ([]byte, error)

AesCbcDecrypt @Editor robotyang at 2023

AesCbcDecrypt CBC模式解密;

@Param ciphertext:密文;

@Param secret:密钥,可以是16、24或32字节,用以选择AES-128、AES-192或AES-256;

func AesCbcEncrypt

func AesCbcEncrypt(plaintext, secret []byte) ([]byte, error)

AesCbcEncrypt @Editor robotyang at 2023

AesCbcEncrypt CBC模式加密;

@Param plaintext:明文;

@Param secret:密钥,可以是16、24或32字节,用以选择AES-128、AES-192或AES-256;

func AesDecrypt

func AesDecrypt(cipherstr, secret string) (string, error)

AesDecrypt @Editor robotyang at 2023

AesDecrypt CBC模式解密(支持前后端,是 AesDecryptJsHex 的别名);

@Param cipherstr:密文(js的生成的密文后 进行了16进制的 hex.encoding,因此在调用该方法之前 go必须要进行 hex.DecodeString);

@Param secret:密钥;

func AesDecryptJs

func AesDecryptJs(ciphertext, secret []byte) ([]byte, error)

AesDecryptJs @Editor robotyang at 2023

AesDecryptJs CBC模式解密(支持前后端);

@Param ciphertext:密文(js的生成的密文后 进行了16进制的 hex.encoding,因此在调用该方法之前 go必须要进行 hex.DecodeString);

@Param secret:密钥;

@Reference https://mojotv.cn/go/crypto-js-with-golang

func AesDecryptJsHex

func AesDecryptJsHex(cipherstr, secret string) (string, error)

AesDecryptJsHex @Editor robotyang at 2023

AesDecryptJsHex CBC模式解密(支持前后端,先16进制解码,再走底层方法 AesDecryptJs 解密);

@Param cipherstr:密文(js的生成的密文后 进行了16进制的 hex.encoding,因此在调用该方法之前 go必须要进行 hex.DecodeString);

@Param secret:密钥;

@Reference https://mojotv.cn/go/crypto-js-with-golang

func AesEcbDecrypt

func AesEcbDecrypt(ciphertext []byte, secret []byte) ([]byte, error)

AesEcbDecrypt @Editor robotyang at 2023

AesEcbDecrypt ECB模式解密;

@Param ciphertext:密文;

@Param secret:密钥,可以是16、24或32字节,用以选择AES-128、AES-192或AES-256;

func AesEcbEncrypt

func AesEcbEncrypt(plaintext []byte, secret []byte) ([]byte, error)

AesEcbEncrypt @Editor robotyang at 2023

AesEcbEncrypt ECB模式加密;

@Param plaintext:明文

@Param secret:密钥,可以是16、24或32字节,用以选择AES-128、AES-192或AES-256;

func CheckSignFlatMap

func CheckSignFlatMap(data map[string]string, secret, inSign string) bool

CheckSignFlatMap @Editor robotyang at 2023

CheckSignFlatMap 检查参数签名

func FileDecryptByZyx

func FileDecryptByZyx(srcFilePath, dstFilePath string, secret []byte) (err error)

FileDecryptByZyx @Editor robotyang at 2023

FileDecryptByZyx 文件解密;

@Param srcFilePath:需解密的 文件路径;

@Param dstFilePath:解密后 文件路径;

@Param secret:密钥;

@Reference https://www.jianshu.com/p/0caab60fea9f

func FileEncryptByZyx

func FileEncryptByZyx(srcFilePath, dstFilePath string, secret []byte) (err error)

FileEncryptByZyx @Editor robotyang at 2023

FileEncryptByZyx 文件加密;

@Param srcFilePath:需加密的 文件路径;

@Param dstFilePath:加密后 文件路径;

@Param secret:密钥;

@Reference https://www.jianshu.com/p/0caab60fea9f

func SignFlatMap

func SignFlatMap(data map[string]string, secret string) string

SignFlatMap @Editor robotyang at 2023

SignFlatMap 根据参数计算签名

@Param data:仅支持 map[string]string / struct / url.Values

@Reference https://developers.weixin.qq.com/doc/offiaccount/Shake_Nearby/Shake_RedPack/Red_Packet_JSAPI.html

Types

This section is empty.

Jump to

Keyboard shortcuts

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