mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-01-10 15:18:41 -05:00
17 lines
600 B
TypeScript
17 lines
600 B
TypeScript
import { BytesLike, Hexable } from "@ethersproject/bytes"
|
|
import { poseidon2 } from "poseidon-lite"
|
|
import hash from "./hash"
|
|
|
|
/**
|
|
* Given the identity nullifier and the external nullifier, it calculates nullifier hash.
|
|
* @param identityNullifier The identity nullifier.
|
|
* @param externalNullifier The external nullifier.
|
|
* @returns The nullifier hash.
|
|
*/
|
|
export default function calculateNullifierHash(
|
|
identityNullifier: number | bigint | string,
|
|
externalNullifier: BytesLike | Hexable | number | bigint
|
|
): bigint {
|
|
return poseidon2([hash(externalNullifier), identityNullifier])
|
|
}
|