XU XUv0.8.8
EN

API

#crypto/zuc

import: #crypto/zuc

counts: 4 函数, 1 方法, 1 类型, 1 常量, 0 方法集

ZUC-128 与 128-EEA3/EIA3。零 C、非商密认证。

const key_size

XuAPI
pub const key_size = 16

用途

公开常量 `key_size`。 值为 `16`

参数

无

struct Cipher

XuAPI
pub struct Cipher {
    pub s []int
    pub r1 int
    pub r2 int
    pub x0 int
    pub x1 int
    pub x2 int
    pub x3 int
    pub s0 []int
    pub s1 []int
    pub hold int
    pub nleft int
}

用途

公开结构体 `Cipher`。

参数

s []int
源字符串
r1 int
字段(int)
r2 int
字段(int)
x0 int
字段(int)
x1 int
字段(int)
x2 int
字段(int)
x3 int
字段(int)
s0 []int
字段([]int)
s1 []int
字段([]int)
hold int
字段(int)
nleft int
字段(int)

new_cipher

XuAPI
pub fn new_cipher(key &string, iv &string) Cipher

用途

构造 cipher。失败时 throw。

参数

key &string
键(借用,调用方仍持有;类型 &string)
iv &string
整数载荷或初始向量(借用,调用方仍持有;类型 &string)

返回

Cipher — 该类型的值

(&mut Cipher) xor_key_stream

XuAPI
pub fn (c &mut Cipher) xor_key_stream(src &string) string

用途

`&mut Cipher` 上的方法:xor键流。

参数

c &mut Cipher
接收者 &mut Cipher(可变借用)
src &string
源数据(借用,调用方仍持有;类型 &string)

返回

string — 结果字符串

encrypt_eea3

XuAPI
pub fn encrypt_eea3(key &string, count int, bearer int, direction int, src &string, bit_len int) string

用途

加密eea3。失败时 throw。

参数

key &string
键(借用,调用方仍持有;类型 &string)
count int
count(int)
bearer int
bearer(int)
direction int
direction(int)
src &string
源数据(借用,调用方仍持有;类型 &string)
bit_len int
bit_len(int)

返回

string — 结果字符串

decrypt_eea3

XuAPI
pub fn decrypt_eea3(key &string, count int, bearer int, direction int, src &string, bit_len int) string

用途

解密eea3。失败时 throw。

参数

key &string
键(借用,调用方仍持有;类型 &string)
count int
count(int)
bearer int
bearer(int)
direction int
direction(int)
src &string
源数据(借用,调用方仍持有;类型 &string)
bit_len int
bit_len(int)

返回

string — 结果字符串

sum_eia3

XuAPI
pub fn sum_eia3(key &string, count int, bearer int, direction int, src &string, bit_len int) string

用途

摘要eia3。失败时 throw。

参数

key &string
键(借用,调用方仍持有;类型 &string)
count int
count(int)
bearer int
bearer(int)
direction int
direction(int)
src &string
源数据(借用,调用方仍持有;类型 &string)
bit_len int
bit_len(int)

返回

string — 结果字符串