Skip to content

Commit

Permalink
Replaced divisions with inverse
Browse files Browse the repository at this point in the history
  • Loading branch information
vo-nil committed May 22, 2024
1 parent 247c36f commit 2d383ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/nil/crypto3/pubkey/ecdsa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ namespace nil {
r = scalar_field_value_type(scalar_modular_type(typename scalar_modular_type::backend_type(
static_cast<base_integral_type>((k * g1_value_type::one()).to_affine().X.data),
scalar_field_value_type::modulus)));
s = (privkey * r + encoded_m) / k;
s = (privkey * r + encoded_m) * k.inversed();
} while (r.is_zero() || s.is_zero());

return signature_type(r, s);
Expand Down
4 changes: 2 additions & 2 deletions include/nil/crypto3/pubkey/secret_sharing/shamir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ namespace nil {

for (auto j : indexes) {
if (j != i) {
result = result * (typename basic_policy::private_element_type(j) /
(typename basic_policy::private_element_type(j) - e_i));
result = result * (typename basic_policy::private_element_type(j) *
(typename basic_policy::private_element_type(j) - e_i).inversed());
}
}
return result;
Expand Down

0 comments on commit 2d383ca

Please sign in to comment.