@superinstance/canary-hash 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +6 -6
  2. package/package.json +1 -1
  3. package/test.js +3 -4
package/index.js CHANGED
@@ -18,19 +18,19 @@ function fnv1a64(s) {
18
18
  return h;
19
19
  }
20
20
 
21
- // The fleet canary: 0x024a555471370b18d (decimal 2,640,610,520,279,855,501)
22
- const EXPECTED = 0x024a555471370b18dn;
23
- const s = "café Δ 日本語";
21
+ const EXPECTED_HEX = "0x024a555471370b18d";
22
+ const EXPECTED = BigInt(EXPECTED_HEX);
23
+ const CANARY_STRING = "café Δ 日本語";
24
24
 
25
- module.exports = { fnv1a64, EXPECTED, canaryString: s };
25
+ module.exports = { fnv1a64, EXPECTED, EXPECTED_HEX, CANARY_STRING };
26
26
 
27
27
  if (require.main === module) {
28
- const h = fnv1a64(s);
28
+ const h = fnv1a64(CANARY_STRING);
29
29
  console.log(`0x${h.toString(16).padStart(16, '0')}`);
30
30
  if (h === EXPECTED) {
31
31
  console.log("✓ Fleet canary verified: 0x024a555471370b18d");
32
32
  } else {
33
- console.error(`✗ FAIL: expected 0x${EXPECTED.toString(16).padStart(16, '0')}, got 0x${h.toString(16).padStart(16, '0')}`);
33
+ console.error(`✗ FAIL: expected ${EXPECTED_HEX}, got 0x${h.toString(16).padStart(16, '0')}`);
34
34
  process.exit(1);
35
35
  }
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superinstance/canary-hash",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Fleet canary hash for Quilt polyformalism — fnv1a-64('café Δ 日本語') = 0x024a555471370b18d",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test.js CHANGED
@@ -1,9 +1,8 @@
1
- const { fnv1a64, EXPECTED } = require('./index.js');
1
+ const { fnv1a64, EXPECTED, EXPECTED_HEX } = require('./index.js');
2
2
  const h = fnv1a64("café Δ 日本語");
3
- const formatted = `0x${h.toString(16).padStart(16, '0')}`;
4
- console.log(formatted);
3
+ console.log(`0x${h.toString(16).padStart(16, '0')}`);
5
4
  if (h !== EXPECTED) {
6
- console.error(`✗ FAIL: expected ${EXPECTED.toString(16)}, got ${h.toString(16)}`);
5
+ console.error(`✗ FAIL: expected ${EXPECTED_HEX}, got 0x${h.toString(16)}`);
7
6
  process.exit(1);
8
7
  }
9
8
  console.log("✓ test passed");