XU XUv0.8.8
EN

API

#hash/maphash

import: #hash/maphash

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

显式 seed 的可移植字节哈希(非硬件 AES 位型)。

bytes

XuAPI
pub fn bytes(seed int, data &string) int

用途

返回已缓冲的字节串。

参数

seed int
随机种子(int)
data &string
数据(借用,调用方仍持有;类型 &string)

返回

int — 该类型的值

of_string

XuAPI
pub fn of_string(seed int, s &string) int

用途

of字符串。

参数

seed int
随机种子(int)
s &string
源字符串(借用,调用方仍持有;类型 &string)

返回

int — 该类型的值

struct Hash

XuAPI
pub struct Hash {
    pub seed int
    pub state int
    pub n int
}

用途

公开结构体 `Hash`。

参数

seed int
随机种子
state int
字段(int)
n int
数量、长度或上限

new

XuAPI
pub fn new(seed int) Hash

用途

构造该类型的新值。

参数

seed int
随机种子(int)

返回

Hash — 该类型的值

(&mut Hash) set_seed

XuAPI
pub fn (h &mut Hash) set_seed(seed int)

用途

`&mut Hash` 上的方法:设置 seed。

参数

h &mut Hash
接收者 &mut Hash(可变借用)
seed int
随机种子(int)

(&mut Hash) reset

XuAPI
pub fn (h &mut Hash) reset()

用途

`&mut Hash` 上的方法:清空内部状态,可再写入或读取。

参数

h &mut Hash
接收者 &mut Hash(可变借用)

(&mut Hash) write

XuAPI
pub fn (h &mut Hash) write(p &string) int

用途

`&mut Hash` 上的方法:写入数据,返回写入的字节数。

参数

h &mut Hash
接收者 &mut Hash(可变借用)
p &string
p(借用,调用方仍持有;类型 &string)

返回

int — 写入的字节数

(Hash) sum64

XuAPI
pub fn (h Hash) sum64() int

用途

`Hash` 上的方法:计算摘要(多为小写 hex)。

参数

h Hash
接收者 Hash(值接收者)

返回

int — 该类型的值

(Hash) seed

XuAPI
pub fn (h Hash) seed() int

用途

`Hash` 上的方法:种子。

参数

h Hash
接收者 Hash(值接收者)

返回

int — 该类型的值