
Security News
AI Agent Submits PR to Matplotlib, Publishes Angry Blog Post After Rejection
After Matplotlib rejected an AI-written PR, the agent fired back with a blog post, igniting debate over AI contributions and maintainer burden.
go-cryptobin 是 go 的常用加密解密库
中文 | English
Aes, ECB, NoPaddinggo get -u github.com/deatil/go-cryptobin
package main
import (
"fmt"
"github.com/deatil/go-cryptobin/cryptobin/crypto"
)
func main() {
// 加密
cypt := crypto.
FromString("useData").
SetKey("dfertf12dfertf12").
Aes().
ECB().
PKCS7Padding().
Encrypt().
ToBase64String()
// 解密
cyptde := crypto.
FromBase64String("i3FhtTp5v6aPJx0wTbarwg==").
SetKey("dfertf12dfertf12").
Aes().
ECB().
PKCS7Padding().
Decrypt().
ToString()
// i3FhtTp5v6aPJx0wTbarwg==
fmt.Println("加密结果:", cypt)
fmt.Println("解密结果:", cyptde)
}
Aes, ECB, NoPadding// 加密数据
cypt := crypto.
FromString("useData").
SetKey("dfertf12dfertf12").
Encrypt().
ToBase64String()
// 解密数据
cyptde := crypto.
FromBase64String("i3FhtTp5v6aPJx0wTbarwg==").
SetKey("dfertf12dfertf12").
Decrypt().
ToString()
// 使用代码
// 注意: 设置密码,加密类型,加密模式,补码方式 在 操作类型 之前, 可以调换顺序
ret := crypto.
FromString("string"). // 数据来源, 待加密数据/待解密数据
SetKey("key"). // 设置密码
SetIv("iv_string"). // 设置向量
Aes(). // 加密类型
CBC(). // 加密模式
PKCS7Padding(). // 补码方式
Encrypt(). // 操作类型, 加密或者解密
ToBase64String() // 返回结果数据类型
数据来源:
FromBytes(data []byte), FromString(data string), FromBase64String(data string), FromHexString(data string)
设置密码:
SetKey(data string), WithKey(key []byte)
设置向量:
SetIv(data string), WithIv(iv []byte)
加密类型:
Aes(), Des(), TripleDes(), Twofish(), Blowfish(), Tea(rounds ...int), Xtea(), Cast5(), RC4(), Idea(), SM4(), Chacha20(nonce string, counter ...uint32), Chacha20poly1305(nonce string, additional string), Xts(cipher string, sectorNum uint64)
加密模式:
ECB(), CBC(), PCBC(), CFB(), OFB(), CTR(), GCM(nonce string, additional ...string), CCM(nonce string, additional ...string)
补码方式:
NoPadding(), ZeroPadding(), PKCS5Padding(), PKCS7Padding(), X923Padding(), ISO10126Padding(), ISO7816_4Padding(),ISO97971Padding(),PBOC2Padding(), TBCPadding(), PKCS1Padding(bt ...string)
操作类型:
Encrypt(), Decrypt(), FuncEncrypt(f func(Cryptobin) Cryptobin), FuncDecrypt(f func(Cryptobin) Cryptobin)
返回数据类型:
ToBytes(), ToString(), ToBase64String(), ToHexString()
更多信息可以查看 文档
Apache2 开源协议发布,在保留本软件包版权的情况下提供个人及商业免费使用。FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
After Matplotlib rejected an AI-written PR, the agent fired back with a blog post, igniting debate over AI contributions and maintainer burden.

Security News
HashiCorp disclosed a high-severity RCE in next-mdx-remote affecting versions 4.3.0 to 5.x when compiling untrusted MDX on the server.

Security News
Security researchers report widespread abuse of OpenClaw skills to deliver info-stealing malware, exposing a new supply chain risk as agent ecosystems scale.