Skip to content

Instantly share code, notes, and snippets.

@sovzzz
Created March 7, 2026 21:49
Show Gist options
  • Select an option

  • Save sovzzz/34ec4588c782dbf068466f9fdcaa0f0f to your computer and use it in GitHub Desktop.

Select an option

Save sovzzz/34ec4588c782dbf068466f9fdcaa0f0f to your computer and use it in GitHub Desktop.
proxifier keygen web tool
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Proxifier Key 生成器 (Web版)</title>
<style>
:root {
--primary-color: #007bff;
--bg-color: #f4f6f9;
--card-bg: #ffffff;
--text-color: #333;
--border-color: #ddd;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
}
.container {
background-color: var(--card-bg);
padding: 2rem;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 500px;
text-align: center;
}
h1 {
margin-bottom: 1.5rem;
font-size: 1.5rem;
color: var(--primary-color);
}
.form-group {
margin-bottom: 1.5rem;
text-align: left;
}
label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
font-size: 0.9rem;
}
select {
width: 100%;
padding: 10px;
border: 1px solid var(--border-color);
border-radius: 6px;
font-size: 1rem;
background-color: #fff;
cursor: pointer;
}
button {
width: 100%;
padding: 12px;
background-color: var(--primary-color);
color: white;
border: none;
border-radius: 6px;
font-size: 1rem;
font-weight: bold;
cursor: pointer;
transition: background-color 0.2s;
}
button:hover {
background-color: #0056b3;
}
.result-box {
margin-top: 2rem;
padding: 1rem;
background-color: #e9ecef;
border-radius: 6px;
border: 1px dashed var(--border-color);
position: relative;
}
.key-output {
font-family: 'Courier New', Courier, monospace;
font-size: 1.2rem;
font-weight: bold;
color: #2c3e50;
word-break: break-all;
margin-bottom: 0.5rem;
}
.copy-btn {
background-color: transparent;
color: var(--primary-color);
border: 1px solid var(--primary-color);
padding: 5px 10px;
font-size: 0.8rem;
width: auto;
margin-top: 5px;
}
.copy-btn:hover {
background-color: #eef6ff;
}
.note {
margin-top: 1.5rem;
font-size: 0.8rem;
color: #666;
text-align: left;
background: #fff3cd;
padding: 10px;
border-radius: 4px;
border-left: 4px solid #ffc107;
}
</style>
</head>
<body>
<div class="container">
<h1>Proxifier Key 生成器</h1>
<div class="form-group">
<label for="versionSelect">选择版本:</label>
<select id="versionSelect">
<option value="setup">Setup (安装版)</option>
<option value="portable">Portable (便携版)</option>
<option value="mac">Mac 版</option>
</select>
</div>
<button onclick="generateKey()">生成 Key</button>
<div class="result-box" id="resultBox" style="display:none;">
<div>生成的注册码:</div>
<div class="key-output" id="keyOutput"></div>
<button class="copy-btn" onclick="copyKey()">复制注册码</button>
</div>
<div class="note">
<strong>说明:</strong> 此网页工具完全于浏览器前端运行,可保存到本地脱机使用。
<br>注意:此代码仅供学习研究算法逻辑使用。
</div>
</div>
<script>
// 字符表定义
const CHARACTER_TABLE = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXZY';
// 辅助函数:模拟 Python 的 handle 函数
function handle(s) {
let res = 0n; // 使用 BigInt 防止溢出
for (let i = s.length - 1; i >= 0; i--) {
res <<= 5n;
const charCode = s.charCodeAt(i);
const char = s[i];
if (char === 'W') {
continue;
} else if (char === 'X') {
res += 24n;
} else if (char === 'Y') {
res += 1n;
} else if (char === 'Z') {
res += 18n;
} else if (char >= '0' && char <= '9') {
res += BigInt(charCode - 48);
} else {
res += BigInt(charCode - 55);
}
}
return res;
}
// 辅助函数:模拟 Python 的 handle_re 函数
function handle_re(num, len) {
let res = '';
let n = BigInt(num);
for (let i = 0; i < len; i++) {
const t = Number(n % 32n);
n /= 32n;
if (t === 0) res += 'W';
else if (t === 24) res += 'X';
else if (t === 1) res += 'Y';
else if (t === 18) res += 'Z';
else if (t <= 9) res += String.fromCharCode(t + 48);
else res += String.fromCharCode(t + 55);
}
return res;
}
// 辅助函数:模拟 Python 的 CRC32_like 函数
// 注意:JS 中的位运算通常处理 32 位有符号整数,这里需要仔细处理无符号逻辑
function CRC32_like(n) {
// n 可能是 BigInt,需要转为 Number 进行位运算,或者全程用 BigInt 模拟
// 由于原逻辑涉及大量位移和异或,且结果限制在 0xffffffff 内,使用 Number 配合 >>> 0 更安全
let res = 0;
let val = Number(n);
// 确保输入是安全的 32 位无符号整数范围逻辑,虽然输入可能很大,但循环内只取低8位
// 原 python 代码: v2 = ((n >> (8 * i)) & 0xff) << 24
// 如果 n 超过 JS Number 的安全整数范围 (2^53),直接转 Number 会丢失精度。
// 但观察逻辑,i 从 0 到 11,意味着 n 可能高达 96 位 (12 bytes)。
// 必须使用 BigInt 来处理输入 n,但在内部计算 res 时保持 32 位逻辑。
let bigN = BigInt(n);
for (let i = 0; i < 12; i++) {
// v2 = ((n >> (8 * i)) & 0xff) << 24
let byteVal = Number((bigN >> BigInt(8 * i)) & 0xFFn);
let v2 = (byteVal << 24) >>> 0; // 强制无符号 32 位
if (i > 0) {
res ^= v2;
} else {
res = (~v2) >>> 0;
}
for (let j = 0; j < 8; j++) {
// res *= 2
// JS 中左移一位等同于乘2,但要注意符号位
// 原逻辑: res *= 2; if res >= 0xffffffff ...
// 我们用位运算模拟:res <<= 1
let carry = (res & 0x80000000) ? 1 : 0;
res = (res << 1) >>> 0;
if (carry) {
res ^= 0x4C11DB7;
}
}
}
return res >>> 0;
}
// 主生成函数
function generateKey() {
const version = document.getElementById('versionSelect').value;
let product = 0;
if (version === 'setup') product = 0;
else if (version === 'portable') product = 1;
else if (version === 'mac') product = 2;
// 随机生成 key_4th (5个字符)
let key_4th = '';
for (let i = 0; i < 5; i++) {
const idx = Math.floor(Math.random() * CHARACTER_TABLE.length);
key_4th += CHARACTER_TABLE[idx];
}
// low_4B 计算
// random.randint(0x2580, 0xFFFF)
const lowRandom = Math.floor(Math.random() * (0xFFFF - 0x2580 + 1)) + 0x2580;
// product << 21
const low_4B = (lowRandom + (product << 21)) >>> 0;
// mid_4B 计算
const mid_4B = Math.floor(Math.random() * 0x10000); // 0 to 0xFFFF
// high_4B 计算
const high_4B = handle(key_4th);
// 构造大整数用于 CRC: (high_4B << 64) + (mid_4B << 32) + low_4B
// 注意:high_4B 来自 handle 返回的是 BigInt
const crcInput = (high_4B << 64n) + (BigInt(mid_4B) << 32n) + BigInt(low_4B);
const res = CRC32_like(crcInput);
const v17 = res & 0x1FFFFFF;
// v18 = v17 ^ (v17 << 7)
// 注意位移后可能超出 32 位,但在 JS 中 ^ 运算会自动处理,我们需要确保逻辑一致
// Python 中大整数自动扩展,JS 中数字是 64 位浮点,位运算转 32 位有符号。
// v17 最大 0x1FFFFFF (29 bits), << 7 后是 36 bits。
// 在 Python 中这是大整数运算。在 JS 中我们需要用 BigInt 或者小心处理。
// 既然 v17 只有 29 位,v17 << 7 不会溢出 JS 的安全整数范围 (2^53),可以直接用 Number 运算,
// 但为了严谨匹配 Python 的大整数行为,这里用 BigInt 计算 v18,后面转回 Number 给 handle_re
const v17_big = BigInt(v17);
const v18_big = v17_big ^ (v17_big << 7n);
const v18 = Number(v18_big);
const key_5th = handle_re(v17, 5);
// key_0_7_ch
const val1 = BigInt(low_4B) ^ 0x12345678n ^ v18_big;
const key_0_7_ch = handle_re(val1, 7);
// key_7_14_ch
const val2 = BigInt(mid_4B) ^ 0x87654321n ^ v18_big;
const key_7_14_ch = handle_re(val2, 7);
// 组装 Key
// 第三位随机,不能为 'Y' (索引 26? 检查字符表: 0-9(10), A-X(14), Z, Y.
// 字符表: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXZY
// 长度 36.
// 原代码: character_table[random.randint(0, 34)] -> 排除最后一个字符?
// 字符表最后两个是 Z, Y. 索引 34 是 Z, 35 是 Y.
// 原代码 randint(0, 34) 包含 34,不包含 35。所以确实排除了 'Y'。
let randomCharIndex = Math.floor(Math.random() * 35); // 0 to 34
let randomChar = CHARACTER_TABLE[randomCharIndex];
let key = '';
// key += key_0_7_ch[:2] + randomChar + key_0_7_ch[3:5]
key += key_0_7_ch.substring(0, 2);
key += randomChar;
key += key_0_7_ch.substring(3, 5); // JS substring end is exclusive
key += '-';
// key += key_0_7_ch[5:7] + key_7_14_ch[:3]
key += key_0_7_ch.substring(5, 7);
key += key_7_14_ch.substring(0, 3);
key += '-';
// key += key_7_14_ch[3:7] + key_0_7_ch[2]
key += key_7_14_ch.substring(3, 7);
key += key_0_7_ch.substring(2, 3);
key += '-';
key += key_4th;
key += '-';
key += key_5th;
// 显示结果
const outputDiv = document.getElementById('keyOutput');
const resultBox = document.getElementById('resultBox');
outputDiv.textContent = key;
resultBox.style.display = 'block';
}
function copyKey() {
const keyText = document.getElementById('keyOutput').textContent;
navigator.clipboard.writeText(keyText).then(() => {
alert('注册码已复制到剪贴板!');
}).catch(err => {
console.error('复制失败:', err);
// 降级方案
const textarea = document.createElement('textarea');
textarea.value = keyText;
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
alert('注册码已复制到剪贴板!');
});
}
</script>
</body>
</html>
@sovzzz
Copy link
Author

sovzzz commented Mar 7, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment