statsig-rust 0.19.1-beta.2604110309

Statsig Rust SDK for usage in multi-user server environments.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[must_use]
pub fn djb2(input: &str) -> String {
    djb2_number(input).to_string()
}

#[must_use]
pub fn djb2_number(input: &str) -> i64 {
    let mut hash: i64 = 0;

    for c in input.chars() {
        hash = ((hash << 5).wrapping_sub(hash)).wrapping_add(c as i64);
    }

    // Convert to unsigned 32-bit integer
    hash &= 0xFFFF_FFFF;

    hash
}