20,000 USDC
View results
Submission Details
Severity: gas
Valid

Use assembly to hash instead of solidity

function solidityHash(uint256 a, uint256 b) public view {
//unoptimized
keccak256(abi.encodePacked(a, b));
}

Gas: 313

function assemblyHash(uint256 a, uint256 b) public view {
//optimized
assembly {
mstore(0x00, a)
mstore(0x20, b)
let hashedVal := keccak256(0x00, 0x40)
}
}

Gas: 231

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.