@superinstance/canary-hash 0.1.0 → 0.1.1

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 +4 -3
  2. package/package.json +1 -1
  3. package/test.js +3 -2
package/index.js CHANGED
@@ -18,18 +18,19 @@ function fnv1a64(s) {
18
18
  return h;
19
19
  }
20
20
 
21
- const EXPECTED = 0x024a555471370b18n;
21
+ // The fleet canary: 0x024a555471370b18d (decimal 2,640,610,520,279,855,501)
22
+ const EXPECTED = 0x024a555471370b18dn;
22
23
  const s = "café Δ 日本語";
23
- const h = fnv1a64(s);
24
24
 
25
25
  module.exports = { fnv1a64, EXPECTED, canaryString: s };
26
26
 
27
27
  if (require.main === module) {
28
+ const h = fnv1a64(s);
28
29
  console.log(`0x${h.toString(16).padStart(16, '0')}`);
29
30
  if (h === EXPECTED) {
30
31
  console.log("✓ Fleet canary verified: 0x024a555471370b18d");
31
32
  } else {
32
- console.error(`✗ FAIL: expected 0x024a555471370b18d, got 0x${h.toString(16).padStart(16, '0')}`);
33
+ console.error(`✗ FAIL: expected 0x${EXPECTED.toString(16).padStart(16, '0')}, got 0x${h.toString(16).padStart(16, '0')}`);
33
34
  process.exit(1);
34
35
  }
35
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superinstance/canary-hash",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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,8 +1,9 @@
1
1
  const { fnv1a64, EXPECTED } = require('./index.js');
2
2
  const h = fnv1a64("café Δ 日本語");
3
- console.log(`0x${h.toString(16).padStart(16, '0')}`);
3
+ const formatted = `0x${h.toString(16).padStart(16, '0')}`;
4
+ console.log(formatted);
4
5
  if (h !== EXPECTED) {
5
- console.error(`✗ FAIL: expected 0x${EXPECTED.toString(16)}, got 0x${h.toString(16)}`);
6
+ console.error(`✗ FAIL: expected ${EXPECTED.toString(16)}, got ${h.toString(16)}`);
6
7
  process.exit(1);
7
8
  }
8
9
  console.log("✓ test passed");