Let's say that I want to generate a key such that a user can use it and at the same time save the hashed key on the blockchain. My idea was to use a smart contract that could implement the Diffie-Hellman encryption. In this way the recipient would have the original key and the smart contract could calculate the hash of the key and store it. Is this a viable solution? What are other ways to achieve this?