Keccack hash function in Daml

We had a need for the keccak256 hash function in Daml, and as this is not supported within Daml, we decided to implement this in Daml ourselves. Please check out our open source codebase if you have any need for this functionality ā€“ https://github.com/SynfiniDLT/daml-keccak.

In future perhaps it might be better if there was a built-in function in Daml for this. Although Iā€™m not sure, I think the built-in sha256 algorithm is not actually written in Daml itself, but makes use of a lower level language to optimise for performance. Another issue we faced was that Daml does not have any built-in bit-level operators such as bitwise AND/XOR etc. (necessary for the keccak function). This made our implementation more complex and most likely less performant.

5 Likes