Reset password api

I want to update the existing password as it is using the reset password api. Is there a way to decode or hash the secret_data value stored in the db?
Or is there a way to pass the value itself as it is?