XU XUv0.8.8
中文

API

#hash/maphash

import: #hash/maphash

counts: 3 fns, 5 methods, 1 types, 0 consts, 0 ifaces

Portable byte hash with explicit seed (not hardware AES bits).

bytes

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

Purpose

Return the buffered bytes.

Parameters

seed int
random seed (int)
data &string
data (borrowed; caller keeps it; type &string)

Returns

int — a value of this type

of_string

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

Purpose

Of string.

Parameters

seed int
random seed (int)
s &string
source string (borrowed; caller keeps it; type &string)

Returns

int — a value of this type

struct Hash

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

Purpose

Public struct `Hash`.

Parameters

seed int
random seed
state int
field (int)
n int
count, length, or limit

new

XuAPI
pub fn new(seed int) Hash

Purpose

Construct a new value of this type.

Parameters

seed int
random seed (int)

Returns

Hash — a value of this type

(&mut Hash) set_seed

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

Purpose

Method on `&mut Hash`: set seed.

Parameters

h &mut Hash
receiver &mut Hash (exclusive borrow)
seed int
random seed (int)

(&mut Hash) reset

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

Purpose

Method on `&mut Hash`: clear internal state so the value can be reused.

Parameters

h &mut Hash
receiver &mut Hash (exclusive borrow)

(&mut Hash) write

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

Purpose

Method on `&mut Hash`: write data and return the byte count.

Parameters

h &mut Hash
receiver &mut Hash (exclusive borrow)
p &string
p (borrowed; caller keeps it; type &string)

Returns

int — bytes written

(Hash) sum64

XuAPI
pub fn (h Hash) sum64() int

Purpose

Method on `Hash`: compute a digest (often lowercase hex).

Parameters

h Hash
receiver Hash (value receiver)

Returns

int — a value of this type

(Hash) seed

XuAPI
pub fn (h Hash) seed() int

Purpose

Call `seed` on `Hash`.

Parameters

h Hash
receiver Hash (value receiver)

Returns

int — a value of this type