Add P256 and RSA documentation sections (#5227)

pull/5228/head
Eric Lau 4 months ago committed by GitHub
parent cc67e0eb83
commit f6db28630c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      contracts/utils/README.adoc
  2. 8
      contracts/utils/cryptography/P256.sol

@ -58,6 +58,10 @@ Because Solidity does not support generic types, {EnumerableMap} and {Enumerable
{{ECDSA}} {{ECDSA}}
{{P256}}
{{RSA}}
{{EIP712}} {{EIP712}}
{{MessageHashUtils}} {{MessageHashUtils}}

@ -242,10 +242,10 @@ library P256 {
* @dev Compute G·u1 + P·u2 using the precomputed points for G and P (see {_preComputeJacobianPoints}). * @dev Compute G·u1 + P·u2 using the precomputed points for G and P (see {_preComputeJacobianPoints}).
* *
* Uses Strauss Shamir trick for EC multiplication * Uses Strauss Shamir trick for EC multiplication
* https://stackoverflow.com/questions/50993471/ec-scalar-multiplication-with-strauss-shamir-method * https://stackoverflow.com/questions/50993471/ec-scalar-multiplication-with-strauss-shamir-method.
* we optimise on this a bit to do with 2 bits at a time rather than a single bit * We optimise on this a bit to do with 2 bits at a time rather than a single bit.
* the individual points for a single pass are precomputed * The individual points for a single pass are precomputed.
* overall this reduces the number of additions while keeping the same number of doublings * Overall this reduces the number of additions while keeping the same number of doublings.
*/ */
function _jMultShamir(JPoint[16] memory points, uint256 u1, uint256 u2) private view returns (uint256, uint256) { function _jMultShamir(JPoint[16] memory points, uint256 u1, uint256 u2) private view returns (uint256, uint256) {
uint256 x = 0; uint256 x = 0;

Loading…
Cancel
Save