In Motoko I have a parent canister that holds the wasm for spinning up other canister actors. If I’m performing rolling upgrades of child canister actors, it’s very likely that at I may need to have multiple versions of a wasm in case a rolling upgrade attempt fails part-way through (and I need to roll back). I’d like to create a lookup table with a upgrade version and the wasm hash of that version.
How should I compute a hash of the wasm in Motoko? (the hash implementation should align with what is currently used by the IC when comparing canister install upgrades)
If this capability doesn’t yet exist in Motoko, what is the recommended way to hash a wasm in JavaScript?
If this hasn’t been done yet in JavaScript …how do I hash a wasm in Rust?
Ah ok great, so it’s just the sha256 hash of the wasm, with the wasm being an array of 8-bit unsigned integers. Should be easy enough and doable in Motoko with @quint’s GitHub - aviate-labs/crypto.mo: Crypto Package for Motoko library. Thanks for the Rust implmentation!