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

Use assembly to hash instead of solidity

Summary Using assembly to hash instead of Solidity can potentially save gas in certain scenarios. Let's explore how and when this gas optimization can be beneficial.

In Solidity, hashing functions like keccak256 are implemented as built-in functions. However, they still incur gas costs due to the execution of the hashing algorithm in the EVM (Ethereum Virtual Machine).

By using assembly, you can directly call the EVM's native hashing opcode (e.g., SHA3) without the overhead of the Solidity function call. This can result in gas savings, especially when you need to perform hashing operations repeatedly or in complex scenarios.

Support

FAQs

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