10个版本
0.1.9 | 2024年4月6日 |
---|---|
0.1.8 | 2024年3月21日 |
0.1.6 | 2024年2月22日 |
在加密学中排名803
每月下载量85次
10KB
129 行
wecom-crypto
wecom-crypto
提供了企业微信API数据的加解密功能。其实现完全遵循官方文档中的规定。
使用方法
use wecom_crypto::{CryptoAgent, CryptoSource};
let key = "cGCVnNJRgRu6wDgo7gxG2diBovGnRQq1Tqy4Rm4V4qF";
let agent = CryptoAgent::new(key);
let source = CryptoSource {
text: "hello world!".to_string(),
receive_id: "wandering-ai".to_string(),
};
let enc = agent.encrypt(&source);
let dec = agent.decrypt(enc.as_str()).unwrap();
assert_eq!(source, dec);
lib.rs
:
wecom-crypto
wecom-crypto
提供了企业微信API数据的加解密功能。其实现完全遵循官方文档中的规定。
使用方法
use wecom_crypto::{Agent, Source};
let token = "a";
let key = "cGCVnNJRgRu6wDgo7gxG2diBovGnRQq1Tqy4Rm4V4qF";
let agent = Agent::new(token, key);
let source = Source {
text: "hello world!".to_string(),
receive_id: "wandering-ai".to_string(),
};
let enc = agent.encrypt(&source);
let dec = agent.decrypt(enc.as_str()).unwrap();
assert_eq!(source, dec);
依赖项
~1.4–2MB
~43K SLoC