Skip to content

Commit cce015b

Browse files
committed
add audited blake hash. Fix esm for node
1 parent dacdfd6 commit cce015b

File tree

14 files changed

+2255
-2270
lines changed

14 files changed

+2255
-2270
lines changed

config/tsconfig.esm.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

index.html

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
4-
<head>
5-
<meta charset="UTF-8">
6-
<meta http-equiv="X-UA-Compatible"
7-
content="IE=edge">
8-
<meta name="viewport"
9-
content="width=device-width, initial-scale=1.0">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
107
<script src="./dist/browser/umd/index.js"></script>
118
<title>Test</title>
12-
</head>
9+
</head>
1310

14-
<body>
11+
<body>
1512
Test browser
16-
</body>
17-
<script>
18-
// Function to convert hex to base64
19-
function base64FromHex(hex) {
20-
hex = hex.replace(/^0x/, '');
21-
hex = hex.length % 2 != 0 ? '0' + hex : hex;
22-
const buffer = new Uint8Array(hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
23-
return btoa(String.fromCharCode(...buffer));
24-
}
25-
26-
const { poseidon, PrivateKey, Signature, utils, ffUtils, Hex } = IdenJsCrypto;
13+
</body>
14+
<script>
15+
const { PrivateKey, Signature, utils, ffUtils, Hex } = IdenJsCrypto;
2716
const msgBuf = Hex.decodeString('000102030405060708090000');
2817
const msg = ffUtils.leBuff2int(msgBuf);
2918

30-
const skBuff = Hex.decodeString('0001020304050607080900010203040506070809000102030405060708090001');
19+
const skBuff = Hex.decodeString(
20+
'0001020304050607080900010203040506070809000102030405060708090001'
21+
);
3122

3223
const privateKey = new PrivateKey(skBuff);
3324

@@ -38,12 +29,10 @@
3829

3930
const signature = privateKey.signPoseidon(msg);
4031

41-
4232
const pSignature = signature.compress();
4333

4434
const uSignature = Signature.newFromCompressed(pSignature);
4535

4636
console.assert(pubKey.verifyPoseidon(msg, uSignature));
47-
</script>
48-
37+
</script>
4938
</html>

0 commit comments

Comments
 (0)