AES-CBC / AES-CTR / AES-GCM aligned with `crypto/cipher`. Bound to `aes.Cipher` (Xu has no cipher.Block interface). Bare CBC requires whole blocks; PKCS7 helpers pad/unpad. CTR is XOR of the AES keystream (big-endian counter). GCM: 96-bit nonce, 128-bit tag (seal_gcm / open_gcm). Throws on failure.
Parameters
src&string
source (borrowed; caller keeps it; type &string)
block_sizeint
block_size (int)
Returns
string — result string
unpad_pkcs7
XuAPI
pubfn unpad_pkcs7(src &string) string
Purpose
Unpad pkcs7. Throws on failure.
Parameters
src&string
source (borrowed; caller keeps it; type &string)
Returns
string — result string
encrypt_cbc
XuAPI
pubfn encrypt_cbc(c &aes.Cipher, iv &string, src &string) string
Purpose
Encrypt cbc. Throws on failure.
Parameters
c&aes.Cipher
byte or character code (borrowed; caller keeps it; type &aes.Cipher)
iv&string
int payload or initialization vector (borrowed; caller keeps it; type &string)
src&string
source (borrowed; caller keeps it; type &string)
Returns
string — result string
decrypt_cbc
XuAPI
pubfn decrypt_cbc(c &aes.Cipher, iv &string, src &string) string
Purpose
Decrypt cbc. Throws on failure.
Parameters
c&aes.Cipher
byte or character code (borrowed; caller keeps it; type &aes.Cipher)
iv&string
int payload or initialization vector (borrowed; caller keeps it; type &string)
src&string
source (borrowed; caller keeps it; type &string)
Returns
string — result string
encrypt_cbc_pkcs7
XuAPI
pubfn encrypt_cbc_pkcs7(c &aes.Cipher, iv &string, src &string) string
Purpose
Encrypt cbc pkcs7.
Parameters
c&aes.Cipher
byte or character code (borrowed; caller keeps it; type &aes.Cipher)
iv&string
int payload or initialization vector (borrowed; caller keeps it; type &string)
src&string
source (borrowed; caller keeps it; type &string)
Returns
string — result string
decrypt_cbc_pkcs7
XuAPI
pubfn decrypt_cbc_pkcs7(c &aes.Cipher, iv &string, src &string) string
Purpose
Decrypt cbc pkcs7.
Parameters
c&aes.Cipher
byte or character code (borrowed; caller keeps it; type &aes.Cipher)
iv&string
int payload or initialization vector (borrowed; caller keeps it; type &string)
src&string
source (borrowed; caller keeps it; type &string)
Returns
string — result string
encrypt_ctr
XuAPI
pubfn encrypt_ctr(c &aes.Cipher, iv &string, src &string) string
Purpose
Encrypt ctr.
Parameters
c&aes.Cipher
byte or character code (borrowed; caller keeps it; type &aes.Cipher)
iv&string
int payload or initialization vector (borrowed; caller keeps it; type &string)
src&string
source (borrowed; caller keeps it; type &string)
Returns
string — result string
decrypt_ctr
XuAPI
pubfn decrypt_ctr(c &aes.Cipher, iv &string, src &string) string
Purpose
Decrypt ctr.
Parameters
c&aes.Cipher
byte or character code (borrowed; caller keeps it; type &aes.Cipher)
iv&string
int payload or initialization vector (borrowed; caller keeps it; type &string)