use blake3 to hash the passphrase
This commit is contained in:
@@ -29,6 +29,30 @@ pub extern fn litelib_wallet_exists(chain_name: *const c_char) -> bool {
|
||||
|
||||
println!("Wallet exists: {}", config.wallet_exists());
|
||||
config.wallet_exists()
|
||||
}
|
||||
|
||||
//////hash blake3
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn blake3_PW(pw: *const c_char) -> *mut c_char{
|
||||
|
||||
let passwd = unsafe {
|
||||
assert!(!pw.is_null());
|
||||
|
||||
CStr::from_ptr(pw).to_string_lossy().into_owned()
|
||||
};
|
||||
|
||||
let data = passwd.as_bytes();
|
||||
// Hash an input all at once.
|
||||
let hash1 = blake3::hash(data).to_hex();
|
||||
println!("\nBlake3 Hash: {}", hash1);
|
||||
|
||||
//let sttring = CString::new(hash1).unwrap();
|
||||
let e_str = CString::new(format!("{}", hash1)).unwrap();
|
||||
return e_str.into_raw();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Create a new wallet and return the seed for the newly created wallet.
|
||||
|
||||
Reference in New Issue
Block a user