Skip to main content

x16rs_sys/
lib.rs

1#[link(name = "x16rs", kind = "static")]
2unsafe extern "C" {
3    unsafe fn c_x16rs_hash(a: i32, b: *const u8, c: *const u8) -> ();
4}
5
6
7
8pub const H32S: usize = 32;
9
10
11
12/*
13*
14*/
15pub fn x16rs_hash(loopnum: i32, indata: &[u8; H32S]) -> [u8; H32S] {
16
17    let outdata = [0u8; H32S];
18    
19    unsafe {
20        // input hash
21        let input: *const u8 = indata.as_ptr();
22        // output hash
23        let output: *const u8 = outdata.as_ptr();
24        // do call
25        c_x16rs_hash(loopnum, input, output);
26        // println!("{:?}", outdata);
27    }
28
29    return outdata;
30}