rust kit
cache
You can use cache to store data and support multi-threaded sharing.
let cache = new;
cache.set;
let name = cache..unwrap;
println!;
code
- string to base58
use base58_encode;
let s = "hello world";
let res = base58_encode.unwrap;
println!;
- base58 to string
use ;
let s = "hello world";
let ss = base58_encode.unwrap;
let res = base58_decode.unwrap;
println!;
- string to base64
use base64_encode;
let s = "hello world";
let res = base64_encode.unwrap;
println!;
- base64 to string
use ;
let s = "hello world";
let ss = base64_encode.unwrap;
let res = base64_decode.unwrap;
println!;
lib
- fast_log
use ;
new.init_file.unwrap;
info!;
sleep;
- config
let mut config = new;
let settings = config.init.unwrap;
println!;
serde
- to_json
use *;
let aoo = Aoo ;
match to_json
- from_json
use *;
let s = r#"{"name":"ok","age":18, "date": "2024-08-15 11:00:16.100"}"#;
match
hash
- hash_256
use hash_256;
let res = hash_256;
println!;
- hash_512
use hash_512;
let res = hash_512;
println!;
crypto
- generate aes key
use *;
gen_rand_string;
- aes cbc 128
use *;
let key = gen_rand_string;
let key = key.as_bytes;
let des = encrypt_aes_cbc_128;
let res = decrypt_aes_cbc_128;
println!;
- aes cbc 256
use *;
let key = gen_rand_string;
let key = key.as_bytes;
let des = encrypt_aes_cbc_256;
let res = decrypt_aes_cbc_256;
println!;
- aes gcm 128
use *;
let key = aes_gcm_key_128;
let nonce = aes_gcm_nonce_128;
let des = encrypt_aes_gcm_128;
let res = decrypt_aes_gcm_128;
println!;
- aes gcm 256
use *;
let key = aes_gcm_key_256;
let nonce = aes_gcm_nonce_256;
let des = encrypt_aes_gcm_256;
let res = decrypt_aes_gcm_256;
println!;
- generate rsa pair
use *;
let res = generate_rsa_pair;
println!;
- rsa
use *;
let = generate_rsa_pair;
let src = "hello world";
let enc = encrypt_rsa_base.unwrap;
let res = decrypt_rsa_base.unwrap;
println!;
println!;