const block_size
XuAPI
pub const block_size = 16用途
公开常量 `block_size`。 值为 `16`
参数
无
API
#crypto/aesAES-128/192/256 单块。CBC/CTR/GCM 见 crypto/cipher。
const block_sizepub const block_size = 16公开常量 `block_size`。 值为 `16`
无
struct Cipherpub struct Cipher {
pub nr int
pub rk []int
pub sbox []int
pub inv []int
pub te []int
pub td []int
pub erk []int
pub drk []int
pub hw_accel bool
pub rk_bytes string
pub drk_bytes string
}公开结构体 `Cipher`。
nr intrk []intsbox []intinv []intte []inttd []interk []intdrk []inthw_accel boolrk_bytes stringdrk_bytes stringnew_cipherpub fn new_cipher(key &string) Cipher构造 cipher。失败时 throw。
key &stringCipher — 该类型的值
(&Cipher) block_sizepub fn (c &Cipher) block_size() int`&Cipher` 上的方法:块尺寸。
c &Cipherint — 该类型的值
(&Cipher) encryptpub fn (c &Cipher) encrypt(src &string) string`&Cipher` 上的方法:加密。失败时 throw。
c &Ciphersrc &stringstring — 结果字符串
(&Cipher) encrypt_blockpub fn (c &Cipher) encrypt_block(dst &mut []int, src &[]int) bool`&Cipher` 上的方法:加密块。失败时 throw。
c &Cipherdst &mut []intsrc &[]intbool — 是否成立
(&Cipher) decryptpub fn (c &Cipher) decrypt(src &string) string`&Cipher` 上的方法:解密。失败时 throw。
c &Ciphersrc &stringstring — 结果字符串
(&Cipher) decrypt_blockpub fn (c &Cipher) decrypt_block(dst &mut []int, src &[]int) bool`&Cipher` 上的方法:解密块。失败时 throw。
c &Cipherdst &mut []intsrc &[]intbool — 是否成立