evmvdf icon indicating copy to clipboard operation
evmvdf copied to clipboard

Is it possible to use EIP-192 precompile?

Open k06a opened this issue 3 years ago • 3 comments

Is it possible to use EIP-192 precompiled smart contract to make verification even cheaper? https://github.com/ethereum/EIPs/blob/master/EIPS/eip-198.md

Rationale

This allows for efficient RSA verification inside of the EVM, as well as other forms of number theory-based cryptography. Note that adding precompiles for addition and subtraction is not required, as the in-EVM algorithm is efficient enough, and multiplication can be done through this precompile via a * b = ((a + b)**2 - (a - b)**2) / 4.

The bit-based exponent calculation is done specifically to fairly charge for the often-used exponents of 2 (for multiplication) and 3 and 65537 (for RSA verification).

k06a avatar May 03 '21 09:05 k06a

It is already in use for modular exponentiations see here and here

kilic avatar May 03 '21 11:05 kilic

@kilic I meant it could be used for mul2048()

k06a avatar May 03 '21 11:05 k06a

@kilic also you could try to use uint256[8] instead of bytes it is stored similar way but without length prefix.

k06a avatar May 03 '21 18:05 k06a