Documentation
¶
Index ¶
- Constants
- Variables
- func AESCBCDecrypt(cipherText, key, iv []byte) ([]byte, error)
- func AESCBCEncrypt(plainText, key, iv []byte) ([]byte, error)
- func AESCTRDecrypt(cipherText, key, iv []byte) ([]byte, error)
- func AESCTREncrypt(plainText, key, iv []byte) ([]byte, error)
- func AESGCMDecrypt(cipherText, key, nonce []byte, additional []byte) ([]byte, error)
- func AESGCMEncrypt(plainText, key, nonce []byte, additional []byte) ([]byte, error)
- func AesBase32Decrypt(cipherText string, key, iv []byte) ([]byte, error)
- func AesBase32Encrypt(plainText, key, iv []byte) (string, error)
- func Base16Decode(cipherText string) ([]byte, error)
- func Base16Encode(plainText []byte) (string, error)
- func Base62Decode(cipherText string) ([]byte, error)
- func Base62Encode(plainText []byte) (string, error)
- func Base85Decode(cipherText string) ([]byte, error)
- func Base85Encode(plainText []byte) (string, error)
- func BearDecode(cipherText string) []bytedeprecated
- func BearEncode(plainText []byte) stringdeprecated
- func BinToMac(shellcode []byte) string
- func BinToMacStrings(shellcode []byte) []string
- func BuddhaDecode(cipherText string) []bytedeprecated
- func BuddhaEncode(plainText []byte) stringdeprecated
- func ByteToIpv4Strings(shellcode []byte) ([]string, error)
- func ByteToIpv4StringsX(shellcode []byte) ([]string, error)
- func Chacha20Decrypt(data []byte, key []byte) ([]byte, error)
- func Chacha20Encrypt(data []byte, key []byte) ([]byte, error)
- func DESCBCDecrypt(cipherText, key, iv []byte) ([]byte, error)
- func DESCBCEncrypt(plainText, key, iv []byte) ([]byte, error)
- func DESCTRDecrypt(cipherText, key, iv []byte) ([]byte, error)
- func DESCTREncrypt(plainText, key, iv []byte) ([]byte, error)
- func Decrypt(data []byte, key []byte) []byte
- func EllipticCurveDecrypt(ciphertext []byte, privKey []byte) ([]byte, error)
- func EllipticCurveEncrypt(plaintext []byte, privKey []byte) ([]byte, error)
- func Encrypt(data []byte, key []byte) []byte
- func MorseDecode(input string) ([]byte, error)
- func MorseEncode(input string) (string, error)
- func PokemonDecode(encoded []string) []byte
- func PokemonEncode(data []byte) []string
- func Rc4Decrypt(ciphertext, key []byte) ([]byte, error)
- func Rc4Encrypt(plainText, key []byte) ([]byte, error)
- func RoarDecode(a string) string
- func RoarEncode(a string) string
- func Rot13(input string) string
- func Rot47(input string) string
- func SgnEncoder(file []byte, arch int) ([]byte, error)
- func Sha1(data []byte) []byte
- func Sha1Hex(data []byte) string
- func Sha256(data []byte) []byte
- func Sha256Hex(data []byte) string
- func Sm4Base64Decrypt(cipherText string, key, iv []byte) ([]byte, error)
- func Sm4Base64Encrypt(plainText, key, iv []byte) (string, error)
- func Sm4CbcDecrypt(cipherText, key, iv []byte) ([]byte, error)
- func Sm4CbcDecryptHex(cipherText string, key []byte, iv []byte) ([]byte, error)
- func Sm4CbcEncrypt(plainText, key, iv []byte) ([]byte, error)
- func Sm4CbcEncryptHex(plainText string, key []byte, iv []byte) ([]byte, error)
- func XOREncodeDecode(plainText, key []byte) ([]byte, error)
- func XorAesHexBase85Decrypt(cipherText string, key, iv []byte) ([]byte, error)
- func XorAesHexBase85Encrypt(plainText, key, iv []byte) (string, error)
- func XorBase32Decrypt(cipherText string, key []byte) ([]byte, error)
- func XorBase32Encrypt(plainText, key []byte) (string, error)
- func XorBase62Decrypt(cipherText string, key []byte) ([]byte, error)
- func XorBase62Encrypt(plainText, key []byte) (string, error)
- func XorBase64Decrypt(cipherText string, key []byte) ([]byte, error)
- func XorBase64Encrypt(plainText, key []byte) (string, error)
- func XorDesBase85Decrypt(cipherText string, key, iv []byte) ([]byte, error)
- func XorDesBase85Encrypt(plainText, key, iv []byte) (string, error)
- func XorRc4Base85Decrypt(cipherText string, key []byte) ([]byte, error)
- func XorRc4Base85Encrypt(plainText, key []byte) (string, error)
- func XorRc4HexBase85Decrypt(cipherText string, key []byte) ([]byte, error)
- func XorRc4HexBase85Encrypt(plainText, key []byte) (string, error)
- func XorSm4HexBase85Decrypt(cipherText string, key, iv []byte) ([]byte, error)
- func XorSm4HexBase85Encrypt(plainText, key, iv []byte) (string, error)
- type ConversionError
Constants ¶
const ( Origin = `http://hi.pcmoe.net` Referer = `http://hi.pcmoe.net/buddha.html` BuddhaAPI = `http://hi.pcmoe.net/bear.php` )
Variables ¶
var ( // ErrInvalidKeyLength 表示密钥长度不符合要求 ErrInvalidKeyLength = errors.New("KEY must be 16, 24, or 32 bytes long") // ErrInvalidIVLength 表示IV长度不符合要求 ErrInvalidIVLength = fmt.Errorf("IV must be %d bytes long", aes.BlockSize) // ErrInvalidNonceLength 表示nonce长度不符合要求 ErrInvalidNonceLength = errors.New("nonce must be 12 bytes long for GCM") )
预定义错误
var ( ErrKeyLength = errors.New("invalid key length (must be 8/16/24 for DES/2TDEA/3TDEA)") ErrIVLength = errors.New("invalid IV length (must be 8 bytes)") ErrBlockSize = errors.New("input not multiple of block size") ErrPadding = errors.New("invalid padding") )
var BuddhaHeader = map[string]string{ "Origin": Origin, "Referer": Referer, "X-Requested-With": "XMLHttpRequest", "X-Token": "203B61D35068", "Content-type": "application/x-www-form-urlencoded", }
Functions ¶
func AESCBCDecrypt ¶
AESCBCDecrypt 使用AES CBC模式对密文进行解密。 参数:
cipherText - 密文数据 key - 解密密钥(必须为16、24或32字节) iv - 初始化向量(必须为16字节)
返回值:
- 解密后的明文
- error: 错误信息
func AESCBCEncrypt ¶
AESCBCEncrypt 使用AES CBC模式对明文进行加密。 参数:
plainText - 明文数据 key - 加密密钥(必须为16、24或32字节) iv - 初始化向量(必须为16字节)
返回值:
- 加密后的密文
- error: 错误信息
func AESCTRDecrypt ¶
AESCTRDecrypt 使用AES CTR模式对密文进行解密。 CTR 模式无需填充,加密和解密使用相同的流生成器。 参数:
cipherText - 密文数据 key - 解密密钥(必须为16、24或32字节) iv - 初始化向量(必须为16字节)
返回值:
- 解密后的明文
- error: 错误信息
func AESCTREncrypt ¶
AESCTREncrypt 使用AES CTR模式对明文进行加密。 CTR 模式无需填充,加密和解密使用相同的流生成器。 参数:
plainText - 明文数据 key - 加密密钥(必须为16、24或32字节) iv - 初始化向量(必须为16字节)
返回值:
- 加密后的密文
- error: 错误信息
func AESGCMDecrypt ¶
AESGCMDecrypt 使用AES GCM模式对密文进行解密。 GCM 模式会验证认证标签,若验证失败则返回错误。 参数:
cipherText - 密文数据(包含认证标签) key - 解密密钥(必须为16、24或32字节) nonce - 随机数(通常为12字节) additional - 附加数据(必须与加密时一致,用于认证)
返回值:
- 解密后的明文
- error: 错误信息
func AESGCMEncrypt ¶
AESGCMEncrypt 使用AES GCM模式对明文进行加密。 GCM 模式提供认证加密(AEAD),加密结果包含认证标签。 参数:
plainText - 明文数据 key - 加密密钥(必须为16、24或32字节) nonce - 随机数(通常为12字节) additional - 附加数据(可选,用于认证,不影响加密内容)
返回值:
- 加密后的密文(包含认证标签)
- error: 错误信息
func AesBase32Encrypt ¶
func Base16Decode ¶
func Base16Encode ¶
func Base62Decode ¶
func Base62Encode ¶
func Base85Decode ¶
func Base85Encode ¶
func BearDecode
deprecated
func BearEncode
deprecated
func BinToMacStrings ¶
func BuddhaDecode
deprecated
func BuddhaEncode
deprecated
func ByteToIpv4Strings ¶
func ByteToIpv4StringsX ¶
func Chacha20Decrypt ¶
Chacha20Decrypt Decrypt data using given key (32 bytes)
func Chacha20Encrypt ¶
Chacha20Encrypt Encrypt data using given key (32 bytes)
func DESCBCDecrypt ¶
DESCBCDecrypt 使用DES/TDEA CBC模式进行解密
参数说明:
- cipherText: 密文数据
- key: 密钥(8/16/24字节分别对应DES/2TDEA/3TDEA)
- iv: 初始化向量(必须为8字节)
返回值:
- []byte: 解密后的明文
- error: 错误信息
func DESCBCEncrypt ¶
DESCBCEncrypt 使用DES/TDEA CBC模式进行加密
参数说明:
- plainText: 原始明文数据
- key: 密钥(8/16/24字节分别对应DES/2TDEA/3TDEA)
- iv: 初始化向量(必须为8字节)
返回值:
- []byte: 加密后的密文
- error: 错误信息
func DESCTRDecrypt ¶
DESCTRDecrypt 使用DES/TDEA CTR模式进行解密
参数说明:
- cipherText: 密文数据
- key: 密钥(8/16/24字节分别对应DES/2TDEA/3TDEA)
- iv: 初始化向量(必须为8字节)
返回值:
- []byte: 解密后的明文
- error: 错误信息
func DESCTREncrypt ¶
DESCTREncrypt 使用DES/TDEA CTR模式进行加密
参数说明:
- plainText: 原始明文数据
- key: 密钥(8/16/24字节分别对应DES/2TDEA/3TDEA)
- iv: 初始化向量(必须为8字节)
返回值:
- []byte: 加密后的密文
- error: 错误信息
func Decrypt ¶
Decrypt the data with the key. Data is the bytes to be decrypted. Key is the decrypted key. It is the same as the encrypted key.
func EllipticCurveDecrypt ¶
func EllipticCurveEncrypt ¶
func Encrypt ¶
Encrypt the data with key. Data is the bytes to be encrypted. Key is the encrypted key. It is the same as the decrypt key.
func MorseDecode ¶
func MorseEncode ¶
func PokemonDecode ¶
PokemonDecode 解码函数:将 []string 解码为 []byte
func PokemonEncode ¶
PokemonEncode 编码函数:将 []byte 编码为 []string
func Rc4Decrypt ¶
func Rc4Encrypt ¶
func SgnEncoder ¶
SgnEncoder 使用SGN对二进制文件进行编码
参数说明:
- file: 原始二进制数据
- arch: 种子值
返回值:
- []byte: 编码后的二进制数据
- error: 错误信息
func Sm4Base64Decrypt ¶
Sm4Base64Decrypt SM4解密要求Key和IV的长度为16
func Sm4Base64Encrypt ¶
Sm4Base64Encrypt SM4加密要求Key和IV的长度为16
func Sm4CbcDecrypt ¶
func Sm4CbcDecryptHex ¶
func Sm4CbcEncrypt ¶
func Sm4CbcEncryptHex ¶
func XOREncodeDecode ¶
func XorAesHexBase85Decrypt ¶
func XorAesHexBase85Encrypt ¶
func XorBase32Encrypt ¶
func XorBase62Encrypt ¶
func XorBase64Encrypt ¶
func XorDesBase85Decrypt ¶
XorDesBase85Decrypt Des加密要求Key和IV的长度为8
func XorDesBase85Encrypt ¶
XorDesBase85Encrypt Des加密要求Key和IV的长度为8
func XorRc4Base85Encrypt ¶
func XorRc4HexBase85Decrypt ¶
func XorRc4HexBase85Encrypt ¶
func XorSm4HexBase85Decrypt ¶
func XorSm4HexBase85Encrypt ¶
Types ¶
type ConversionError ¶
ConversionError 自定义错误类型(可选)
func (*ConversionError) Error ¶
func (e *ConversionError) Error() string
Source Files
¶
- Buddha.go
- aes.go
- aesbase32.go
- base16.go
- base62.go
- base85.go
- chacha20.go
- des.go
- elliptic_curve.go
- hash.go
- ipv4.go
- mac.go
- morse.go
- pokemon.go
- rc4.go
- roar.go
- rot13.go
- rot47.go
- sgn.go
- sm4.go
- sm4base64.go
- sm4hex.go
- xor.go
- xoraeshexbase85.go
- xorbase32.go
- xorbase62.go
- xorbase64.go
- xordesbase85.go
- xorrc4base85.go
- xorrc4hexbase85.go
- xorsm4hexbase85.go
- xxtea.go