Im trying to implement a simple hashlock contract where I initially commit a sha256 hash of a password string and an address of the target receiver.
The contract compiles and tests work (since for tests I am using the smartpy hashing procedures). But once I deploy, I can't seem to get the reveal to work since the password string that I am passing does not result in the same hash.
How should I generate my initial hash of the string so that once the actual string is passed, the contract computes same hash?
So far I am using just a generic sha256 online generator. But I feel like smartpy sp.sha256(sp.pack())
procedure results in something I am unable to replicate outside.
What am i doing wrong? Is the issue in encoding of the sha256? What encoding does smartpy use? Can I specify what it uses? Code itself is here: Link
For example, I am trying to replicate the sp.pack("password")
When i convert a string "password" into hex
I get 70617373776f7264
But when I pass 70617373776f7264 into sha256 generator, I don't get the same hash as sp.sha256(sp.pack("password"))
So could someone clarify the correct procedure to replicate the steps?