- Notifications
You must be signed in to change notification settings - Fork0
Pack data tightly together and save space.
License
exp-table/hyena
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A data packing library.
Hyena is a library that is an alternative toabi.encode
andabi.encodePacked
that can result in smallerbytes
.
ItWON'T beatabi.encode
orabi.encodePacked
in terms of gas consumption but will in the size of the output. A reduction of up to 50% can be obtained.
It serves as educational material.
Warning
Due to how the internal "map" works, you can only pack 41 32-bytes values.
It should be noted that unpacking the payload produces an array whose elements order is in reverse w.r.t the elements that were added.
To install withFoundry:
forge install exp-table/hyena
bytesmemorypayload=Hyena.init();payload=Hyena.crush(payload,uint(100));payload=Hyena.crush(payload,uint(2**256-1));uint256[]memoryoutputs=Hyena.digest(payload);
These smart contracts are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the user interface or the smart contracts. They have not been audited and as such there can be no assurance they will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk.
SeeLICENSE for more details.