📰How It Works
Last updated
Last updated
ZKPass saves pwdhash
hash of the password in the contract. ENS is to bind a name
to an address, our ZKPass tries to bind pwdhash
to an address.
We will sign User actions with Keccak256 to produce datahash
. With expiration
, chainId
, an auto-incrementing nonce
and the datahash
, we will sign them again with Keccak256 to produce fullhash
. nonce
is used to avoid the multiple submission attempts.
In a ZK circuit,we use Poseidon algorithm to produce hash. The algorithm is chose as it requires a low gas fee.
The circuit is shown below.
The chart below shows the logic.
password
and address
are first combined to produce pwdhash
. With the use of address
, it guarantees the pwdhash
will be different even if the passwords are the same.
pwdhash
and fullhash
give us allhash
. It covers all the user actions we want to verify.
At last, proof
will show allhash
, pwdhash
and fullhash
are all generated via the circuit. Without know what password
is, we know that pwdhash
is produced by password
. As well as allhash
and fullhash
, we can be sure that only people knowing what the password
is produce the hashes and give the proof for them.
fullhash
as the output will prevent any unwanted modification.
Poseidon requires 254 bits input data, but Keccak256 consume 256 bits. We will
fullhash
right shift 3 bits.
ZKPass system only provide password change action for the user. We can verify the password with pwdhash
off chain. On chain, ZKPass can be used as signature verification. For example, in ZKSAFE contract, ZKSAFE will use user actions to produce datahash
. It will be passed to ZKPass for verification. After the user actions being verified, ZKSAFE knows whoever knows the password wants to perform these user actions.