Skip to content

Instantly share code, notes, and snippets.

View riordant's full-sized avatar
💯

tadhg riordant

💯
View GitHub Profile
@riordant
riordant / ModExp.sol
Last active November 15, 2018 13:24 — forked from lionello/ModExp.sol
Solidity wrapper for Ethereum Byzantium's BigInt `modexp` built-in contract 0x5
// Wrapper for built-in BigNumber_modexp (contract 0x5) as described here. https://github.com/ethereum/EIPs/pull/198
function modexp(bytes memory _base, bytes memory _exp, bytes memory _mod) internal view returns(bytes memory ret) {
assembly {
let bl := mload(_base)
let el := mload(_exp)
let ml := mload(_mod)