Ruby port of https://github.com/Blockstream/contracthashtool