Hashing functions in Daml?
- LucianoOP 2
Do we have any built-in typeclasses or functions for calculating hashes from within Daml?
Something analogous to the built-in hash function every java object has?
(don’t ask why
) - cocreature 2
We don’t provide something generic for hashing values. What we do provide is
DA.Text.sha256which hashes aTextvalue. If you combine that withshow, you can hash other values but of course you are relying on theShowinstance doing something sensible. If it just omits certain parts of your values (e.g., because you have a function in your record), the hash will be garbage. It probably will also be fairly slow.In general, I would be very cautious with doing this type of stuff in DAML itself and try to push it to the client-side instead.
- bernhard 4
why??
- anthony 1
I think we’re witnessing the creation of a very elusive bug some time in the future