mirror of
https://github.com/creating2morrow/neveko.git
synced 2024-12-22 19:49:24 +00:00
remove unnecessary loop in hash_to_scalar
This commit is contained in:
parent
71b752e1e8
commit
0cf15df6d5
1 changed files with 1 additions and 8 deletions
|
@ -57,14 +57,7 @@ fn hash_to_scalar(s: Vec<&str>) -> Scalar {
|
||||||
hasher.update(&result);
|
hasher.update(&result);
|
||||||
let hash = hasher.finalize().to_owned();
|
let hash = hasher.finalize().to_owned();
|
||||||
let mut hash_container: [u8; 32] = [0u8; 32];
|
let mut hash_container: [u8; 32] = [0u8; 32];
|
||||||
let mut index = 0;
|
hex::decode_to_slice(result, &mut hash_container as &mut [u8]).unwrap_or_default();
|
||||||
for byte in result.as_bytes() {
|
|
||||||
if index == hash_container.len() - 1 {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
hash_container[index] = *byte;
|
|
||||||
index += 1;
|
|
||||||
}
|
|
||||||
let hash_value = BigInt::from_bytes_le(Sign::Plus, &hash_container);
|
let hash_value = BigInt::from_bytes_le(Sign::Plus, &hash_container);
|
||||||
if hash_value < curve_l_as_big_int() {
|
if hash_value < curve_l_as_big_int() {
|
||||||
return Scalar::from_bytes_mod_order(hash_container);
|
return Scalar::from_bytes_mod_order(hash_container);
|
||||||
|
|
Loading…
Reference in a new issue