17 lines
375 B
Rust
17 lines
375 B
Rust
use scrypt::{scrypt, Params};
|
|
|
|
use crate::num::Num;
|
|
|
|
const SALT: [u8; 0] = [];
|
|
|
|
pub fn hash(data: &[u8], out: &mut [u8]) {
|
|
let params = Params::new(6, 6, 1, 32).unwrap();
|
|
scrypt(data, &SALT.clone(), ¶ms, out).unwrap();
|
|
}
|
|
|
|
pub fn hash_num(num: Num) -> [u8; 32] {
|
|
let bnum = num.bytes();
|
|
let mut out: [u8; 32] = [0; 32];
|
|
hash(&bnum, &mut out);
|
|
out
|
|
} |