Skip to content

Instantly share code, notes, and snippets.

@nakajo2011
Created March 16, 2021 10:26
Show Gist options
  • Save nakajo2011/8674742a617d319fb7a5781ca143c5e5 to your computer and use it in GitHub Desktop.
Save nakajo2011/8674742a617d319fb7a5781ca143c5e5 to your computer and use it in GitHub Desktop.
ModExp sample on Solidity
pragma solidity ^0.8.1;
contract ModExpContracts {
address public constant modExpAddress = 0x0000000000000000000000000000000000000005;
bytes public _result;
function modExp(
uint baseLength,
uint expLength,
uint modLength,
bytes calldata _base,
bytes calldata exp,
bytes calldata modulus)
public
{
(bool _success, bytes memory result) = modExpAddress.call(
abi.encodePacked(baseLength, expLength, modLength, _base, exp, modulus));
_result = result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment