9router-proxy 0.6.16 → 0.6.17
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.
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +11 -11
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/prerender-manifest.json +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +2 -2
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +3 -3
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +3 -3
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +2 -2
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +2 -2
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +2 -2
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +11 -11
- package/app/.next-cli-build/server/chunks/1350.js +1 -1
- package/app/.next-cli-build/server/chunks/1757.js +1 -1
- package/app/.next-cli-build/server/chunks/3943.js +1 -1
- package/app/.next-cli-build/server/chunks/5026.js +1 -1
- package/app/.next-cli-build/server/chunks/8238.js +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/server/preview-props.json +3 -3
- package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/app/.next-cli-build/static/chunks/{1321-4954083281bedd15.js → 1321-49da642292269cb3.js} +1 -1
- package/app/open-sse/lib/deepseek-pow-hash.js +450 -0
- package/app/package.json +1 -1
- package/package.json +1 -1
- /package/app/.next-cli-build/static/{tGPhUdLBQmE1xemOhXbH7 → ZNl8Hs1z--QA5Uwm8j-64}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{tGPhUdLBQmE1xemOhXbH7 → ZNl8Hs1z--QA5Uwm8j-64}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
// Clean-room reference derived from NIST FIPS 202, Algorithms 1-9. FIPS SHA3-256
|
|
2
|
+
// uses KECCAK-p[1600,24]. Differential testing against the supplied black-box
|
|
3
|
+
// vectors identifies DeepSeekHashV1 as the same sponge construction with
|
|
4
|
+
// KECCAK-p[1600,23] (the last 23 rounds, with round indices 1 through 23).
|
|
5
|
+
|
|
6
|
+
const LANE_MASK = (1n << 64n) - 1n;
|
|
7
|
+
const SHA3_256_RATE_BYTES = 136;
|
|
8
|
+
const SHA3_DOMAIN_SUFFIX = 0x06;
|
|
9
|
+
const SHA3_256_OUTPUT_BYTES = 32;
|
|
10
|
+
|
|
11
|
+
// Indexed as x + 5*y, matching the FIPS 202 state coordinates.
|
|
12
|
+
const ROTATION_OFFSETS = [
|
|
13
|
+
0, 1, 62, 28, 27, 36, 44, 6, 55, 20, 3, 10, 43, 25, 39, 41, 45, 15, 21, 8, 18, 2, 61, 56, 14,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const ROUND_CONSTANTS = [
|
|
17
|
+
0x0000000000000001n,
|
|
18
|
+
0x0000000000008082n,
|
|
19
|
+
0x800000000000808an,
|
|
20
|
+
0x8000000080008000n,
|
|
21
|
+
0x000000000000808bn,
|
|
22
|
+
0x0000000080000001n,
|
|
23
|
+
0x8000000080008081n,
|
|
24
|
+
0x8000000000008009n,
|
|
25
|
+
0x000000000000008an,
|
|
26
|
+
0x0000000000000088n,
|
|
27
|
+
0x0000000080008009n,
|
|
28
|
+
0x000000008000000an,
|
|
29
|
+
0x000000008000808bn,
|
|
30
|
+
0x800000000000008bn,
|
|
31
|
+
0x8000000000008089n,
|
|
32
|
+
0x8000000000008003n,
|
|
33
|
+
0x8000000000008002n,
|
|
34
|
+
0x8000000000000080n,
|
|
35
|
+
0x000000000000800an,
|
|
36
|
+
0x800000008000000an,
|
|
37
|
+
0x8000000080008081n,
|
|
38
|
+
0x8000000000008080n,
|
|
39
|
+
0x0000000080000001n,
|
|
40
|
+
0x8000000080008008n,
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {bigint} value
|
|
45
|
+
* @param {number} amount
|
|
46
|
+
* @returns {bigint}
|
|
47
|
+
*/
|
|
48
|
+
function rotateLeft64(value, amount) {
|
|
49
|
+
if (amount === 0) return value;
|
|
50
|
+
const shift = BigInt(amount);
|
|
51
|
+
return ((value << shift) | (value >> (64n - shift))) & LANE_MASK;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Apply the last `roundCount` rounds of KECCAK-p[1600, roundCount].
|
|
56
|
+
*
|
|
57
|
+
* @param {bigint[]} state
|
|
58
|
+
* @param {number} roundCount
|
|
59
|
+
*/
|
|
60
|
+
function keccakP1600Reference(state, roundCount) {
|
|
61
|
+
/** @type {bigint[]} */
|
|
62
|
+
const columnParity = new Array(5).fill(0n);
|
|
63
|
+
/** @type {bigint[]} */
|
|
64
|
+
const thetaMix = new Array(5).fill(0n);
|
|
65
|
+
/** @type {bigint[]} */
|
|
66
|
+
const rhoPiState = new Array(25).fill(0n);
|
|
67
|
+
const firstRound = ROUND_CONSTANTS.length - roundCount;
|
|
68
|
+
|
|
69
|
+
for (let round = firstRound; round < ROUND_CONSTANTS.length; round++) {
|
|
70
|
+
for (let x = 0; x < 5; x++) {
|
|
71
|
+
columnParity[x] = state[x] ^ state[x + 5] ^ state[x + 10] ^ state[x + 15] ^ state[x + 20];
|
|
72
|
+
}
|
|
73
|
+
for (let x = 0; x < 5; x++) {
|
|
74
|
+
thetaMix[x] = columnParity[(x + 4) % 5] ^ rotateLeft64(columnParity[(x + 1) % 5], 1);
|
|
75
|
+
}
|
|
76
|
+
for (let y = 0; y < 5; y++) {
|
|
77
|
+
for (let x = 0; x < 5; x++) state[x + 5 * y] ^= thetaMix[x];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
for (let y = 0; y < 5; y++) {
|
|
81
|
+
for (let x = 0; x < 5; x++) {
|
|
82
|
+
const destinationX = y;
|
|
83
|
+
const destinationY = (2 * x + 3 * y) % 5;
|
|
84
|
+
const lane = x + 5 * y;
|
|
85
|
+
rhoPiState[destinationX + 5 * destinationY] = rotateLeft64(
|
|
86
|
+
state[lane],
|
|
87
|
+
ROTATION_OFFSETS[lane]
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
for (let y = 0; y < 5; y++) {
|
|
93
|
+
const row = 5 * y;
|
|
94
|
+
for (let x = 0; x < 5; x++) {
|
|
95
|
+
state[x + row] =
|
|
96
|
+
rhoPiState[x + row] ^
|
|
97
|
+
(~rhoPiState[((x + 1) % 5) + row] & LANE_MASK & rhoPiState[((x + 2) % 5) + row]);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
state[0] ^= ROUND_CONSTANTS[round];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @param {bigint[]} state
|
|
106
|
+
* @param {Uint8Array} block
|
|
107
|
+
* @param {number} roundCount
|
|
108
|
+
*/
|
|
109
|
+
function absorbReferenceBlock(state, block, roundCount) {
|
|
110
|
+
for (let index = 0; index < SHA3_256_RATE_BYTES; index++) {
|
|
111
|
+
const lane = Math.floor(index / 8);
|
|
112
|
+
const shift = BigInt((index % 8) * 8);
|
|
113
|
+
state[lane] ^= BigInt(block[index]) << shift;
|
|
114
|
+
}
|
|
115
|
+
keccakP1600Reference(state, roundCount);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* SHA3-256's sponge parameters with a selectable KECCAK-p round count.
|
|
120
|
+
*
|
|
121
|
+
* @param {string} input
|
|
122
|
+
* @param {number} roundCount
|
|
123
|
+
* @returns {string}
|
|
124
|
+
*/
|
|
125
|
+
function sha3_256ReferenceWithRoundCount(input, roundCount) {
|
|
126
|
+
const bytes = new TextEncoder().encode(input);
|
|
127
|
+
/** @type {bigint[]} */
|
|
128
|
+
const state = new Array(25).fill(0n);
|
|
129
|
+
let offset = 0;
|
|
130
|
+
|
|
131
|
+
while (offset + SHA3_256_RATE_BYTES <= bytes.length) {
|
|
132
|
+
absorbReferenceBlock(state, bytes.subarray(offset, offset + SHA3_256_RATE_BYTES), roundCount);
|
|
133
|
+
offset += SHA3_256_RATE_BYTES;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const finalBlock = new Uint8Array(SHA3_256_RATE_BYTES);
|
|
137
|
+
finalBlock.set(bytes.subarray(offset));
|
|
138
|
+
finalBlock[bytes.length - offset] ^= SHA3_DOMAIN_SUFFIX;
|
|
139
|
+
finalBlock[SHA3_256_RATE_BYTES - 1] ^= 0x80;
|
|
140
|
+
absorbReferenceBlock(state, finalBlock, roundCount);
|
|
141
|
+
|
|
142
|
+
const output = new Uint8Array(SHA3_256_OUTPUT_BYTES);
|
|
143
|
+
for (let index = 0; index < output.length; index++) {
|
|
144
|
+
const lane = Math.floor(index / 8);
|
|
145
|
+
const shift = BigInt((index % 8) * 8);
|
|
146
|
+
output[index] = Number((state[lane] >> shift) & 0xffn);
|
|
147
|
+
}
|
|
148
|
+
return Array.from(output, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Readable FIPS 202 control implementation used to validate the permutation,
|
|
153
|
+
* byte order, padding, and multi-block absorption against `node:crypto`.
|
|
154
|
+
*
|
|
155
|
+
* @param {string} input
|
|
156
|
+
* @returns {string}
|
|
157
|
+
*/
|
|
158
|
+
export function sha3_256Fips202Reference(input) {
|
|
159
|
+
return sha3_256ReferenceWithRoundCount(input, 24);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Readable DeepSeekHashV1 reference model. Runtime searches use an equivalent
|
|
164
|
+
* 32-bit implementation below so a bounded synchronous compatibility call does
|
|
165
|
+
* not turn a 144k challenge into minutes of BigInt work.
|
|
166
|
+
*
|
|
167
|
+
* @param {string} input
|
|
168
|
+
* @returns {string}
|
|
169
|
+
*/
|
|
170
|
+
export function deepSeekHashV1Reference(input) {
|
|
171
|
+
return sha3_256ReferenceWithRoundCount(input, 23);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const DEEPSEEK_HASH_ROUNDS = 23;
|
|
175
|
+
const DIGEST_HEX_PATTERN = /^[a-f0-9]{64}$/i;
|
|
176
|
+
const ROUND_CONSTANTS_LOW = Uint32Array.from(ROUND_CONSTANTS, (value) =>
|
|
177
|
+
Number(value & 0xffffffffn)
|
|
178
|
+
);
|
|
179
|
+
const ROUND_CONSTANTS_HIGH = Uint32Array.from(ROUND_CONSTANTS, (value) =>
|
|
180
|
+
Number((value >> 32n) & 0xffffffffn)
|
|
181
|
+
);
|
|
182
|
+
const RHO_PI_DESTINATION_WORDS = Uint8Array.from({ length: 25 }, (_, lane) => {
|
|
183
|
+
const x = lane % 5;
|
|
184
|
+
const y = Math.floor(lane / 5);
|
|
185
|
+
return 2 * (y + 5 * ((2 * x + 3 * y) % 5));
|
|
186
|
+
});
|
|
187
|
+
const CHI_NEXT_WORDS = Uint8Array.from({ length: 25 }, (_, lane) => {
|
|
188
|
+
const x = lane % 5;
|
|
189
|
+
const row = lane - x;
|
|
190
|
+
return 2 * (row + ((x + 1) % 5));
|
|
191
|
+
});
|
|
192
|
+
const CHI_NEXT_NEXT_WORDS = Uint8Array.from({ length: 25 }, (_, lane) => {
|
|
193
|
+
const x = lane % 5;
|
|
194
|
+
const row = lane - x;
|
|
195
|
+
return 2 * (row + ((x + 2) % 5));
|
|
196
|
+
});
|
|
197
|
+
const HEX_DIGITS = "0123456789abcdef";
|
|
198
|
+
|
|
199
|
+
export const MAX_DEEPSEEK_POW_DIFFICULTY = 250_000;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Equivalent 32-bit form of the reference permutation. Each 64-bit lane is
|
|
203
|
+
* stored as adjacent little-endian low/high uint32 words.
|
|
204
|
+
*
|
|
205
|
+
* @param {Uint32Array} state
|
|
206
|
+
* @param {Uint32Array} rhoPiState
|
|
207
|
+
* @param {Uint32Array} columnParity
|
|
208
|
+
* @param {Uint32Array} thetaMix
|
|
209
|
+
* @param {number} roundCount
|
|
210
|
+
*/
|
|
211
|
+
function keccakP1600Uint32(state, rhoPiState, columnParity, thetaMix, roundCount) {
|
|
212
|
+
const firstRound = ROUND_CONSTANTS.length - roundCount;
|
|
213
|
+
|
|
214
|
+
for (let round = firstRound; round < ROUND_CONSTANTS.length; round++) {
|
|
215
|
+
for (let x = 0; x < 5; x++) {
|
|
216
|
+
const word = 2 * x;
|
|
217
|
+
columnParity[word] =
|
|
218
|
+
state[word] ^ state[word + 10] ^ state[word + 20] ^ state[word + 30] ^ state[word + 40];
|
|
219
|
+
columnParity[word + 1] =
|
|
220
|
+
state[word + 1] ^ state[word + 11] ^ state[word + 21] ^ state[word + 31] ^ state[word + 41];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
for (let x = 0; x < 5; x++) {
|
|
224
|
+
const previous = 2 * ((x + 4) % 5);
|
|
225
|
+
const next = 2 * ((x + 1) % 5);
|
|
226
|
+
const rotatedLow = (columnParity[next] << 1) | (columnParity[next + 1] >>> 31);
|
|
227
|
+
const rotatedHigh = (columnParity[next + 1] << 1) | (columnParity[next] >>> 31);
|
|
228
|
+
thetaMix[2 * x] = columnParity[previous] ^ rotatedLow;
|
|
229
|
+
thetaMix[2 * x + 1] = columnParity[previous + 1] ^ rotatedHigh;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
for (let x = 0; x < 5; x++) {
|
|
233
|
+
const word = 2 * x;
|
|
234
|
+
const low = thetaMix[word];
|
|
235
|
+
const high = thetaMix[word + 1];
|
|
236
|
+
state[word] ^= low;
|
|
237
|
+
state[word + 1] ^= high;
|
|
238
|
+
state[word + 10] ^= low;
|
|
239
|
+
state[word + 11] ^= high;
|
|
240
|
+
state[word + 20] ^= low;
|
|
241
|
+
state[word + 21] ^= high;
|
|
242
|
+
state[word + 30] ^= low;
|
|
243
|
+
state[word + 31] ^= high;
|
|
244
|
+
state[word + 40] ^= low;
|
|
245
|
+
state[word + 41] ^= high;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
rhoPiState[0] = state[0];
|
|
249
|
+
rhoPiState[1] = state[1];
|
|
250
|
+
for (let lane = 1; lane < 25; lane++) {
|
|
251
|
+
const source = 2 * lane;
|
|
252
|
+
const destination = RHO_PI_DESTINATION_WORDS[lane];
|
|
253
|
+
const amount = ROTATION_OFFSETS[lane];
|
|
254
|
+
const low = state[source];
|
|
255
|
+
const high = state[source + 1];
|
|
256
|
+
|
|
257
|
+
if (amount < 32) {
|
|
258
|
+
rhoPiState[destination] = (low << amount) | (high >>> (32 - amount));
|
|
259
|
+
rhoPiState[destination + 1] = (high << amount) | (low >>> (32 - amount));
|
|
260
|
+
} else {
|
|
261
|
+
const reduced = amount - 32;
|
|
262
|
+
rhoPiState[destination] = (high << reduced) | (low >>> (32 - reduced));
|
|
263
|
+
rhoPiState[destination + 1] = (low << reduced) | (high >>> (32 - reduced));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
for (let lane = 0; lane < 25; lane++) {
|
|
268
|
+
const word = 2 * lane;
|
|
269
|
+
const nextWord = CHI_NEXT_WORDS[lane];
|
|
270
|
+
const nextNextWord = CHI_NEXT_NEXT_WORDS[lane];
|
|
271
|
+
state[word] = rhoPiState[word] ^ (~rhoPiState[nextWord] & rhoPiState[nextNextWord]);
|
|
272
|
+
state[word + 1] =
|
|
273
|
+
rhoPiState[word + 1] ^ (~rhoPiState[nextWord + 1] & rhoPiState[nextNextWord + 1]);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
state[0] ^= ROUND_CONSTANTS_LOW[round];
|
|
277
|
+
state[1] ^= ROUND_CONSTANTS_HIGH[round];
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @param {Uint32Array} state
|
|
283
|
+
* @param {Uint8Array} bytes
|
|
284
|
+
* @param {number} offset
|
|
285
|
+
* @param {Uint32Array} rhoPiState
|
|
286
|
+
* @param {Uint32Array} columnParity
|
|
287
|
+
* @param {Uint32Array} thetaMix
|
|
288
|
+
* @param {number} roundCount
|
|
289
|
+
*/
|
|
290
|
+
function absorbFullUint32Block(
|
|
291
|
+
state,
|
|
292
|
+
bytes,
|
|
293
|
+
offset,
|
|
294
|
+
rhoPiState,
|
|
295
|
+
columnParity,
|
|
296
|
+
thetaMix,
|
|
297
|
+
roundCount
|
|
298
|
+
) {
|
|
299
|
+
for (let index = 0; index < SHA3_256_RATE_BYTES; index++) {
|
|
300
|
+
const word = index >>> 2;
|
|
301
|
+
state[word] ^= bytes[offset + index] << ((index & 3) * 8);
|
|
302
|
+
}
|
|
303
|
+
keccakP1600Uint32(state, rhoPiState, columnParity, thetaMix, roundCount);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @param {Uint32Array} state
|
|
308
|
+
* @returns {string}
|
|
309
|
+
*/
|
|
310
|
+
function digestStateToHex(state) {
|
|
311
|
+
let digest = "";
|
|
312
|
+
for (let index = 0; index < SHA3_256_OUTPUT_BYTES; index++) {
|
|
313
|
+
const byte = (state[index >>> 2] >>> ((index & 3) * 8)) & 0xff;
|
|
314
|
+
digest += HEX_DIGITS[byte >>> 4] + HEX_DIGITS[byte & 0x0f];
|
|
315
|
+
}
|
|
316
|
+
return digest;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @param {string} input
|
|
321
|
+
* @param {number} roundCount
|
|
322
|
+
* @returns {string}
|
|
323
|
+
*/
|
|
324
|
+
function sha3_256Uint32WithRoundCount(input, roundCount) {
|
|
325
|
+
const bytes = new TextEncoder().encode(input);
|
|
326
|
+
const state = new Uint32Array(50);
|
|
327
|
+
const rhoPiState = new Uint32Array(50);
|
|
328
|
+
const columnParity = new Uint32Array(10);
|
|
329
|
+
const thetaMix = new Uint32Array(10);
|
|
330
|
+
let offset = 0;
|
|
331
|
+
|
|
332
|
+
while (offset + SHA3_256_RATE_BYTES <= bytes.length) {
|
|
333
|
+
absorbFullUint32Block(state, bytes, offset, rhoPiState, columnParity, thetaMix, roundCount);
|
|
334
|
+
offset += SHA3_256_RATE_BYTES;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const remaining = bytes.length - offset;
|
|
338
|
+
for (let index = 0; index < remaining; index++) {
|
|
339
|
+
state[index >>> 2] ^= bytes[offset + index] << ((index & 3) * 8);
|
|
340
|
+
}
|
|
341
|
+
state[remaining >>> 2] ^= SHA3_DOMAIN_SUFFIX << ((remaining & 3) * 8);
|
|
342
|
+
state[(SHA3_256_RATE_BYTES - 1) >>> 2] ^= 0x80 << 24;
|
|
343
|
+
keccakP1600Uint32(state, rhoPiState, columnParity, thetaMix, roundCount);
|
|
344
|
+
return digestStateToHex(state);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Optimized, allocation-bounded DeepSeekHashV1 digest.
|
|
349
|
+
*
|
|
350
|
+
* @param {string} input
|
|
351
|
+
* @returns {string}
|
|
352
|
+
*/
|
|
353
|
+
export function deepSeekHashV1(input) {
|
|
354
|
+
return sha3_256Uint32WithRoundCount(input, DEEPSEEK_HASH_ROUNDS);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* @param {string} digestHex
|
|
359
|
+
* @returns {Uint32Array}
|
|
360
|
+
*/
|
|
361
|
+
function parseDigestWords(digestHex) {
|
|
362
|
+
const words = new Uint32Array(SHA3_256_OUTPUT_BYTES / 4);
|
|
363
|
+
for (let index = 0; index < SHA3_256_OUTPUT_BYTES; index++) {
|
|
364
|
+
const byte = Number.parseInt(digestHex.slice(index * 2, index * 2 + 2), 16);
|
|
365
|
+
words[index >>> 2] |= byte << ((index & 3) * 8);
|
|
366
|
+
}
|
|
367
|
+
return words;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Search `prefix + nonce` without allocating a digest or re-encoding the prefix
|
|
372
|
+
* for every candidate. Inputs are validated here as well as at the public solver
|
|
373
|
+
* boundary so the worker cannot be coerced into an unbounded loop.
|
|
374
|
+
*
|
|
375
|
+
* @param {string} prefix
|
|
376
|
+
* @param {string} challenge
|
|
377
|
+
* @param {number} difficulty
|
|
378
|
+
* @returns {number}
|
|
379
|
+
*/
|
|
380
|
+
export function findDeepSeekPowNonce(prefix, challenge, difficulty) {
|
|
381
|
+
if (typeof prefix !== "string") throw new TypeError("DeepSeek PoW prefix must be a string");
|
|
382
|
+
if (!DIGEST_HEX_PATTERN.test(challenge)) {
|
|
383
|
+
throw new TypeError("DeepSeek PoW challenge must be a 64-character hex digest");
|
|
384
|
+
}
|
|
385
|
+
if (
|
|
386
|
+
!Number.isSafeInteger(difficulty) ||
|
|
387
|
+
difficulty < 1 ||
|
|
388
|
+
difficulty > MAX_DEEPSEEK_POW_DIFFICULTY
|
|
389
|
+
) {
|
|
390
|
+
throw new RangeError(
|
|
391
|
+
`DeepSeek PoW difficulty must be an integer from 1 to ${MAX_DEEPSEEK_POW_DIFFICULTY}`
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
const prefixBytes = new TextEncoder().encode(prefix);
|
|
396
|
+
const baseState = new Uint32Array(50);
|
|
397
|
+
const rhoPiState = new Uint32Array(50);
|
|
398
|
+
const columnParity = new Uint32Array(10);
|
|
399
|
+
const thetaMix = new Uint32Array(10);
|
|
400
|
+
let prefixOffset = 0;
|
|
401
|
+
|
|
402
|
+
while (prefixOffset + SHA3_256_RATE_BYTES <= prefixBytes.length) {
|
|
403
|
+
absorbFullUint32Block(
|
|
404
|
+
baseState,
|
|
405
|
+
prefixBytes,
|
|
406
|
+
prefixOffset,
|
|
407
|
+
rhoPiState,
|
|
408
|
+
columnParity,
|
|
409
|
+
thetaMix,
|
|
410
|
+
DEEPSEEK_HASH_ROUNDS
|
|
411
|
+
);
|
|
412
|
+
prefixOffset += SHA3_256_RATE_BYTES;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
const tailLength = prefixBytes.length - prefixOffset;
|
|
416
|
+
const tailWords = new Uint32Array(Math.ceil(tailLength / 4));
|
|
417
|
+
for (let index = 0; index < tailLength; index++) {
|
|
418
|
+
tailWords[index >>> 2] ^= prefixBytes[prefixOffset + index] << ((index & 3) * 8);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const targetWords = parseDigestWords(challenge.toLowerCase());
|
|
422
|
+
const state = new Uint32Array(50);
|
|
423
|
+
|
|
424
|
+
nonceLoop: for (let nonce = 0; nonce < difficulty; nonce++) {
|
|
425
|
+
state.set(baseState);
|
|
426
|
+
for (let word = 0; word < tailWords.length; word++) state[word] ^= tailWords[word];
|
|
427
|
+
|
|
428
|
+
let position = tailLength;
|
|
429
|
+
const nonceText = String(nonce);
|
|
430
|
+
for (let index = 0; index < nonceText.length; index++) {
|
|
431
|
+
state[position >>> 2] ^= nonceText.charCodeAt(index) << ((position & 3) * 8);
|
|
432
|
+
position += 1;
|
|
433
|
+
if (position === SHA3_256_RATE_BYTES) {
|
|
434
|
+
keccakP1600Uint32(state, rhoPiState, columnParity, thetaMix, DEEPSEEK_HASH_ROUNDS);
|
|
435
|
+
position = 0;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
state[position >>> 2] ^= SHA3_DOMAIN_SUFFIX << ((position & 3) * 8);
|
|
440
|
+
state[(SHA3_256_RATE_BYTES - 1) >>> 2] ^= 0x80 << 24;
|
|
441
|
+
keccakP1600Uint32(state, rhoPiState, columnParity, thetaMix, DEEPSEEK_HASH_ROUNDS);
|
|
442
|
+
|
|
443
|
+
for (let word = 0; word < targetWords.length; word++) {
|
|
444
|
+
if (state[word] !== targetWords[word]) continue nonceLoop;
|
|
445
|
+
}
|
|
446
|
+
return nonce;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return -1;
|
|
450
|
+
}
|
package/app/package.json
CHANGED
package/package.json
CHANGED
|
File without changes
|
/package/app/.next-cli-build/static/{tGPhUdLBQmE1xemOhXbH7 → ZNl8Hs1z--QA5Uwm8j-64}/_ssgManifest.js
RENAMED
|
File without changes
|