You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sha256 and keccak256 precompile functions store the intermediate state of the hash rather than the final digest. To access this state, we need to interact with the state fields within the hasher struct. However, these fields are private, and there isn't a direct way to access them. We have four potential options:
Replicate the Struct and Transmute Memory: This is the riskiest approach, as it involves moving memory and can lead to undefined behavior.
Create a Raw Pointer and Cast it to a Replicated Struct: This method is safer than transmuting memory because it only reads the memory without altering it, but it still requires the use of unsafe blocks.
Fork the Repository: We could fork the repo and modify the necessary code to make the fields accessible, though this adds maintenance overhead.
Use Pre-Release Library Versions: The upcoming versions introduce a SerializableState trait, which provides safe access to the hash state. See here and here.
Currently we are doing number two see, but the idea is to move to the library once the stable release gets shipped.
The text was updated successfully, but these errors were encountered:
The
sha256
andkeccak256
precompile functions store the intermediate state of the hash rather than the final digest. To access this state, we need to interact with the state fields within the hasher struct. However, these fields are private, and there isn't a direct way to access them. We have four potential options:SerializableState
trait, which provides safe access to the hash state. See here and here.Currently we are doing number two see, but the idea is to move to the library once the stable release gets shipped.
The text was updated successfully, but these errors were encountered: