@cloudglides/veil 0.1.1 → 1.0.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.
- package/dist/index.d.ts +103 -0
- package/dist/index.js +1000 -0
- package/dist/veil_core_bg.wasm +0 -0
- package/package.json +24 -10
- package/.envrc +0 -1
- package/.github/workflows/build-on-tag.yml +0 -82
- package/.github/workflows/deploy-pages.yml +0 -73
- package/example/index.html +0 -220
- package/example/veil_core.d.ts +0 -71
- package/example/veil_core_bg.wasm +0 -0
- package/example/veil_core_bg.wasm.d.ts +0 -20
- package/flake.nix +0 -68
- package/scripts/patch-wasm.js +0 -12
- package/src/cpu.ts +0 -67
- package/src/entropy/adblock.ts +0 -16
- package/src/entropy/approximate.ts +0 -9
- package/src/entropy/audio.ts +0 -17
- package/src/entropy/battery.ts +0 -10
- package/src/entropy/browser.ts +0 -7
- package/src/entropy/canvas.ts +0 -17
- package/src/entropy/complexity.ts +0 -14
- package/src/entropy/connection.ts +0 -14
- package/src/entropy/distribution.ts +0 -9
- package/src/entropy/fonts.ts +0 -4
- package/src/entropy/hardware.ts +0 -10
- package/src/entropy/language.ts +0 -14
- package/src/entropy/os.ts +0 -12
- package/src/entropy/osVersion.ts +0 -6
- package/src/entropy/performance.ts +0 -14
- package/src/entropy/permissions.ts +0 -15
- package/src/entropy/plugins.ts +0 -14
- package/src/entropy/preferences.ts +0 -12
- package/src/entropy/probabilistic.ts +0 -20
- package/src/entropy/screen.ts +0 -12
- package/src/entropy/screenInfo.ts +0 -8
- package/src/entropy/spectral.ts +0 -9
- package/src/entropy/statistical.ts +0 -15
- package/src/entropy/storage.ts +0 -22
- package/src/entropy/timezone.ts +0 -10
- package/src/entropy/userAgent.ts +0 -16
- package/src/entropy/webFeatures.ts +0 -21
- package/src/entropy/webgl.ts +0 -11
- package/src/gpu.ts +0 -132
- package/src/index.test.ts +0 -26
- package/src/index.ts +0 -248
- package/src/normalize/index.ts +0 -31
- package/src/probability.ts +0 -11
- package/src/scoring.ts +0 -106
- package/src/seeded-rng.ts +0 -14
- package/src/stability.ts +0 -405
- package/src/tamper.ts +0 -207
- package/src/types/index.ts +0 -11
- package/src/types.ts +0 -56
- package/src/veil_core.d.ts +0 -4
- package/src/wasm-loader.ts +0 -44
- package/tsconfig.json +0 -12
- package/tsup.config.ts +0 -41
- package/veil-core/Cargo.lock +0 -114
- package/veil-core/Cargo.toml +0 -12
- package/veil-core/src/entropy.rs +0 -132
- package/veil-core/src/lib.rs +0 -93
- package/veil-core/src/similarity.rs +0 -67
- package/vitest.config.ts +0 -15
- /package/{example → dist}/veil_core.js +0 -0
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudglides/veil",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Math-based deterministic browser fingerprinting library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
|
-
"exports":
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
8
13
|
"type": "module",
|
|
9
14
|
"publishConfig": {
|
|
10
15
|
"access": "public"
|
|
11
16
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"workspaces": [
|
|
21
|
+
"example"
|
|
22
|
+
],
|
|
19
23
|
"devDependencies": {
|
|
20
24
|
"@vitest/ui": "^1.0.0",
|
|
21
25
|
"eslint": "^9.39.2",
|
|
@@ -27,5 +31,15 @@
|
|
|
27
31
|
"vite-plugin-top-level-await": "^1.6.0",
|
|
28
32
|
"vite-plugin-wasm": "^3.5.0",
|
|
29
33
|
"vitest": "^1.0.0"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsup",
|
|
37
|
+
"build:all": "node scripts/build.js",
|
|
38
|
+
"build:example": "pnpm -C example build",
|
|
39
|
+
"dev": "tsup --watch",
|
|
40
|
+
"build:wasm": "wasm-pack build veil-core --target web",
|
|
41
|
+
"test": "vitest",
|
|
42
|
+
"test:ui": "vitest --ui",
|
|
43
|
+
"example:dev": "pnpm -C example dev"
|
|
30
44
|
}
|
|
31
|
-
}
|
|
45
|
+
}
|
package/.envrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
use flake
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
name: Build on Tag
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
tags:
|
|
5
|
-
- 'v*'
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
permissions:
|
|
11
|
-
contents: write # For creating releases
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v4
|
|
14
|
-
with:
|
|
15
|
-
fetch-depth: 0
|
|
16
|
-
|
|
17
|
-
- uses: pnpm/action-setup@v2
|
|
18
|
-
with:
|
|
19
|
-
version: 8
|
|
20
|
-
|
|
21
|
-
- uses: actions/setup-node@v4
|
|
22
|
-
with:
|
|
23
|
-
node-version: '20'
|
|
24
|
-
cache: 'pnpm'
|
|
25
|
-
registry-url: 'https://registry.npmjs.org'
|
|
26
|
-
|
|
27
|
-
- uses: dtolnay/rust-toolchain@stable
|
|
28
|
-
|
|
29
|
-
- name: Install wasm-pack
|
|
30
|
-
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
31
|
-
|
|
32
|
-
- name: Extract version from tag
|
|
33
|
-
id: version
|
|
34
|
-
run: |
|
|
35
|
-
VERSION=${GITHUB_REF#refs/tags/v}
|
|
36
|
-
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
37
|
-
|
|
38
|
-
- name: Update package.json version
|
|
39
|
-
run: |
|
|
40
|
-
VERSION="${{ steps.version.outputs.version }}"
|
|
41
|
-
pnpm exec jq --arg v "$VERSION" '.version = $v' package.json > package.json.tmp
|
|
42
|
-
mv package.json.tmp package.json
|
|
43
|
-
|
|
44
|
-
- name: Install dependencies
|
|
45
|
-
run: pnpm install
|
|
46
|
-
|
|
47
|
-
- name: Build WASM
|
|
48
|
-
run: pnpm run build:wasm
|
|
49
|
-
|
|
50
|
-
- name: Build
|
|
51
|
-
run: pnpm run build
|
|
52
|
-
|
|
53
|
-
- name: Publish to npm
|
|
54
|
-
run: npm publish
|
|
55
|
-
env:
|
|
56
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
57
|
-
|
|
58
|
-
- name: Get commit history
|
|
59
|
-
id: commits
|
|
60
|
-
run: |
|
|
61
|
-
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD)
|
|
62
|
-
COMMITS=$(git log $PREV_TAG..HEAD --oneline --no-decorate)
|
|
63
|
-
{
|
|
64
|
-
echo "commit_log<<EOF"
|
|
65
|
-
echo "$COMMITS"
|
|
66
|
-
echo "EOF"
|
|
67
|
-
} >> $GITHUB_OUTPUT
|
|
68
|
-
|
|
69
|
-
- name: Create GitHub Release
|
|
70
|
-
uses: softprops/action-gh-release@v1
|
|
71
|
-
with:
|
|
72
|
-
body: ${{ steps.commits.outputs.commit_log }}
|
|
73
|
-
generate_release_notes: true
|
|
74
|
-
files: |
|
|
75
|
-
dist/index.js
|
|
76
|
-
dist/index.d.ts
|
|
77
|
-
dist/veil_core.js
|
|
78
|
-
dist/veil_core_bg.wasm
|
|
79
|
-
env:
|
|
80
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
81
|
-
|
|
82
|
-
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
name: Deploy to GitHub Pages
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
|
|
8
|
-
concurrency:
|
|
9
|
-
group: "pages"
|
|
10
|
-
cancel-in-progress: false
|
|
11
|
-
|
|
12
|
-
permissions:
|
|
13
|
-
contents: read
|
|
14
|
-
pages: write
|
|
15
|
-
id-token: write
|
|
16
|
-
|
|
17
|
-
jobs:
|
|
18
|
-
build:
|
|
19
|
-
runs-on: ubuntu-latest
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v4
|
|
22
|
-
|
|
23
|
-
- uses: pnpm/action-setup@v2
|
|
24
|
-
with:
|
|
25
|
-
version: 8
|
|
26
|
-
|
|
27
|
-
- uses: actions/setup-node@v4
|
|
28
|
-
with:
|
|
29
|
-
node-version: '20'
|
|
30
|
-
cache: 'pnpm'
|
|
31
|
-
|
|
32
|
-
- uses: dtolnay/rust-toolchain@stable
|
|
33
|
-
|
|
34
|
-
- name: Install wasm-pack
|
|
35
|
-
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
36
|
-
|
|
37
|
-
- name: Install dependencies
|
|
38
|
-
run: pnpm install
|
|
39
|
-
|
|
40
|
-
- name: Build WASM
|
|
41
|
-
run: pnpm run build:wasm
|
|
42
|
-
|
|
43
|
-
- name: Build
|
|
44
|
-
run: pnpm run build
|
|
45
|
-
env:
|
|
46
|
-
# Add this if you need base path configuration
|
|
47
|
-
VITE_BASE_PATH: /veil/
|
|
48
|
-
|
|
49
|
-
- name: Copy dist to example
|
|
50
|
-
run: |
|
|
51
|
-
cp -r dist/* example/
|
|
52
|
-
touch example/.nojekyll
|
|
53
|
-
|
|
54
|
-
- name: Setup Pages
|
|
55
|
-
uses: actions/configure-pages@v3
|
|
56
|
-
|
|
57
|
-
- name: Upload artifact
|
|
58
|
-
uses: actions/upload-pages-artifact@v4
|
|
59
|
-
with:
|
|
60
|
-
path: 'example'
|
|
61
|
-
|
|
62
|
-
deploy:
|
|
63
|
-
environment:
|
|
64
|
-
name: github-pages
|
|
65
|
-
url: ${{ steps.deployment.outputs.page_url }}
|
|
66
|
-
runs-on: ubuntu-latest
|
|
67
|
-
needs: build
|
|
68
|
-
steps:
|
|
69
|
-
- name: Deploy to GitHub Pages
|
|
70
|
-
id: deployment
|
|
71
|
-
uses: actions/deploy-pages@v4
|
|
72
|
-
|
|
73
|
-
|
package/example/index.html
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<!-- base href removed to fix module import paths -->
|
|
6
|
-
<title>Veil Fingerprinting Demo</title>
|
|
7
|
-
<style>
|
|
8
|
-
body {
|
|
9
|
-
font-family: monospace;
|
|
10
|
-
max-width: 1000px;
|
|
11
|
-
margin: 30px auto;
|
|
12
|
-
padding: 20px;
|
|
13
|
-
background: #fafafa;
|
|
14
|
-
}
|
|
15
|
-
h1 {
|
|
16
|
-
color: #333;
|
|
17
|
-
}
|
|
18
|
-
.controls {
|
|
19
|
-
display: flex;
|
|
20
|
-
gap: 10px;
|
|
21
|
-
margin: 20px 0;
|
|
22
|
-
flex-wrap: wrap;
|
|
23
|
-
}
|
|
24
|
-
button {
|
|
25
|
-
padding: 10px 16px;
|
|
26
|
-
font-size: 14px;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
background: #007bff;
|
|
29
|
-
color: white;
|
|
30
|
-
border: none;
|
|
31
|
-
border-radius: 4px;
|
|
32
|
-
transition: background 0.2s;
|
|
33
|
-
}
|
|
34
|
-
button:hover {
|
|
35
|
-
background: #0056b3;
|
|
36
|
-
}
|
|
37
|
-
button:disabled {
|
|
38
|
-
background: #ccc;
|
|
39
|
-
cursor: not-allowed;
|
|
40
|
-
}
|
|
41
|
-
.checkbox-group {
|
|
42
|
-
display: flex;
|
|
43
|
-
gap: 15px;
|
|
44
|
-
margin: 15px 0;
|
|
45
|
-
}
|
|
46
|
-
.checkbox-group label {
|
|
47
|
-
display: flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
gap: 6px;
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
}
|
|
52
|
-
#result {
|
|
53
|
-
background: white;
|
|
54
|
-
padding: 20px;
|
|
55
|
-
border-radius: 4px;
|
|
56
|
-
margin-top: 20px;
|
|
57
|
-
border: 1px solid #ddd;
|
|
58
|
-
word-break: break-all;
|
|
59
|
-
max-height: 600px;
|
|
60
|
-
overflow-y: auto;
|
|
61
|
-
}
|
|
62
|
-
.loading {
|
|
63
|
-
color: #666;
|
|
64
|
-
}
|
|
65
|
-
.error {
|
|
66
|
-
color: #d32f2f;
|
|
67
|
-
}
|
|
68
|
-
.success {
|
|
69
|
-
color: #388e3c;
|
|
70
|
-
}
|
|
71
|
-
.info {
|
|
72
|
-
background: #e3f2fd;
|
|
73
|
-
padding: 10px;
|
|
74
|
-
border-radius: 4px;
|
|
75
|
-
margin: 10px 0;
|
|
76
|
-
border-left: 4px solid #2196f3;
|
|
77
|
-
}
|
|
78
|
-
pre {
|
|
79
|
-
background: #f5f5f5;
|
|
80
|
-
padding: 12px;
|
|
81
|
-
border-radius: 4px;
|
|
82
|
-
overflow-x: auto;
|
|
83
|
-
font-size: 12px;
|
|
84
|
-
line-height: 1.4;
|
|
85
|
-
}
|
|
86
|
-
</style>
|
|
87
|
-
</head>
|
|
88
|
-
<body>
|
|
89
|
-
<h1>Veil Browser Fingerprinting</h1>
|
|
90
|
-
|
|
91
|
-
<div class="info">
|
|
92
|
-
Generates a unique browser fingerprint using system, display, and performance metrics.
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<div class="checkbox-group">
|
|
96
|
-
<label>
|
|
97
|
-
<input type="checkbox" id="detailedCheckbox" checked />
|
|
98
|
-
Detailed output (JSON)
|
|
99
|
-
</label>
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<div class="controls">
|
|
103
|
-
<button onclick="generateFingerprint()">Generate</button>
|
|
104
|
-
<button onclick="clearResult()">Clear</button>
|
|
105
|
-
<button onclick="copyToClipboard()">Copy Result</button>
|
|
106
|
-
</div>
|
|
107
|
-
|
|
108
|
-
<div id="result">Click "Generate" to start...</div>
|
|
109
|
-
|
|
110
|
-
<script type="module">
|
|
111
|
-
let distPath = '../dist/index.js';
|
|
112
|
-
if (window.location.pathname.includes('/veil/')) {
|
|
113
|
-
distPath = '/veil/dist/index.js';
|
|
114
|
-
}
|
|
115
|
-
const { getFingerprint } = await import(distPath);
|
|
116
|
-
|
|
117
|
-
window.generateFingerprint = async () => {
|
|
118
|
-
const result = document.getElementById("result");
|
|
119
|
-
const detailed = document.getElementById("detailedCheckbox").checked;
|
|
120
|
-
|
|
121
|
-
result.innerHTML = '<div class="loading">Generating fingerprint...</div>';
|
|
122
|
-
console.log("Starting fingerprint generation");
|
|
123
|
-
console.log("Options:", { detailed });
|
|
124
|
-
|
|
125
|
-
try {
|
|
126
|
-
const startTime = performance.now();
|
|
127
|
-
|
|
128
|
-
const fp = await getFingerprint({
|
|
129
|
-
hash: "sha256",
|
|
130
|
-
detailed,
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
const endTime = performance.now();
|
|
134
|
-
const duration = (endTime - startTime).toFixed(2);
|
|
135
|
-
|
|
136
|
-
console.log("Fingerprint generated in " + duration + "ms");
|
|
137
|
-
|
|
138
|
-
if (typeof fp === "string") {
|
|
139
|
-
console.log("Hash:", fp);
|
|
140
|
-
result.innerHTML = `
|
|
141
|
-
<div class="success">✓ Fingerprint generated</div>
|
|
142
|
-
<div style="margin-top: 10px;">
|
|
143
|
-
<strong>Hash:</strong><br/>
|
|
144
|
-
<pre>${fp}</pre>
|
|
145
|
-
<small>Generated in ${duration}ms</small>
|
|
146
|
-
</div>
|
|
147
|
-
`;
|
|
148
|
-
} else {
|
|
149
|
-
console.log("Detailed fingerprint:", fp);
|
|
150
|
-
result.innerHTML = `
|
|
151
|
-
<div class="success">✓ Fingerprint generated</div>
|
|
152
|
-
<div style="margin-top: 15px;">
|
|
153
|
-
<strong>Hash:</strong><br/>
|
|
154
|
-
<pre>${fp.hash}</pre>
|
|
155
|
-
|
|
156
|
-
<strong>Metrics:</strong><br/>
|
|
157
|
-
<pre>Uniqueness: ${(fp.uniqueness * 100).toFixed(2)}%
|
|
158
|
-
Confidence: ${(fp.confidence * 100).toFixed(2)}%
|
|
159
|
-
Tampering Risk: ${(fp.tampering_risk * 100).toFixed(2)}%</pre>
|
|
160
|
-
|
|
161
|
-
${fp.anomalies.length > 0 ? `
|
|
162
|
-
<strong>Anomalies Detected (${fp.anomalies.length}):</strong><br/>
|
|
163
|
-
<pre>${fp.anomalies.map(a =>
|
|
164
|
-
`[${a.severity.toUpperCase()}] ${a.id} (${a.category})\n${a.message}\nRisk: ${(a.riskContribution * 100).toFixed(0)}%\n`
|
|
165
|
-
).join("\n")}</pre>
|
|
166
|
-
` : ""}
|
|
167
|
-
|
|
168
|
-
<strong>System:</strong><br/>
|
|
169
|
-
<pre>OS: ${fp.system.os}
|
|
170
|
-
Language: ${fp.system.language}
|
|
171
|
-
Timezone: ${fp.system.timezone}
|
|
172
|
-
Cores: ${fp.system.hardware.cores}
|
|
173
|
-
Memory: ${fp.system.hardware.memory}GB</pre>
|
|
174
|
-
|
|
175
|
-
<strong>Display:</strong><br/>
|
|
176
|
-
<pre>Resolution: ${fp.display.resolution}
|
|
177
|
-
Color Depth: ${fp.display.colorDepth}
|
|
178
|
-
Pixel Ratio: ${fp.display.devicePixelRatio}</pre>
|
|
179
|
-
|
|
180
|
-
<strong>Browser:</strong><br/>
|
|
181
|
-
<pre>Vendor: ${fp.browser.vendor}
|
|
182
|
-
Cookies: ${fp.browser.cookieEnabled ? "enabled" : "disabled"}</pre>
|
|
183
|
-
|
|
184
|
-
<strong>Entropy Sources (${fp.sources.length}):</strong><br/>
|
|
185
|
-
<pre>${fp.sources
|
|
186
|
-
.map(
|
|
187
|
-
(s) =>
|
|
188
|
-
`${s.source}: H=${s.entropy.toFixed(3)}, C=${(s.confidence * 100).toFixed(1)}%`,
|
|
189
|
-
)
|
|
190
|
-
.join("\n")}</pre>
|
|
191
|
-
</div>
|
|
192
|
-
`;
|
|
193
|
-
}
|
|
194
|
-
} catch (e) {
|
|
195
|
-
console.error("Error:", e);
|
|
196
|
-
result.innerHTML = `
|
|
197
|
-
<div class="error">Error generating fingerprint</div>
|
|
198
|
-
<pre>${e.message}\n\n${e.stack}</pre>
|
|
199
|
-
`;
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
window.clearResult = () => {
|
|
204
|
-
document.getElementById("result").textContent = "Cleared";
|
|
205
|
-
console.log("Result cleared");
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
window.copyToClipboard = () => {
|
|
209
|
-
const result = document.getElementById("result");
|
|
210
|
-
const text = result.innerText;
|
|
211
|
-
navigator.clipboard.writeText(text).then(() => {
|
|
212
|
-
console.log("Copied to clipboard");
|
|
213
|
-
alert("Copied to clipboard!");
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
console.log("Veil fingerprinting library loaded");
|
|
218
|
-
</script>
|
|
219
|
-
</body>
|
|
220
|
-
</html>
|
package/example/veil_core.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
export function approx_entropy(samples: Float64Array, m: number): number;
|
|
5
|
-
|
|
6
|
-
export function cosine_similarity(v1: Float64Array, v2: Float64Array): number;
|
|
7
|
-
|
|
8
|
-
export function fnv_hash(s: string): string;
|
|
9
|
-
|
|
10
|
-
export function kolmogorov_complexity(s: string): number;
|
|
11
|
-
|
|
12
|
-
export function ks_test(values: Float64Array): number;
|
|
13
|
-
|
|
14
|
-
export function levenshtein_distance(s1: string, s2: string): number;
|
|
15
|
-
|
|
16
|
-
export function lz_complexity(data: Uint8Array): number;
|
|
17
|
-
|
|
18
|
-
export function murmur_hash(s: string): string;
|
|
19
|
-
|
|
20
|
-
export function sample_ent(samples: Float64Array, m: number, r: number): number;
|
|
21
|
-
|
|
22
|
-
export function shannon_entropy(s: string): number;
|
|
23
|
-
|
|
24
|
-
export function similarity_score(s1: string, s2: string): number;
|
|
25
|
-
|
|
26
|
-
export function spectral(samples: Float64Array): number;
|
|
27
|
-
|
|
28
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
29
|
-
|
|
30
|
-
export interface InitOutput {
|
|
31
|
-
readonly memory: WebAssembly.Memory;
|
|
32
|
-
readonly cosine_similarity: (a: number, b: number, c: number, d: number) => number;
|
|
33
|
-
readonly levenshtein_distance: (a: number, b: number, c: number, d: number) => number;
|
|
34
|
-
readonly similarity_score: (a: number, b: number, c: number, d: number) => number;
|
|
35
|
-
readonly approx_entropy: (a: number, b: number, c: number) => number;
|
|
36
|
-
readonly fnv_hash: (a: number, b: number) => [number, number];
|
|
37
|
-
readonly kolmogorov_complexity: (a: number, b: number) => number;
|
|
38
|
-
readonly ks_test: (a: number, b: number) => number;
|
|
39
|
-
readonly lz_complexity: (a: number, b: number) => number;
|
|
40
|
-
readonly sample_ent: (a: number, b: number, c: number, d: number) => number;
|
|
41
|
-
readonly shannon_entropy: (a: number, b: number) => number;
|
|
42
|
-
readonly spectral: (a: number, b: number) => number;
|
|
43
|
-
readonly murmur_hash: (a: number, b: number) => [number, number];
|
|
44
|
-
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
45
|
-
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
46
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
47
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
48
|
-
readonly __wbindgen_start: () => void;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
55
|
-
* a precompiled `WebAssembly.Module`.
|
|
56
|
-
*
|
|
57
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
58
|
-
*
|
|
59
|
-
* @returns {InitOutput}
|
|
60
|
-
*/
|
|
61
|
-
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
65
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
66
|
-
*
|
|
67
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
68
|
-
*
|
|
69
|
-
* @returns {Promise<InitOutput>}
|
|
70
|
-
*/
|
|
71
|
-
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
Binary file
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const cosine_similarity: (a: number, b: number, c: number, d: number) => number;
|
|
5
|
-
export const levenshtein_distance: (a: number, b: number, c: number, d: number) => number;
|
|
6
|
-
export const similarity_score: (a: number, b: number, c: number, d: number) => number;
|
|
7
|
-
export const approx_entropy: (a: number, b: number, c: number) => number;
|
|
8
|
-
export const fnv_hash: (a: number, b: number) => [number, number];
|
|
9
|
-
export const kolmogorov_complexity: (a: number, b: number) => number;
|
|
10
|
-
export const ks_test: (a: number, b: number) => number;
|
|
11
|
-
export const lz_complexity: (a: number, b: number) => number;
|
|
12
|
-
export const sample_ent: (a: number, b: number, c: number, d: number) => number;
|
|
13
|
-
export const shannon_entropy: (a: number, b: number) => number;
|
|
14
|
-
export const spectral: (a: number, b: number) => number;
|
|
15
|
-
export const murmur_hash: (a: number, b: number) => [number, number];
|
|
16
|
-
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
17
|
-
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
18
|
-
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
19
|
-
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
20
|
-
export const __wbindgen_start: () => void;
|
package/flake.nix
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
description = "A Nix-flake-based Rust development environment";
|
|
3
|
-
inputs = {
|
|
4
|
-
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs
|
|
5
|
-
fenix = {
|
|
6
|
-
url = "https://flakehub.com/f/nix-community/fenix/0.1";
|
|
7
|
-
inputs.nixpkgs.follows = "nixpkgs";
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
outputs = {self, ...} @ inputs: let
|
|
11
|
-
supportedSystems = [
|
|
12
|
-
"x86_64-linux"
|
|
13
|
-
"aarch64-linux"
|
|
14
|
-
"x86_64-darwin"
|
|
15
|
-
"aarch64-darwin"
|
|
16
|
-
];
|
|
17
|
-
forEachSupportedSystem = f:
|
|
18
|
-
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
|
19
|
-
system:
|
|
20
|
-
f {
|
|
21
|
-
pkgs = import inputs.nixpkgs {
|
|
22
|
-
inherit system;
|
|
23
|
-
overlays = [
|
|
24
|
-
inputs.self.overlays.default
|
|
25
|
-
];
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
in {
|
|
30
|
-
overlays.default = final: prev: {
|
|
31
|
-
rustToolchain = with inputs.fenix.packages.${prev.stdenv.hostPlatform.system};
|
|
32
|
-
combine (
|
|
33
|
-
with stable; [
|
|
34
|
-
clippy
|
|
35
|
-
rustc
|
|
36
|
-
cargo
|
|
37
|
-
rustfmt
|
|
38
|
-
rust-src
|
|
39
|
-
# Add WASM target
|
|
40
|
-
(targets.wasm32-unknown-unknown.stable.rust-std)
|
|
41
|
-
]
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
devShells = forEachSupportedSystem (
|
|
45
|
-
{pkgs}: {
|
|
46
|
-
default = pkgs.mkShellNoCC {
|
|
47
|
-
packages = with pkgs; [
|
|
48
|
-
rustToolchain
|
|
49
|
-
openssl
|
|
50
|
-
pkg-config
|
|
51
|
-
cargo-deny
|
|
52
|
-
cargo-edit
|
|
53
|
-
cargo-watch
|
|
54
|
-
rust-analyzer
|
|
55
|
-
wasm-pack
|
|
56
|
-
nodejs
|
|
57
|
-
pnpm
|
|
58
|
-
wasmtime
|
|
59
|
-
];
|
|
60
|
-
env = {
|
|
61
|
-
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
|
|
62
|
-
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER = "${pkgs.wasmtime}/bin/wasmtime";
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
}
|
package/scripts/patch-wasm.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync } from "fs";
|
|
2
|
-
|
|
3
|
-
const wasmFile = "dist/veil_core.js";
|
|
4
|
-
let content = readFileSync(wasmFile, "utf-8");
|
|
5
|
-
|
|
6
|
-
content = content.replace(
|
|
7
|
-
"module_or_path = new URL('veil_core_bg.wasm', import.meta.url);",
|
|
8
|
-
"module_or_path = new URL('veil_core_bg.wasm', import.meta.url).href;",
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
writeFileSync(wasmFile, content);
|
|
12
|
-
console.log("Patched veil_core.js for browser compatibility");
|
package/src/cpu.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
export async function runCPUBenchmark(): Promise<{
|
|
2
|
-
computeTime: number;
|
|
3
|
-
opsPerSecond: number;
|
|
4
|
-
memoryUsed: number;
|
|
5
|
-
}> {
|
|
6
|
-
const start = performance.now();
|
|
7
|
-
let operations = 0;
|
|
8
|
-
|
|
9
|
-
const primes: number[] = [];
|
|
10
|
-
for (let i = 2; i < 10000; i++) {
|
|
11
|
-
let isPrime = true;
|
|
12
|
-
for (let j = 2; j * j <= i; j++) {
|
|
13
|
-
if (i % j === 0) {
|
|
14
|
-
isPrime = false;
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (isPrime) {
|
|
19
|
-
primes.push(i);
|
|
20
|
-
operations++;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let fib = 0;
|
|
25
|
-
let a = 0;
|
|
26
|
-
let b = 1;
|
|
27
|
-
for (let i = 0; i < 30; i++) {
|
|
28
|
-
fib = a + b;
|
|
29
|
-
a = b;
|
|
30
|
-
b = fib;
|
|
31
|
-
operations++;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const arr = new Array(5000).fill(0).map((_, i) => Math.sin(i) * Math.cos(i));
|
|
35
|
-
arr.sort((x, y) => x - y);
|
|
36
|
-
operations += 5000;
|
|
37
|
-
|
|
38
|
-
for (let i = 0; i < 1000; i++) {
|
|
39
|
-
const sum = arr.reduce((a, b) => a + b, 0);
|
|
40
|
-
const mean = sum / arr.length;
|
|
41
|
-
operations++;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const computeTime = performance.now() - start;
|
|
45
|
-
const opsPerSecond = (operations / computeTime) * 1000;
|
|
46
|
-
const memoryUsed = primes.length + arr.length;
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
computeTime,
|
|
50
|
-
opsPerSecond,
|
|
51
|
-
memoryUsed,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export async function getCPUHash(): Promise<string> {
|
|
56
|
-
const benchmark = await runCPUBenchmark();
|
|
57
|
-
const data = `${benchmark.computeTime}${benchmark.opsPerSecond}${benchmark.memoryUsed}`;
|
|
58
|
-
|
|
59
|
-
let hash = 0;
|
|
60
|
-
for (let i = 0; i < data.length; i++) {
|
|
61
|
-
const char = data.charCodeAt(i);
|
|
62
|
-
hash = ((hash << 5) - hash) + char;
|
|
63
|
-
hash = hash & hash;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return Math.abs(hash).toString(16);
|
|
67
|
-
}
|
package/src/entropy/adblock.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
async function detectAdblock(): Promise<boolean> {
|
|
2
|
-
try {
|
|
3
|
-
const response = await fetch("https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js", {
|
|
4
|
-
method: "HEAD",
|
|
5
|
-
mode: "no-cors",
|
|
6
|
-
});
|
|
7
|
-
return false;
|
|
8
|
-
} catch {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function getAdblockEntropy(): Promise<string> {
|
|
14
|
-
const adblockPresent = await detectAdblock();
|
|
15
|
-
return `adblock:${adblockPresent}`;
|
|
16
|
-
}
|