const BLOCK_SIZE
XuAPI
pub const BLOCK_SIZE = 8用途
常量 BLOCK_SIZE,定义了相关的协议或算法配置参数。
#crypto/desDES / 3DES-EDE 单块。
const BLOCK_SIZEpub const BLOCK_SIZE = 8常量 BLOCK_SIZE,定义了相关的协议或算法配置参数。
struct Cipherpub struct Cipher {
pub subkeys []int
}Des 密码算法的分组或流式加解密上下文。
subkeys []intstruct TripleCipherpub struct TripleCipher {
pub k1 []int
pub k2 []int
pub k3 []int
}Des 密码算法的分组或流式加解密上下文。
k1 []intk2 []intk3 []intnew_cipherpub fn new_cipher(key &string) Cipher构造 cipher。失败时抛出错误,调用方需处理或继续传播。
key &stringCipher — 该类型的值
(&Cipher) block_sizepub fn (c &Cipher) block_size() int&Cipher 上的操作:块尺寸。
c &CipherCipher 实例;以只读借用传入,调用方仍持有实例。int — 该类型的值
(&Cipher) encryptpub fn (c &Cipher) encrypt(src &string) string&Cipher 上的操作:加密。
c &CipherCipher 实例;以只读借用传入,调用方仍持有实例。src &stringstring — 结果字符串
(&Cipher) decryptpub fn (c &Cipher) decrypt(src &string) string&Cipher 上的操作:解密。
c &CipherCipher 实例;以只读借用传入,调用方仍持有实例。src &stringstring — 结果字符串
new_triple_cipherpub fn new_triple_cipher(key &string) TripleCipher构造 triple cipher。失败时抛出错误,调用方需处理或继续传播。
key &stringTripleCipher — 该类型的值
(&TripleCipher) encryptpub fn (c &TripleCipher) encrypt(src &string) string&TripleCipher 上的操作:加密。失败时抛出错误,调用方需处理或继续传播。
c &TripleCipherTripleCipher 实例;以只读借用传入,调用方仍持有实例。src &stringstring — 结果字符串
(&TripleCipher) decryptpub fn (c &TripleCipher) decrypt(src &string) string&TripleCipher 上的操作:解密。失败时抛出错误,调用方需处理或继续传播。
c &TripleCipherTripleCipher 实例;以只读借用传入,调用方仍持有实例。src &stringstring — 结果字符串