I am looking to build a smart contract that enables a user to withdraw the contract funds via a one-time-password provided by the creator. My idea was to hash a password off-chain and store that through the constructor of the contract. To withdraw the funds, a user is then required to provide the password which is hashed on-chain and verified against the hash that was initially provided. Of course after a valid password would be provided, it would not be secret anymore. That however would not be an issue as its only intended to work one time.
From what I understood is that using keccak would run into frontrunning issues, but ECDSA might work. I have only very basic understanding of cryptography, so I wonder if thats true and - if so - why.
Long story short:
- Would using ECDSA solve the frontrunning issue?
- Are there any other/better approaches that I should consider?
Thank you so much!