1 parent de5daf9 commit a731a51Copy full SHA for a731a51
1 file changed
shared/src/crypto/pedersen.ts
@@ -8,8 +8,17 @@ function groupOrder(): bigint {
8
return RISTRETTO_ORDER;
9
}
10
11
-const G = RistrettoPoint.hashToCurve(sha256(new TextEncoder().encode(DOMAIN_PREFIX + '-G')));
12
-const H = RistrettoPoint.hashToCurve(sha256(new TextEncoder().encode(DOMAIN_PREFIX + '-H')));
+function hashToRistrettoPoint(seed: string) {
+ const h1 = sha256(new TextEncoder().encode(seed));
13
+ const h2 = sha256(h1);
14
+ const combined = new Uint8Array(64);
15
+ combined.set(h1, 0);
16
+ combined.set(h2, 32);
17
+ return RistrettoPoint.hashToCurve(combined);
18
+}
19
+
20
+const G = hashToRistrettoPoint(DOMAIN_PREFIX + '-G');
21
+const H = hashToRistrettoPoint(DOMAIN_PREFIX + '-H');
22
23
export interface PedersenCommitment {
24
commitment: string;
0 commit comments