Spaces:
Running
Running
KeyGuard i18n(KO/EN/ZH) + browser auto-detect + expanded explanation
Browse filesFiles changed (3)
- README.md+1-4
- del_openfree.pyAdded+13
- index.html+41-133
26 unmodified lines2728293031323334353626 unmodified lines| 📏 **Short / weak keys** | ≤768-bit factorable, <2048 replace, bad exponent |## Privacy / 개인정보- **Self-check (paste or open a file):** 100% client-side. No key is stored or sent to any server.- **Address check:** [KeyGuard API](https://huggingface.co/spaces/FINAL-Bench/KeyGuard-API) connects to port 443 of the address you enter and returns its public certificate. The verdict is computed in your browser. Addresses and results are not stored.- **Local collector:** `local/keyguard-local.ps1` (Windows) and `local/keyguard-local.py` (macOS, Linux) collect public keys inside your own private network into one file. No login attempts, no upload.- Recovered private keys are never shown. Only the fact that a key is recoverable is shown.- Use only on devices you own or are authorized to test. Follows Responsible Disclosure.## Verified / 검증26 unmodified lines2728293031323326 unmodified lines| 📏 **Short / weak keys** | ≤768-bit factorable, <2048 replace, bad exponent |## Privacy / 개인정보- 100% client-side. No key is stored or sent to any server. Recovered private keys are never shown — only the fact that a key is recoverable.- Use only on devices you own or are authorized to test. Follows Responsible Disclosure.## Verified / 검증
12345678910111213import os, refrom huggingface_hub import HfApitok=Nonefor line in open(os.path.expanduser("~/.config/spark-secrets/tokens.env")): m=re.match(r'\s*VIDRAFT_HF_TOKEN\s*=\s*(.+?)\s*$', line) if m: tok=m.group(1).strip().strip('"').strip("'"); breakassert tokapi=HfApi(token=tok)try: api.delete_repo(repo_id="openfree/KeyGuard", repo_type="space", token=tok) print("DELETED openfree/KeyGuard")except Exception as e: print("delete err:", str(e)[:120])137 unmodified lines13813914014114214314414514614714814915015115215315415515615715815916040 unmodified lines20120220320420520620721 unmodified lines22923023123223323423526 unmodified lines26226326426526626726810 unmodified lines27928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631721 unmodified lines33934034134234334434521 unmodified lines3673683693703713723733741 unmodified line37637737837938038138213 unmodified lines3963973983994004014024034044054 unmodified lines41041141241341441541641741841921 unmodified lines4414424434444454464474481 unmodified line45045145245345445545613 unmodified lines4704714724734744754764774784794 unmodified lines48448548648748848949049149249321 unmodified lines5155165175185195205215221 unmodified line52452552652752852953013 unmodified lines5445455465475485495505515525534 unmodified lines5585595605615625635644 unmodified lines56957057157257357457518 unmodified lines59459559659759859960060160260360460560660760821 unmodified lines6306316326336346356366376386396406416426436446456466476486496506516526538 unmodified lines66266366466566666766866967014 unmodified lines685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733137 unmodified lines.warnbox{padding:16px 18px;border-radius:14px;border:1px solid var(--warn);background:rgba(251,191,36,.06);font-size:13px;color:var(--muted);margin-top:16px}footer{margin:56px 0 40px;padding-top:26px;border-top:1px solid var(--panel-br);font-size:12.5px;color:var(--faint);text-align:center}/* tabs */.p443{margin:8px 0 0;padding-left:20px;color:var(--muted);font-size:14px;line-height:1.7}.p443 .w{color:var(--warn);font-weight:600}a.secbtn{display:inline-block;text-decoration:none}a.sl{font-size:13px;color:var(--accent2)}.addrguide .hs{overflow-wrap:anywhere;font-family:var(--mono);font-size:11px}.addrguide summary{cursor:pointer;font-size:13.5px;color:var(--muted)}.addrguide p{font-size:13.5px;color:var(--muted);margin:10px 0}.addrguide .gl{font-size:12px;color:var(--faint);margin:10px 0 4px}textarea.cmd{min-height:0;font-size:12px;padding:10px 12px;word-break:break-all}.addrguide .secbtn{padding:9px 14px;margin-top:6px}#addrmsg{color:var(--ink);font-size:14px}.addrin{flex:1;min-width:220px;background:rgba(0,0,0,.22);border:1px solid var(--panel-br);border-radius:14px;color:var(--ink);font-family:var(--mono);font-size:16px;padding:14px 15px;outline:none}:root:not([data-theme="dark"]) .addrin{background:#fff}.addrin:focus{border-color:var(--accent);box-shadow:0 0 0 4px rgba(124,108,255,.15)}.addrrow{display:flex;gap:10px;flex-wrap:wrap;align-items:baseline;border-top:1px solid var(--panel-br);padding:10px 2px;font-size:13px;color:var(--muted);overflow-wrap:anywhere}.addrrow b{color:var(--ink);font-family:var(--mono)}.tabs{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin:6px 0 2px}.tabs button{border:1px solid var(--panel-br);background:var(--panel);color:var(--muted);font-family:inherit;font-size:14px;font-weight:600;padding:11px 20px;border-radius:12px;cursor:pointer;transition:.18s}.tabs button.on{background:var(--grad);color:#0a0b14;border-color:transparent;box-shadow:0 8px 22px rgba(124,108,255,.3)}/* leaderboard */40 unmodified lines<p class="sub" data-i18n="sub"></p></header><div class="tabs"><button id="tabCheck" class="on" data-i18n="tab_check"></button><button id="tabAddr" data-i18n="tab_addr"></button><button id="tabBench" data-i18n="tab_bench"></button></div><div id="tab-check"><!-- ABOUT / 설명 -->21 unmodified lines<label class="ck"><input type="checkbox" id="consent"><span data-i18n="chk_consent"></span></label><div class="row"><button class="run" id="runbtn" data-i18n="chk_run"></button><button class="secbtn" id="filebtn" data-i18n="lc_file"></button><input type="file" id="filein" accept=".txt,.pem,.crt,.cer,.pub,text/plain" multiple style="display:none"><button class="secbtn" id="clearbtn" data-i18n="chk_clear"></button></div><div id="results"><div id="verdict"></div><div class="summary" id="summary"></div><div id="reslist"></div><div id="sharedbox"></div></div></div>26 unmodified lines<p class="lead" style="margin-left:0;text-align:left" data-i18n="proof_lead"></p><div class="proof"><div class="card pf"><div class="n">10/10</div><div class="l" data-i18n="proof_s1"></div></div><div class="card pf"><div class="n">353K</div><div class="l" data-i18n="proof_s2"></div></div><div class="card pf"><div class="n">0</div><div class="l" data-i18n="proof_s3"></div></div></div><div class="note" data-i18n="proof_note"></div>10 unmodified lines</section></div><!-- /tab-check --><div id="tab-addr" style="display:none"><div class="card checker" id="addrcard" style="margin-top:26px"><h2 data-i18n="ad_h"></h2><p class="hint" data-i18n="ad_hint"></p><div class="row" style="margin-top:0"><input id="addrin" class="addrin" type="text" inputmode="url" autocapitalize="off" autocomplete="off" spellcheck="false" maxlength="260" data-i18n-ph="ad_ph"><button class="secbtn" id="myipbtn" data-i18n="ad_my"></button></div><label class="ck"><input type="checkbox" id="consent2"><span data-i18n="ad_consent"></span></label><div class="row"><button class="run" id="addrbtn" data-i18n="ad_run"></button><button class="secbtn" id="addrclear" data-i18n="ad_clear"></button></div><div id="addrmsg" class="note" role="status" aria-live="polite" style="display:none"></div><div id="addrlist"></div><div id="addrres"></div></div><p class="note" data-i18n="ad_more"></p><div class="card checker" id="card443" style="margin-top:18px"><h2 data-i18n="lc_ph_h"></h2><ul class="p443"><li data-i18n="lc_p1"></li><li data-i18n="lc_p2"></li><li data-i18n="lc_p3"></li><li class="w" data-i18n="lc_p4"></li></ul></div><div class="card checker addrguide" id="guide" style="margin-top:18px"><h2 data-i18n="lc_lh"></h2><p>1. <span data-i18n="lc_l1"></span></p><div class="row"><a class="secbtn dl" href="local/keyguard-local.ps1" download="keyguard-local.ps1" data-i18n="lc_lw"></a><a class="sl" href="https://huggingface.co/spaces/FINAL-Bench/KeyGuard/blob/main/local/keyguard-local.ps1" target="_blank" rel="noopener" data-i18n="lc_src"></a></div><div class="gl"><span data-i18n="lc_run"></span> · PowerShell</div><textarea id="runwin" class="cmd" readonly rows="2">powershell -ExecutionPolicy Bypass -File .\keyguard-local.ps1</textarea><button class="secbtn cp" data-for="runwin" data-i18n="gd_copy"></button><div class="gl hs">SHA-256 1ff1c56b911ce23613a0c31130e0ddb4dae9ede0d98ae7b3296c19c7c23c0599</div><div class="row"><a class="secbtn dl" href="local/keyguard-local.py" download="keyguard-local.py" data-i18n="lc_lp"></a><a class="sl" href="https://huggingface.co/spaces/FINAL-Bench/KeyGuard/blob/main/local/keyguard-local.py" target="_blank" rel="noopener" data-i18n="lc_src"></a></div><div class="gl"><span data-i18n="lc_run"></span> · Terminal</div><textarea id="runnix" class="cmd" readonly rows="2">python3 keyguard-local.py</textarea><button class="secbtn cp" data-for="runnix" data-i18n="gd_copy"></button><div class="gl hs">SHA-256 3c280717a88d8da11f1841e57bd975df27b8da9d55610482bb7d26d498ed00b2</div><p>2. <span data-i18n="lc_l2"></span></p><button class="secbtn" id="gogo" data-i18n="gd_go"></button><details style="margin-top:16px"><summary data-i18n="lc_one"></summary><p data-i18n="gd_s1"></p><div class="gl">Windows PowerShell</div><textarea id="cmdwin" class="cmd" readonly rows="5"></textarea><button class="secbtn cp" data-for="cmdwin" data-i18n="gd_copy"></button><div class="gl">macOS · Linux</div><textarea id="cmdnix" class="cmd" readonly rows="2"></textarea><button class="secbtn cp" data-for="cmdnix" data-i18n="gd_copy"></button></details><p class="note" data-i18n="lc_auth"></p></div></div><!-- /tab-addr --><div id="tab-bench" style="display:none"><section class="block" style="margin-top:26px"><div class="eyebrow" data-i18n="lb_eye"></div>21 unmodified lines/* ================= i18n ================= */const I18N={ko:{tag:"붙여넣은 키는 100% 브라우저 안에서 검사 · 서버로 전송되지 않습니다",h1a:"내 장비 암호키,", h1b:"혹시 불량품 아닐까?",lead:"공장에서 실수로 여러 장비에 똑같은 비밀 소수를 넣어 출고하면, 누군가 그걸 찾는 순간 그 장비들은 전부 열립니다. KeyGuard는 당신의 공개키가 그런 불량 키인지 수학으로 30초 만에 검사합니다.",sub:"개인키 말고 공개키만 넣으세요. 공개키는 원래 공개되는 정보라 안전합니다.",21 unmodified linesw3h:"소수 공유 (batch-GCD)", w3d:"여러 장비가 같은 소수를 쓰면 최대공약수 한 번에 둘 다 열립니다.",w4h:"ROCA 결함칩", w4d:"특정 칩(CVE-2017-15361)이 만든 취약 패턴 키를 의심 탐지합니다.",proof_eye:"검증됨", proof_h:"실제 대규모 공개키로 검증 완료",proof_lead:"합성 취약 키를 정확히 탐지하고, 실제 인증서 투명성(CT) 로그의 공개키 35만 개로 대규모 동작을 확인했습니다.",proof_s1:"심은 취약 키 탐지 정확도 (오탐 0)", proof_s2:"실제 CT 공개키 분석 (스파크)", proof_s3:"붙여넣은 키의 서버 전송 (전부 클라이언트)",proof_note:"참고: 공개 CT 로그의 웹 인증서는 대체로 잘 생성되어 취약 키가 드뭅니다. 취약 키는 주로 임베디드·IoT의 자가서명 인증서에 분포 — 그래서 '내 장비를 직접 검사'하는 이 도구가 의미가 있습니다.",faq_eye:"자주 묻는 질문", faq_h:"궁금한 것들",faq1q:"제 개인키가 유출되나요?", faq1a:"아니요. 공개키만 넣고, 그마저도 브라우저 밖으로 나가지 않습니다.",1 unmodified linefaq3q:"여러 장비를 한꺼번에 넣어도 되나요?", faq3a:"네, 권장합니다. 장비들끼리 소수를 공유하는지는 여러 키를 함께 넣어야 검사됩니다.",faq4q:"안전으로 나오면 100% 안심인가요?", faq4a:"이 도구가 검사하는 4가지 결함이 없다는 뜻입니다. 암호의 다른 측면은 별도 점검이 필요합니다.",faq_warn:"⚠️ 이 도구는 본인 소유 또는 점검 위임을 ���은 장비의 공개키에만 사용하세요. 타인의 장비·시스템을 무단으로 검사·침투하는 것은 법으로 금지되어 있습니다.",foot1:"KeyGuard · 공개키 자가진단 · 붙여넣기 검사는 브라우저 안에서만 실행됩니다",foot2:"교육 및 본인 자산 점검용 · 책임 있는 보안 점검(Responsible Disclosure) 원칙 준수",b_safe:"안전", b_weak:"주의", b_bad:"위험",s_tot:"검사한 키", s_safe:"안전", s_warn:"주의", s_bad:"위험",13 unmodified linesal_consent:"본인 소유/위임 장비 확인에 체크해 주세요.", al_nokey:"유효한 RSA 공개키를 찾지 못했습니다. 형식을 확인해 주세요.",busy:"검사 중…",cr_label:"복원된 소인수 (이 키는 이미 깨진 키)", cr_time:"복원 시간", cr_iter:"Fermat 반복", cr_via:"복원 경로", cr_note:"공개 모듈러스만으로 누구나 복원 가능 → 즉시 폐기 필요",vd_bad:(n)=>`위험한 키 ${n}개`, vd_bad_sub:"길이 또는 지수가 위험합니다. 키를 교체하세요.", vd_cracked:(n)=>`${n}개 키 뚫림 — CRACKED`, vd_cracked_sub:"개인키가 복원됐습니다. 해당 키는 즉시 폐기·교체하세요.",vd_weak:(n)=>`${n}개 키 주의 필요`, vd_weak_sub:"지금 당장 뚫리진 않지만 교체를 권장합니다.",vd_safe:"모두 안전", vd_safe_sub:"이 도구가 검사하는 4대 결함이 없습니다.",tab_check:"🔎 자가진단", tab_bench:"🏆 벤치마크", tab_addr:"🌐 주소로 점검", lc_ph_h:"🚪 443 포트 안내", lc_p1:"443은 HTTPS(보안 웹 접속)가 드나드는 문입니다. 이 점검은 인터넷 쪽에서 그 문이 열린 기기만 볼 수 있습니다.", lc_p2:"집·사무실 공유기나 통신사는 보통 이 문을 닫아 둡니다. 그래서 「내 IP」는 응답 없음이 흔하며, 고장이 아닙니다.", lc_p3:"응답 없음은 열쇠를 보지 못했다는 뜻이고 안전 판정이 아닙니다. 안쪽 기기는 아래 방법으로 점검하십시오.", lc_p4:"점검하려고 공유기의 443 포트를 일부러 열지 마십시오. 닫혀 있는 편이 안전합니다.", lc_lh:"🏠 내 네트워크 점검기 (집·회사 안의 기기)", lc_l1:"스크립트를 내려받아 실행합니다. 내 PC가 속한 사설 네트워크에서 공개키만 모아 파일 하나로 저장합니다. 로그인 시도와 인터넷 전송은 없습니다.", lc_l2:"자가진단 탭의 「파일 열기」로 그 파일을 넣습니다. 판정은 브라우저 안에서 하고, 기기끼리 같은 소수를 쓰는지도 비교합니다.", lc_lw:"내려받기: Windows", lc_lp:"내려받기: macOS · Linux (Python 3)", lc_src:"코드 보기", lc_run:"실행", lc_one:"기기 한 대만 빠르게", lc_auth:"본인 소유이거나 점검 권한이 있는 네트워크에서만 사용하십시오.", lc_file:"📂 파일 열기", gd_h:"🏠 집·회사 안의 기기는 이렇게 점검합니다", gd_s1:"같은 네트워크의 PC에서 아래 명령을 실행합니다. 주소는 점검할 기기(공유기, CCTV, 프린터)로 바꾸십시오.", gd_s2:"출력된 인증서를 자가진단 탭에 붙여넣습니다. 여러 기기를 함께 넣으면 서로 비교합니다. 붙여넣은 내용은 브라우저 밖으로 나가지 않습니다.", gd_copy:"복사", gd_copied:"복사됨", gd_go:"자가진단 탭으로", ad_h:"🌐 도메인·IP로 점검", ad_hint:"점검 서버가 입력한 주소의 443 포트(HTTPS)에만 접속해 공개 인증서를 받아 옵니다. 판정은 이 브라우저에서 합니다. 주소와 결과는 저장하지 않습니다.", ad_ph:"예) example.com 또는 203.0.113.10", ad_my:"📍 내 IP 넣기", ad_consent:"이 주소의 기기는 내가 소유했거나 점검 위임을 받은 기기입니다. 타인의 기기를 무단으로 점검하지 않습니다.", ad_run:"주소 점검", ad_clear:"목록 비우기", ad_more:"기기를 하나씩 더 점검하면 목록에 쌓이고, 같은 소수를 쓰는지 서로 비교합니다. 사설 IP(192.168.x.x 등)는 인터넷에서 닿지 않으므로 자가진단 탭에 인증서를 붙여넣으십시오.", ad_self:"자체 서명", ad_exp:"만료", ad_issuer:"발급", ad_got:"내 접속 IP를 넣었습니다. 위임 확인에 체크하고 점검을 누르십시오.", ad_ec:"타원곡선 키를 쓰는 기기입니다. RSA 점검 대상이 아닙니다.", ad_other:"RSA 키가 아닙니다. 점검 대상이 아닙니다.", ad_noaddr:"주소를 입력해 주세요.", ad_err:{"bad_target": "주소 형식을 확인해 주세요. 도메인이나 IP 하나만 넣을 수 있고 포트와 경로는 받지 않습니다.", "private_target": "내부 주소는 인터넷에서 닿지 않습니다. 아래 방법으로 이 PC에서 점검하십시오.", "dns": "주���를 찾지 못했습니다.", "connect": "443 포트가 닫혀 있습니다. 인터넷 쪽에서 이 기기의 열쇠를 볼 수 없다는 뜻이며 안전 판정은 아닙니다.", "timeout": "밖에서 보이지 않는 기기입니다(443 응답 없음). 고장이 아니며, 인터넷 쪽에서 이 기기의 열쇠를 볼 수 없다는 뜻입니다. 안전 판정은 아닙니다.", "tls": "TLS 연결을 맺지 못했습니다.", "rate": "요청이 많습니다. 잠시 뒤 다시 해 주세요.", "consent": "위임 확인에 체크해 주세요.", "server": "점검 서버를 깨우는 중입니다. 1분쯤 뒤에 다시 눌러 주세요.", "nomyip": "접속 IP를 확인하지 못했습니다."},lb_eye:"스파크 실측 · 조작 없음", lb_h:"취약키 탐지 벤치마크",lb_lead:"표준 취약키 테스트셋에서 탐지 방법들의 재현율·오탐률·속도를 실측해 순위. 단일 방법은 일부만, 결합한 KeyGuard는 전 유형을 잡습니다.",th_det:"탐지기", th_recall:"재현율", th_fpr:"오탐", th_time:"시간", th_cat:"유형별",4 unmodified lineslb_m3h:"재현 가능", lb_m3d:"고정 시드(20262025) — 언제든 동일 재현, 조작 불가",lb_notes:["ROCA는 본 셋에 합성 양성이 없어 0%(완전성 위해 포함).","고전 분해는 2048비트 불가로 0%(반복 상한 내 측정).","소규모 자체셋 — 숫자는 측정값만, 과장 없음."],catlabel:{close:"가까운소수",shared:"소수공유",short:"짧은키",bade:"지수"}, me_tag:"우리",sample:{fermat:["🤏 가까운 소수","두 소수가 너무 가까운 2048비트 키 — Fermat로 즉시 분해"],shared:["🔗 소수 공유 (2대)","두 장비가 같은 소수 사용 — batch-GCD로 양쪽 다 뚫림"],short:["📏 너무 짧은 키","512비트 — 현재 분해 가능 범위"],bade:["⚠️ 비정상 지수","공개지수 e=2 (잘못된 설정)"],safe:["✓ 정상 키","잘 생성된 2048비트 실제 인증서 키 — 안전"],mix:["🎯 전부 섞기","위 모든 유형을 한 번에 — 종합 리포트"]}},en:{tag:"Pasted keys are checked 100% in your browser · never sent to a server",h1a:"Your device's crypto key —", h1b:"is it a factory defect?",lead:"If a factory mistakenly ships many devices with the same secret prime, anyone who finds it can open them all. KeyGuard checks, with math in 30 seconds, whether your public key is one of those defective keys.",sub:"Paste the PUBLIC key only, never the private key. Public keys are meant to be public, so this is safe.",21 unmodified linesw3h:"Shared primes (batch-GCD)", w3d:"If devices share a prime, one GCD opens both.",w4h:"ROCA faulty chips", w4d:"Detects vulnerable keys from certain chips (CVE-2017-15361).",proof_eye:"Verified", proof_h:"Validated on real large-scale public keys",proof_lead:"Detects planted weak keys exactly, and verified at scale on 350K+ real public keys from Certificate Transparency (CT) logs.",proof_s1:"Detection accuracy on planted weak keys (0 false positives)", proof_s2:"Real CT public keys analyzed (on Spark)", proof_s3:"Pasted keys sent to a server (all client-side)",proof_note:"Note: Web certificates in public CT logs are usually well-generated, so weak keys are rare there. Weak keys mostly live in self-signed certs of embedded/IoT devices — which is why checking YOUR OWN devices with this tool matters.",faq_eye:"FAQ", faq_h:"Common questions",faq1q:"Will my private key leak?", faq1a:"No. You paste only the public key, and even that never leaves your browser.",1 unmodified linefaq3q:"Can I paste many devices at once?", faq3a:"Yes, recommended. Shared-prime checks require several keys pasted together.",faq4q:"If it says Safe, am I 100% safe?", faq4a:"It means the four defects this tool checks are absent. Other aspects of your crypto need separate review.",faq_warn:"⚠️ Use this tool only on public keys of devices you own or are authorized to test. Testing or intruding on others' systems without permission is illegal.",foot1:"KeyGuard · public-key self-check · pasted keys are checked only inside your browser",foot2:"For education and checking your own assets · follows Responsible Disclosure",b_safe:"Safe", b_weak:"Caution", b_bad:"Danger",s_tot:"Keys checked", s_safe:"Safe", s_warn:"Caution", s_bad:"Danger",13 unmodified linesal_consent:"Please check the ownership/authorization box.", al_nokey:"No valid RSA public key found. Please check the format.",busy:"Checking…",cr_label:"Recovered primes (this key is already broken)", cr_time:"Recovered in", cr_iter:"Fermat iters", cr_via:"Recovered via", cr_note:"anyone can recover these from the public modulus → retire this key now",vd_bad:(n)=>`${n} KEY${n>1?'S':''} AT HIGH RISK`, vd_bad_sub:"Dangerous length or exponent. Replace these keys.", vd_cracked:(n)=>`${n} KEY${n>1?'S':''} CRACKED`, vd_cracked_sub:"The private key was recovered. Retire and replace these keys immediately.",vd_weak:(n)=>`${n} key(s) need attention`, vd_weak_sub:"Not breakable right now, but replacement is recommended.",vd_safe:"All safe", vd_safe_sub:"None of the four defects this tool checks were found.",tab_check:"🔎 Self-check", tab_bench:"🏆 Benchmark", tab_addr:"🌐 Check an address", lc_ph_h:"🚪 About port 443", lc_p1:"443 is the door used by HTTPS. This check can only see devices whose door is open to the internet.", lc_p2:"Home and office routers or carriers usually keep it closed, so no response for your own IP is common. It is not a fault.", lc_p3:"No response means the key was not seen. It is not a Safe verdict. Check devices inside your network as shown below.", lc_p4:"Do not open port 443 on your router just for this check. Closed is safer.", lc_lh:"🏠 Local collector (devices inside your home or office)", lc_l1:"Download and run the script. It collects public keys only, from the private network of this PC, into one file. No login attempts and no internet traffic.", lc_l2:"Load the file with Open file in the Self-check tab. The verdict is computed in your browser, and devices are compared with each other for shared primes.", lc_lw:"Download for Windows", lc_lp:"Download for macOS · Linux (Python 3)", lc_src:"View code", lc_run:"Run", lc_one:"Quick check of a single device", lc_auth:"Use it only on networks you own or are authorized to test.", lc_file:"📂 Open file", gd_h:"🏠 Check a device inside your home or office", gd_s1:"Run this command on a PC in the same network. Replace the address with your router, camera or printer.", gd_s2:"Paste the printed certificate into the Self-check tab. Paste several devices together to compare them. Pasted text never leaves your browser.", gd_copy:"Copy", gd_copied:"Copied", gd_go:"Go to Self-check", ad_h:"🌐 Check a domain or IP", ad_hint:"Our server connects only to port 443 (HTTPS) of the address and fetches its public certificate. The verdict is computed in this browser. Addresses and results are not stored.", ad_ph:"e.g. example.com or 203.0.113.10", ad_my:"📍 Use my IP", ad_consent:"The device at this address is mine or I am authorized to test it. I will not test anyone else's device without permission.", ad_run:"Check address", ad_clear:"Clear list", ad_more:"Check more devices one by one. They are added to the list and compared with each other for shared primes. Private addresses (192.168.x.x and similar) cannot be reached from the internet, so paste their certificates in the Self-check tab.", ad_self:"self-signed", ad_exp:"expires", ad_issuer:"issuer", ad_got:"Your access IP is filled in. Tick the authorization box and run the check.", ad_ec:"This device uses an elliptic-curve key, so the RSA checks do not apply.", ad_other:"This is not an RSA key, so the RSA checks do not apply.", ad_noaddr:"Please enter an address.", ad_err:{"bad_target": "Check the address. Enter one domain or IP, with no port or path.", "private_target": "Private addresses cannot be reached from the internet. Check the device from this PC as shown below.", "dns": "The address could not be resolved.", "connect": "Port 443 is closed. The key of this device cannot be seen from the internet. This is not a Safe verdict.", "timeout": "This device is not visible from the internet (no response on port 443). It is not a fault. Its key cannot be seen from outside. This is not a Safe verdict.", "tls": "A TLS connection could not be established.", "rate": "Too many requests. Please try again shortly.", "consent": "Please tick the authorization box.", "server": "The check server is waking up. Please try again in about a minute.", "nomyip": "Your access IP could not be determined."},lb_eye:"Measured on Spark · no cherry-picking", lb_h:"Weak-Key Detection Benchmark",lb_lead:"Recall, false-positive rate and speed of detection methods on a standard weak-key set, ranked. Single methods catch only part; combined KeyGuard catches every type.",th_det:"Detector", th_recall:"Recall", th_fpr:"False-pos", th_time:"Time", th_cat:"Per-category",4 unmodified lineslb_m3h:"Reproducible", lb_m3d:"Fixed seed (20262025) — reproduces the set anytime, no tampering",lb_notes:["ROCA shows 0% (no synthetic ROCA positives in this set; included for completeness).","Classical factoring is 0% (2048-bit infeasible; measured within an iteration cap).","Small self-generated set — numbers are measured values only, no exaggeration."],catlabel:{close:"Close",shared:"Shared",short:"Short",bade:"Exp"}, me_tag:"OURS",sample:{fermat:["🤏 Close primes","2048-bit key with primes too close — factored instantly by Fermat"],shared:["🔗 Shared prime (2 devices)","Two devices share a prime — both broken by batch-GCD"],short:["📏 Key too short","512-bit — within factorable range"],bade:["⚠️ Bad exponent","Public exponent e=2 (misconfigured)"],safe:["✓ Healthy key","A well-generated real 2048-bit certificate key — safe"],mix:["🎯 Mix everything","All types at once — full report"]}},zh:{tag:"粘贴的密钥 100% 在浏览器内检测 · 绝不发送到服务器",h1a:"你设备的加密密钥,", h1b:"会不会是次品?",lead:"如果工厂错误地给多台设备出厂了相同的秘密素数,任何人只要找到它就能打开所有这些设备。KeyGuard 用数学在 30 秒内检测你的公钥是否就是这种次品密钥。",sub:"只粘贴公钥,不要粘贴私钥。公钥本来就是公开的,所以这是安全的。",21 unmodified linesw3h:"素数共享 (batch-GCD)", w3d:"若设备共享素数,一次求最大公约数即可打开双方。",w4h:"ROCA 缺陷芯片", w4d:"检测某些芯片(CVE-2017-15361)生成的易受攻击密钥。",proof_eye:"已验证", proof_h:"已在真实大规模公钥上完成验证",proof_lead:"精确检出植入的弱密钥,并在证书透明度(CT)日志的 35 万+ 真实公钥上验证了大规模运行。",proof_s1:"对植入弱密钥的检出准确率(0 误报)", proof_s2:"分析的真实 CT 公钥(在 Spark 上)", proof_s3:"粘贴的密钥发送到服务器(全部在客户端)",proof_note:"注:公共 CT 日志中的网站证书通常生成良好,弱密钥很少见。弱密钥主要存在于嵌入式/IoT 设备的自签名证书中——这正是用本工具检测'你自己的设备'的意义所在。",faq_eye:"常见问题", faq_h:"你可能想问",faq1q:"我的私钥会泄露吗?", faq1a:"不会。你只粘贴公钥,而且它也不会离开你的浏览器。",1 unmodified linefaq3q:"可以一次粘贴多台设备吗?", faq3a:"可以,建议如此。素数共享检测需要同时粘贴多个密钥。",faq4q:"显示安全就 100% 放心吗?", faq4a:"意味着本工具检测的四种缺陷不存在。加密的其他方面需要单独审查。",faq_warn:"⚠️ 本工具仅可用于你拥有或已获授权检测的设备公钥。未经许可检测或入侵他人系统是违法的。",foot1:"KeyGuard · 公钥自检 · 粘贴检测仅在你的浏览器内运行",foot2:"用于教育及自有资产检测 · 遵循负责任披露(Responsible Disclosure)原则",b_safe:"安全", b_weak:"注意", b_bad:"危险",s_tot:"已检测密钥", s_safe:"安全", s_warn:"注意", s_bad:"危险",13 unmodified linesal_consent:"请勾选所有权/授权确认项。", al_nokey:"未找到有效的 RSA 公钥,请检查格式。",busy:"检测中…",cr_label:"已还原的素因子(此密钥已被攻破)", cr_time:"还原耗时", cr_iter:"Fermat 迭代", cr_via:"还原途径", cr_note:"仅凭公开模数任何人都能还原 → 请立即废弃此密钥",vd_bad:(n)=>`${n} 个高风险密钥`, vd_bad_sub:"长度或指数存在风险,请更换密钥。", vd_cracked:(n)=>`${n} 个密钥被攻破 — CRACKED`, vd_cracked_sub:"私钥已被还���。请立即废弃并更换这些密钥。",vd_weak:(n)=>`${n} 个密钥需注意`, vd_weak_sub:"目前不会被破解,但建议更换。",vd_safe:"全部安全", vd_safe_sub:"未发现本工具检测的四种缺陷。",tab_check:"🔎 自检", tab_bench:"🏆 基准", tab_addr:"🌐 按地址检测", lc_ph_h:"🚪 关于 443 端口", lc_p1:"443 是 HTTPS 使用的门。本检测只能看到向互联网开放此门的设备。", lc_p2:"家庭或办公室路由器和运营商通常会关闭它,因此「我的 IP」无响应很常见,这不是故障。", lc_p3:"无响应表示没有看到密钥,不是安全判定。内部设备请按下面的方法检测。", lc_p4:"请不要为了检测而在路由器上开放 443 端口。关闭更安全。", lc_lh:"🏠 本地采集器(家庭或公司内部的设备)", lc_l1:"下载并运行脚本。它只从本机所在的内网采集公钥并保存为一个文件。不尝试登录,不向互联网发送数据。", lc_l2:"在自检页用「打开文件」载入该文件。判定在浏览器内完成,并比较设备之间是否共享素数。", lc_lw:"下载:Windows", lc_lp:"下载:macOS · Linux(Python 3)", lc_src:"查看代码", lc_run:"运行", lc_one:"快速检测单台设备", lc_auth:"仅在你拥有或已获授权检测的网络中使用。", lc_file:"📂 打开文件", gd_h:"🏠 检测家庭或公司内部的设备", gd_s1:"在同一网络的电脑上运行以下命令。请把地址换成要检测的路由器、摄像头或打印机。", gd_s2:"把输出的证书粘贴到自检页。同时粘贴多台设备可相互比较。粘贴的内容不会离开浏览器。", gd_copy:"复制", gd_copied:"已复制", gd_go:"前往自检", ad_h:"🌐 按域名或 IP 检测", ad_hint:"检测服务器只连接该地址的 443 端口(HTTPS),取得其公开证书。判定在本浏览器内完成。不保存地址和结果。", ad_ph:"例如 example.com 或 203.0.113.10", ad_my:"📍 填入我的 IP", ad_consent:"该地址的设备归我所有或我已获授权检测。我不会未经许可检测他人的设备。", ad_run:"检测地址", ad_clear:"清空列表", ad_more:"可逐个检测更多设备,结果会加入列表并相互比较是否共享素数。内网地址(192.168.x.x 等)无法从互联网访问,请在自检页粘贴其证书。", ad_self:"自签名", ad_exp:"到期", ad_issuer:"签发", ad_got:"已填入你的访问 IP。请勾选授权确认后开始检测。", ad_ec:"该设备使用椭圆曲线密钥,不适用 RSA 检测。", ad_other:"不是 RSA 密钥,不适用 RSA 检测。", ad_noaddr:"请输入地址。", ad_err:{"bad_target": "请检查地址格式。只能输入一个域名或 IP,不含端口和路径。", "private_target": "内网地址无法从互联网访问,请按以下方法在本机检测。", "dns": "无法解析该地址。", "connect": "443 端口已关闭,外部看不到该设备的密钥。这不是安全判定。", "timeout": "该设备在互联网上不可见(443 无响应)。这不是故障,表示外部看不到其密钥。这不是安全判定。", "tls": "无法建立 TLS 连接。", "rate": "请求过多,请稍后再试。", "consent": "请勾选授权确认。", "server": "检测服务器正在唤醒,请约一分钟后重试。", "nomyip": "无法确定你的访问 IP。"},lb_eye:"在 Spark 实测 · 无挑选", lb_h:"弱密钥检测基准",lb_lead:"在标准弱密钥测试集上实测各检测方法的召回率、误报率与速度并排名。单一方法只能检出部分,组合的 KeyGuard 可检出所有类型。",th_det:"检测器", th_recall:"召回率", th_fpr:"误报", th_time:"耗时", th_cat:"按类型",4 unmodified lineslb_m3h:"可复现", lb_m3d:"固定种子(20262025) — 随时复现,不可篡改",lb_notes:["ROCA 为 0%(本集无合成 ROCA 阳性,为完整性而列入)。","经典分解为 0%(2048 位不可行,在迭代上限内测量)。","小规模自建集 — 数字仅为实测值,无夸大。"],catlabel:{close:"相近",shared:"共享",short:"过短",bade:"指数"}, me_tag:"我们",sample:{fermat:["🤏 相近素数","两素数过近的 2048 位密钥 — 被 Fermat 瞬间分解"],shared:["🔗 素数共享 (2台)","两台设备共享素数 — 被 batch-GCD 同时攻破"],short:["📏 密钥过短","512 位 — 处于可分解范围"],bade:["⚠️ 异常指数","公开指数 e=2(配置错误)"],safe:["✓ 正常密钥","生成良好的真实 2048 位证书密钥 — 安全"],mix:["🎯 全部混合","一次检测以上所有类型 — 综合报告"]}}};let LANG='ko';4 unmodified linesdocument.querySelectorAll('[data-i18n-ph]').forEach(el=>{const v=t(el.getAttribute('data-i18n-ph'));if(typeof v==='string')el.setAttribute('placeholder',v);});document.querySelectorAll('#langsw button').forEach(b=>b.classList.toggle('on',b.dataset.lang===LANG));renderChips();renderBoard();if(typeof ADDR!=='undefined'&&ADDR.length)renderAddr();}function detectLang(){try{const s=localStorage.getItem('kg-lang');if(s&&I18N[s])return s;}catch(e){}18 unmodified linesfunction rocaHeuristic(n){try{for(const p of ROCA_PRIMES){const P=bi(p);let res=new Set();let x=1n;for(let k=1;k<p;k++){x=(x*65537n)%P;res.add(x.toString());}const r=(n%P);if(r!==0n&&!res.has(r.toString()))return false;}return true;}catch(e){return false;}}function b64ToBytes(b64){const bin=atob(b64.replace(/\s+/g,''));const a=new Uint8Array(bin.length);for(let i=0;i<bin.length;i++)a[i]=bin.charCodeAt(i);return a;}function derIntegers(bytes){const out=[];let i=0;function len(){let l=bytes[i++];if(l&0x80){let k=l&0x7f;l=0;while(k--)l=(l<<8)|bytes[i++];}return l;}function walk(end){while(i<end){const tag=bytes[i++];const l=len();const s=i;if(tag===0x02){let hex='';for(let j=s;j<s+l;j++)hex+=bytes[j].toString(16).padStart(2,'0');if(hex)out.push(BigInt('0x'+hex));i=s+l;}else if(tag===0x30||tag===0x31||tag===0x03){walk(s+l);i=s+l;}else{i=s+l;}}}try{walk(bytes.length);}catch(e){}return out;}const RSA_OID=[0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01];function rsaFromDer(by){let o=-1;for(let i=0;i+RSA_OID.length<=by.length;i++){let m=true;for(let j=0;j<RSA_OID.length;j++)if(by[i+j]!==RSA_OID[j]){m=false;break;}if(m){o=i+RSA_OID.length;break;}}let ints;if(o<0){ints=derIntegers(by);}else{let i=o;if(by[i]===0x05&&by[i+1]===0x00)i+=2;if(by[i]!==0x03)return null;i++;let l=by[i++];if(l&0x80){let k=l&0x7f;l=0;while(k--)l=(l<<8)|by[i++];}if(by[i]!==0x00)return null;ints=derIntegers(by.slice(i+1,i+l));}return ints.length>=2?{n:ints[0],e:ints[1]}:null;}function sshRsa(line){const m=line.match(/^ssh-rsa\s+([A-Za-z0-9+\/=]+)/);if(!m)return null;const by=b64ToBytes(m[1]);let i=0;const f=[];while(i+4<=by.length&&f.length<3){const l=((by[i]<<24)|(by[i+1]<<16)|(by[i+2]<<8)|by[i+3])>>>0;i+=4;if(i+l>by.length)return null;f.push(by.slice(i,i+l));i+=l;}if(f.length<3)return null;const b=x=>{let h='';for(const c of x)h+=c.toString(16).padStart(2,'0');return BigInt('0x'+(h||'0'));};return{n:b(f[2]),e:b(f[1])};}function parseNum(s){s=s.trim().replace(/\s/g,'');if(/^0x/i.test(s))return BigInt(s);if(/^[0-9]+$/.test(s))return BigInt(s);if(/^[0-9a-fA-F]+$/.test(s))return BigInt('0x'+s);throw 'bad';}function parseKey(line){line=line.trim();if(!line)return null;if(line.startsWith('ssh-rsa')){try{return sshRsa(line);}catch(e){return null;}}if(line.includes('BEGIN')){const m=line.match(/-----BEGIN ([^-]+)-----([\s\S]*?)-----END/);if(!m||/PRIVATE/.test(m[1]))return null;try{return rsaFromDer(b64ToBytes(m[2]));}catch(e){return null;}}if(line.includes(':')){const[a,b]=line.split(':');try{return{n:parseNum(a),e:parseNum(b)};}catch(e){return null;}}try{return{n:parseNum(line),e:65537n};}catch(e){return null;}}function assess(n,e){const bits=bitlen(n);const flags=[];let level='safe';const rec={};if(bits<=768){level='critical';flags.push(t('f_size_c')(bits));}else if(bits<2048){level='weak';flags.push(t('f_size_w')(bits));}if(e<3n||e%2n===0n){level='critical';flags.push(t('f_exp')(e));}21 unmodified linesif(BUSY)return;if(!$('consent').checked){alert(t('al_consent'));return;}BUSY=true;const btn=$('runbtn');const prev=btn.textContent;btn.textContent=t('busy');btn.style.opacity='.7';$('checker').appendChild($('results'));await sleep(30);try{await doCheck();}finally{btn.textContent=prev;btn.style.opacity='1';BUSY=false;}}async function doCheck(src){const lines=(src==null?$('keyin').value:src).split('\n');const blocks=[],labs=[];let buf='',lab='';const put=b=>{blocks.push(b);labs.push(lab);lab='';};for(const ln of lines){if(!buf&&/^\s*#/.test(ln)){lab=ln.replace(/^\s*#\s*/,'').trim().slice(0,80);continue;}if(ln.includes('BEGIN'))buf=ln+'\n';else if(buf){buf+=ln+'\n';if(ln.includes('END')){put(buf);buf='';}}else if(ln.trim())put(ln);}const parsed=[];blocks.forEach((b,i)=>{const k=parseKey(b);if(k&&k.n>1n)parsed.push({idx:i+1,lab:labs[i],...k});});if(!parsed.length){$('results').style.display='none';alert(t('al_nokey'));return;}const shared=[];const sharedMap={};const sharedG={};for(let a=0;a<parsed.length;a++)for(let b=a+1;b<parsed.length;b++){const g=bgcd(parsed[a].n,parsed[b].n);if(g!==1n&&g!==parsed[a].n&&g!==parsed[b].n){const bits=bitlen(g);shared.push([parsed[a].idx,parsed[b].idx,bits]);(sharedMap[parsed[a].idx]=sharedMap[parsed[a].idx]||[]).push(parsed[b].idx);(sharedMap[parsed[b].idx]=sharedMap[parsed[b].idx]||[]).push(parsed[a].idx);sharedG[parsed[a].idx]=g;sharedG[parsed[b].idx]=g;}}let nSafe=0,nWeak=0,nBad=0,nCracked=0;const rows=[];for(const k of parsed){await sleep(0);const r=assess(k.n,k.e);if(sharedMap[k.idx]){r.level='critical';r.flags.unshift(t('f_shared')(sharedMap[k.idx].map(x=>'#'+x).join(', ')));if(!r.rec.p){const g=sharedG[k.idx];r.rec={p:g,q:k.n/g,method:'shared'};}}if(r.level==='safe')nSafe++;else if(r.level==='weak')nWeak++;else nBad++;if(r.rec.p)nCracked++;const emoji=r.level==='safe'?'✓':r.level==='weak'?'!':'✕';const badge=r.level==='safe'?t('b_safe'):r.level==='weak'?t('b_weak'):t('b_bad');rows.push(`<div class="res ${r.level}"><div class="ic">${emoji}</div><div class="body"><div class="tt">${esc(t('key_n')(k.idx,r.bits))}${k.lab?' · '+esc(k.lab):''}</div><div class="ds">${r.flags.length?esc(r.flags.join(' / ')):esc(t('f_nodefect'))}</div>${crackHTML(r.rec,r.bits)}</div><span class="badge">${badge}</span></div>`);}// 극적 판정 배너if(nBad>0&&nCracked===0){$('verdict').innerHTML=`<div class="verdict bad"><div class="big">${esc(t('vd_bad')(nBad))}</div><div class="sub2">${esc(t('vd_bad_sub'))}</div></div>`;}else if(nBad>0){$('verdict').innerHTML=`<div class="verdict bad"><div class="lock">🔓</div><div class="big">${esc(t('vd_cracked')(nCracked))}</div><div class="sub2">${esc(t('vd_cracked_sub'))}</div></div>`;}else if(nWeak>0){$('verdict').innerHTML=`<div class="verdict bad" style="border-color:var(--warn);background:radial-gradient(120% 140% at 50% 0,rgba(251,191,36,.18),transparent)"><div class="big" style="color:var(--warn)">${esc(t('vd_weak')(nWeak))}</div><div class="sub2">${esc(t('vd_weak_sub'))}</div></div>`;}else{$('verdict').innerHTML=`<div class="verdict safe"><div class="big">🛡️ ${esc(t('vd_safe'))}</div><div class="sub2">${esc(t('vd_safe_sub'))}</div></div>`;}$('summary').innerHTML=`<div class="card stat tot"><div class="n">${parsed.length}</div><div class="l">${esc(t('s_tot'))}</div></div><div class="card stat ok"><div class="n">${nSafe}</div><div class="l">${esc(t('s_safe'))}</div></div><div class="card stat warn"><div class="n">${nWeak}</div><div class="l">${esc(t('s_warn'))}</div></div><div class="card stat bad"><div class="n">${nBad}</div><div class="l">${esc(t('s_bad'))}</div></div>`;8 unmodified linesbox.querySelectorAll('.schip').forEach(b=>b.onclick=()=>{const s=SAMPLES[b.dataset.k];$('keyin').value=s.keys.join('\n');$('consent').checked=true;runCheck();});}$('clearbtn').onclick=()=>{$('keyin').value='';$('results').style.display='none';};$('runbtn').onclick=runCheck;async function loadFiles(fs){let o=[];for(const f of [...fs].slice(0,20)){if(f.size>2000000)continue;const x=(await f.text()).replace(/^\ufeff/,'');if(/PRIVATE KEY/.test(x))continue;o.push(/^\s*#/.test(x)?x:'# '+f.name+'\n'+x);}if(o.length)$('keyin').value=o.join('\n');}$('filebtn').onclick=()=>$('filein').click();$('filein').onchange=async e=>{await loadFiles(e.target.files);e.target.value='';};$('keyin').addEventListener('dragover',e=>e.preventDefault());$('keyin').addEventListener('drop',async e=>{if(e.dataTransfer.files.length){e.preventDefault();await loadFiles(e.dataTransfer.files);}});document.querySelectorAll('#langsw button').forEach(b=>b.onclick=()=>{LANG=b.dataset.lang;try{localStorage.setItem('kg-lang',LANG);}catch(e){}applyLang();});$('themeToggle').onclick=()=>{const r=document.documentElement;r.setAttribute('data-theme',r.getAttribute('data-theme')==='dark'?'light':'dark');try{localStorage.setItem('kg-theme',r.getAttribute('data-theme'));}catch(e){}};try{const th=localStorage.getItem('kg-theme');if(th)document.documentElement.setAttribute('data-theme',th);}catch(e){}14 unmodified lines}).join('');$('lbnotes').innerHTML=t('lb_notes').map(n=>`<li>${esc(n)}</li>`).join('');}/* ===== address check ===== */const API="https://final-bench-keyguard-api.hf.space/";let ADDR=[];let WOKE=false;function adMsg(x){const m=$('addrmsg');m.textContent=x||'';m.style.display=x?'block':'none';}function guide(host){const g=$('guide');if(host===undefined)return;const h=/^(10|192\.168|172\.(1[6-9]|2\d|3[01]))(\.\d{1,3}){2,3}$/.test(host)?host:'192.168.0.1';$('cmdwin').value=`$h='${h}';$c=New-Object Net.Sockets.TcpClient($h,443);$s=New-Object Net.Security.SslStream($c.GetStream(),$false,{$true});$s.AuthenticateAsClient($h);'-----BEGIN CERTIFICATE-----';[Convert]::ToBase64String($s.RemoteCertificate.GetRawCertData(),1);'-----END CERTIFICATE-----'`;$('cmdnix').value=`openssl s_client -connect ${h}:443 </dev/null 2>/dev/null | openssl x509`;if(host)g.scrollIntoView({behavior:'smooth',block:'nearest'});}document.querySelectorAll('.cp').forEach(b=>b.onclick=async()=>{const e=$(b.dataset.for);e.select();let ok=false;try{await navigator.clipboard.writeText(e.value);ok=true;}catch(x){try{ok=document.execCommand('copy');}catch(y){}}if(ok){b.textContent=t('gd_copied');setTimeout(()=>b.textContent=t('gd_copy'),1500);}});$('gogo').onclick=()=>{showTab('check');$('keyin').scrollIntoView({block:'center'});$('keyin').focus();};function adErr(c){const e=t('ad_err');return e[c]||e.tls;}function renderAddr(){let n=0;$('addrlist').innerHTML=ADDR.map(a=>{const rs=a.type==='RSA'&&a.key;const no=rs?'#'+(++n):'ℹ';const meta=[a.type+(a.key?' '+bitlen(a.key.n):a.bits?' '+a.bits:''),a.tls,a.self_signed?t('ad_self'):(a.issuer?t('ad_issuer')+' '+a.issuer:''),a.not_after?t('ad_exp')+' '+a.not_after:''].filter(Boolean).join(' · ');return `<div class="addrrow"><span>${no}</span><b>${esc(a.target)}</b><span>${esc(meta)}</span>${rs?'':`<span>${esc(a.type==='EC'?t('ad_ec'):a.type==='RSA'?t('al_nokey'):t('ad_other'))}</span>`}</div>`;}).join('');}async function runAddr(){if(BUSY)return;const v=$('addrin').value.trim();if(!v){adMsg(t('ad_noaddr'));return;}if(!$('consent2').checked){adMsg(adErr('consent'));return;}BUSY=true;const btn=$('addrbtn');btn.textContent=t('busy');btn.style.opacity='.7';adMsg('');try{let j;try{const r=await fetch(API+'api/cert',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({target:v,consent:true})});j=await r.json();}catch(e){j={ok:false,error:'server'};}if(!j.ok){adMsg(adErr(j.error));if(['timeout','connect','private_target'].includes(j.error))guide(v);return;}j.key=j.type==='RSA'?parseKey(j.pem):null;ADDR=ADDR.filter(a=>a.target!==j.target);ADDR.push(j);if(ADDR.length>50)ADDR.shift();const ks=ADDR.filter(a=>a.key);if(ks.length){const src=[];ks.forEach(a=>src.push('# '+a.target,a.key.n.toString()+':'+a.key.e.toString()));$('addrres').appendChild($('results'));renderAddr();await doCheck(src.join('\n'));}else{$('results').style.display='none';renderAddr();}}finally{btn.textContent=t('ad_run');btn.style.opacity='1';BUSY=false;}}$('addrbtn').onclick=runAddr;$('addrin').addEventListener('keydown',e=>{if(e.key==='Enter')runAddr();});$('addrclear').onclick=()=>{ADDR=[];$('addrin').value='';$('addrlist').innerHTML='';adMsg('');$('results').style.display='none';};$('myipbtn').onclick=async()=>{try{const j=await(await fetch(API+'api/myip')).json();if(!j.ip||!j.public){adMsg(adErr('nomyip'));return;}$('addrin').value=j.ip;adMsg(t('ad_got'));}catch(e){adMsg(adErr('server'));}};/* ===== tabs ===== */function showTab(which){[['check','tabCheck','tab-check'],['addr','tabAddr','tab-addr'],['bench','tabBench','tab-bench']].forEach(([k,b,p])=>{$(p).style.display=k===which?'block':'none';$(b).classList.toggle('on',k===which);});if(which==='bench')renderBoard();if(which==='addr'&&!WOKE){WOKE=true;fetch(API+'api/myip').catch(()=>{});}try{localStorage.setItem('kg-tab',which);}catch(e){}}$('tabCheck').onclick=()=>showTab('check');$('tabAddr').onclick=()=>showTab('addr');$('tabBench').onclick=()=>showTab('bench');guide('');LANG=detectLang();applyLang();try{const tb=localStorage.getItem('kg-tab');if(tb==='bench'||tb==='addr')showTab(tb);}catch(e){}</script></body></html>137 unmodified lines13813914014114214314440 unmodified lines18518618718818919019121 unmodified lines21321421521621721821926 unmodified lines24624724824925025125210 unmodified lines26326426526626726821 unmodified lines29029129229329429529621 unmodified lines3183193203213223233243251 unmodified line32732832933033133233313 unmodified lines3473483493503513523533543553564 unmodified lines36136236336436536636736836937021 unmodified lines3923933943953963973983991 unmodified line40140240340440540640713 unmodified lines4214224234244254264274284294304 unmodified lines43543643743843944044144244344421 unmodified lines4664674684694704714724731 unmodified line47547647747847948048113 unmodified lines4954964974984995005015025035044 unmodified lines5095105115125135145154 unmodified lines52052152252352452518 unmodified lines54454554654754854955055121 unmodified lines5735745755765775785795805815825835845855865875885895905915925935945958 unmodified lines60460560660760860914 unmodified lines624625626627628629630631632633634635636637638639640641137 unmodified lines.warnbox{padding:16px 18px;border-radius:14px;border:1px solid var(--warn);background:rgba(251,191,36,.06);font-size:13px;color:var(--muted);margin-top:16px}footer{margin:56px 0 40px;padding-top:26px;border-top:1px solid var(--panel-br);font-size:12.5px;color:var(--faint);text-align:center}/* tabs */.tabs{display:flex;gap:8px;justify-content:center;margin:6px 0 2px}.tabs button{border:1px solid var(--panel-br);background:var(--panel);color:var(--muted);font-family:inherit;font-size:14px;font-weight:600;padding:11px 20px;border-radius:12px;cursor:pointer;transition:.18s}.tabs button.on{background:var(--grad);color:#0a0b14;border-color:transparent;box-shadow:0 8px 22px rgba(124,108,255,.3)}/* leaderboard */40 unmodified lines<p class="sub" data-i18n="sub"></p></header><div class="tabs"><button id="tabCheck" class="on" data-i18n="tab_check"></button><button id="tabBench" data-i18n="tab_bench"></button></div><div id="tab-check"><!-- ABOUT / 설명 -->21 unmodified lines<label class="ck"><input type="checkbox" id="consent"><span data-i18n="chk_consent"></span></label><div class="row"><button class="run" id="runbtn" data-i18n="chk_run"></button><button class="secbtn" id="clearbtn" data-i18n="chk_clear"></button></div><div id="results"><div id="verdict"></div><div class="summary" id="summary"></div><div id="reslist"></div><div id="sharedbox"></div></div></div>26 unmodified lines<p class="lead" style="margin-left:0;text-align:left" data-i18n="proof_lead"></p><div class="proof"><div class="card pf"><div class="n">10/10</div><div class="l" data-i18n="proof_s1"></div></div><div class="card pf"><div class="n">1M+</div><div class="l" data-i18n="proof_s2"></div></div><div class="card pf"><div class="n">0</div><div class="l" data-i18n="proof_s3"></div></div></div><div class="note" data-i18n="proof_note"></div>10 unmodified lines</section></div><!-- /tab-check --><div id="tab-bench" style="display:none"><section class="block" style="margin-top:26px"><div class="eyebrow" data-i18n="lb_eye"></div>21 unmodified lines/* ================= i18n ================= */const I18N={ko:{tag:"100% 브라우저 안에서 검사 · 키는 서버로 전송되지 않습니다",h1a:"내 장비 암호키,", h1b:"혹시 불량품 아닐까?",lead:"공장에서 실수로 여러 장비에 똑같은 비밀 소수를 넣어 출고하면, 누군가 그걸 찾는 순간 그 장비들은 전부 열립니다. KeyGuard는 당신의 공개키가 그런 불량 키인지 수학으로 30초 만에 검사합니다.",sub:"개인키 말고 공개키만 넣으세요. 공개키는 원래 공개되는 정보라 안전합니다.",21 unmodified linesw3h:"소수 공유 (batch-GCD)", w3d:"여러 장비가 같은 소수를 쓰면 최대공약수 한 번에 둘 다 열립니다.",w4h:"ROCA 결함칩", w4d:"특정 칩(CVE-2017-15361)이 만든 취약 패턴 키를 의심 탐지합니다.",proof_eye:"검증됨", proof_h:"실제 대규모 공개키로 검증 완료",proof_lead:"합성 취약 키를 정확히 탐지하고, 실제 인증서 투명성(CT) 로그의 공개키 100만 개를 12분에 처리해 대규모 동작을 확인했습니다.",proof_s1:"심은 취약 키 탐지 정확도 (오탐 0)", proof_s2:"실제 CT 공개키 분석 (스파크)", proof_s3:"서버로 전송된 키 (전부 클라이언트)",proof_note:"참고: 공개 CT 로그의 웹 인증서는 대체로 잘 생성되어 취약 키가 드뭅니다. 취약 키는 주로 임베디드·IoT의 자가서명 인증서에 분포 — 그래서 '내 장비를 직접 검사'하는 이 도구가 의미가 있습니다.",faq_eye:"자주 묻는 질문", faq_h:"궁금한 것들",faq1q:"제 개인키가 유출되나요?", faq1a:"아니요. 공개키만 넣고, 그마저도 브라우저 밖으로 나가지 않습니다.",1 unmodified linefaq3q:"여러 장비를 한꺼번에 넣어도 되나요?", faq3a:"네, 권장합니다. 장비들끼리 소수를 공유하는지는 여러 키를 함께 넣어야 검사됩니다.",faq4q:"안전으로 나오면 100% 안심인가요?", faq4a:"이 도구가 검사하는 4가지 결함이 없다는 뜻입니다. 암호의 다른 측면은 별도 점검이 필요합니다.",faq_warn:"⚠️ 이 도구는 본인 소유 또는 점검 위임을 ���은 장비의 공개키에만 사용하세요. 타인의 장비·시스템을 무단으로 검사·침투하는 것은 법으로 금지되어 있습니다.",foot1:"KeyGuard · 공개키 자가진단 · 모든 검사는 브라우저 안에서만 실행됩니다",foot2:"교육 및 본인 자산 점검용 · 책임 있는 보안 점검(Responsible Disclosure) 원칙 준수",b_safe:"안전", b_weak:"주의", b_bad:"위험",s_tot:"검사한 키", s_safe:"안전", s_warn:"주의", s_bad:"위험",13 unmodified linesal_consent:"본인 소유/위임 장비 확인에 체크해 주세요.", al_nokey:"유효한 RSA 공개키를 찾지 못했습니다. 형식을 확인해 주세요.",busy:"검사 중…",cr_label:"복원된 소인수 (이 키는 이미 깨진 키)", cr_time:"복원 시간", cr_iter:"Fermat 반복", cr_via:"복원 경로", cr_note:"공개 모듈러스만으로 누구나 복원 가능 → 즉시 폐기 필요",vd_cracked:(n)=>`${n}개 키 뚫림 — CRACKED`, vd_cracked_sub:"개인키가 복원됐습니다. 해당 키는 즉시 폐기·교체하세요.",vd_weak:(n)=>`${n}개 키 주의 필요`, vd_weak_sub:"지금 당장 뚫리진 않지만 교체를 권장합니다.",vd_safe:"모두 안전", vd_safe_sub:"이 도구가 검사하는 4대 결함이 없습니다.",tab_check:"🔎 자가진단", tab_bench:"🏆 벤치마크",lb_eye:"스파크 실측 · 조작 없음", lb_h:"취약키 탐지 벤치마크",lb_lead:"표준 취약키 테스트셋에서 탐지 방법들의 재현율·오탐률·속도를 실측해 순위. 단일 방법은 일부만, 결합한 KeyGuard는 전 유형을 잡습니다.",th_det:"탐지기", th_recall:"재현율", th_fpr:"오탐", th_time:"시간", th_cat:"유형별",4 unmodified lineslb_m3h:"재현 가능", lb_m3d:"고정 시드(20262025) — 언제든 동일 재현, 조작 불가",lb_notes:["ROCA는 본 셋에 합성 양성이 없어 0%(완전성 위해 포함).","고전 분해는 2048비트 불가로 0%(반복 상한 내 측정).","소규모 자체셋 — 숫자는 측정값만, 과장 없음."],catlabel:{close:"가까운소수",shared:"소수공유",short:"짧은키",bade:"지수"}, me_tag:"우리",sample:{fermat:["🤏 가까운 소수","두 소수가 너무 가까운 1024비트 키 — Fermat로 즉시 분해"],shared:["🔗 소수 공유 (2대)","두 장비가 같은 소수 사용 — batch-GCD로 양쪽 다 뚫림"],short:["📏 너무 짧은 키","512비트 — 현재 분해 가능 범위"],bade:["⚠️ 비정상 지수","공개지수 e=2 (잘못된 설정)"],safe:["✓ 정상 키","잘 생성된 2048비트 실제 인증서 키 — 안전"],mix:["🎯 전부 섞기","위 모든 유형을 한 번에 — 종합 리포트"]}},en:{tag:"100% in-browser · keys are never sent to any server",h1a:"Your device's crypto key —", h1b:"is it a factory defect?",lead:"If a factory mistakenly ships many devices with the same secret prime, anyone who finds it can open them all. KeyGuard checks, with math in 30 seconds, whether your public key is one of those defective keys.",sub:"Paste the PUBLIC key only, never the private key. Public keys are meant to be public, so this is safe.",21 unmodified linesw3h:"Shared primes (batch-GCD)", w3d:"If devices share a prime, one GCD opens both.",w4h:"ROCA faulty chips", w4d:"Detects vulnerable keys from certain chips (CVE-2017-15361).",proof_eye:"Verified", proof_h:"Validated on real large-scale public keys",proof_lead:"Detects planted weak keys exactly, and verified at scale on 1,000,000+ real public keys from Certificate Transparency (CT) logs in 12 minutes.",proof_s1:"Detection accuracy on planted weak keys (0 false positives)", proof_s2:"Real CT public keys analyzed (on Spark)", proof_s3:"Keys sent to any server (all client-side)",proof_note:"Note: Web certificates in public CT logs are usually well-generated, so weak keys are rare there. Weak keys mostly live in self-signed certs of embedded/IoT devices — which is why checking YOUR OWN devices with this tool matters.",faq_eye:"FAQ", faq_h:"Common questions",faq1q:"Will my private key leak?", faq1a:"No. You paste only the public key, and even that never leaves your browser.",1 unmodified linefaq3q:"Can I paste many devices at once?", faq3a:"Yes, recommended. Shared-prime checks require several keys pasted together.",faq4q:"If it says Safe, am I 100% safe?", faq4a:"It means the four defects this tool checks are absent. Other aspects of your crypto need separate review.",faq_warn:"⚠️ Use this tool only on public keys of devices you own or are authorized to test. Testing or intruding on others' systems without permission is illegal.",foot1:"KeyGuard · public-key self-check · all checks run only inside your browser",foot2:"For education and checking your own assets · follows Responsible Disclosure",b_safe:"Safe", b_weak:"Caution", b_bad:"Danger",s_tot:"Keys checked", s_safe:"Safe", s_warn:"Caution", s_bad:"Danger",13 unmodified linesal_consent:"Please check the ownership/authorization box.", al_nokey:"No valid RSA public key found. Please check the format.",busy:"Checking…",cr_label:"Recovered primes (this key is already broken)", cr_time:"Recovered in", cr_iter:"Fermat iters", cr_via:"Recovered via", cr_note:"anyone can recover these from the public modulus → retire this key now",vd_cracked:(n)=>`${n} KEY${n>1?'S':''} CRACKED`, vd_cracked_sub:"The private key was recovered. Retire and replace these keys immediately.",vd_weak:(n)=>`${n} key(s) need attention`, vd_weak_sub:"Not breakable right now, but replacement is recommended.",vd_safe:"All safe", vd_safe_sub:"None of the four defects this tool checks were found.",tab_check:"🔎 Self-check", tab_bench:"🏆 Benchmark",lb_eye:"Measured on Spark · no cherry-picking", lb_h:"Weak-Key Detection Benchmark",lb_lead:"Recall, false-positive rate and speed of detection methods on a standard weak-key set, ranked. Single methods catch only part; combined KeyGuard catches every type.",th_det:"Detector", th_recall:"Recall", th_fpr:"False-pos", th_time:"Time", th_cat:"Per-category",4 unmodified lineslb_m3h:"Reproducible", lb_m3d:"Fixed seed (20262025) — reproduces the set anytime, no tampering",lb_notes:["ROCA shows 0% (no synthetic ROCA positives in this set; included for completeness).","Classical factoring is 0% (2048-bit infeasible; measured within an iteration cap).","Small self-generated set — numbers are measured values only, no exaggeration."],catlabel:{close:"Close",shared:"Shared",short:"Short",bade:"Exp"}, me_tag:"OURS",sample:{fermat:["🤏 Close primes","1024-bit key with primes too close — factored instantly by Fermat"],shared:["🔗 Shared prime (2 devices)","Two devices share a prime — both broken by batch-GCD"],short:["📏 Key too short","512-bit — within factorable range"],bade:["⚠️ Bad exponent","Public exponent e=2 (misconfigured)"],safe:["✓ Healthy key","A well-generated real 2048-bit certificate key — safe"],mix:["🎯 Mix everything","All types at once — full report"]}},zh:{tag:"100% 在浏览器内检测 · 密钥绝不发送到任何服务器",h1a:"你设备的加密密钥,", h1b:"会不会是次品?",lead:"如果工厂错误地给多台设备出厂了相同的秘密素数,任何人只要找到它就能打开所有这些设备。KeyGuard 用数学在 30 秒内检测你的公钥是否就是这种次品密钥。",sub:"只粘贴公钥,不要粘贴私钥。公钥本来就是公开的,所以这是安全的。",21 unmodified linesw3h:"素数共享 (batch-GCD)", w3d:"若设备共享素数,一次求最大公约数即可打开双方。",w4h:"ROCA 缺陷芯片", w4d:"检测某些芯片(CVE-2017-15361)生成的易受攻击密钥。",proof_eye:"已验证", proof_h:"已在真实大规模公钥上完成验证",proof_lead:"精确检出植入的弱密钥,并在证书透明度(CT)日志的 100 万+ 真实公钥上以 12 分钟完成了大规模验证。",proof_s1:"对植入弱密钥的检出准确率(0 误报)", proof_s2:"分析的真实 CT 公钥(在 Spark 上)", proof_s3:"发送到服务器的密钥(全部在客户端)",proof_note:"注:公共 CT 日志中的网站证书通常生成良好,弱密钥很少见。弱密钥主要存在于嵌入式/IoT 设备的自签名证书中——这正是用本工具检测'你自己的设备'的意义所在。",faq_eye:"常见问题", faq_h:"你可能想问",faq1q:"我的私钥会泄露吗?", faq1a:"不会。你只粘贴公钥,而且它也不会离开你的浏览器。",1 unmodified linefaq3q:"可以一次粘贴多台设备吗?", faq3a:"可以,建议如此。素数共享检测需要同时粘贴多个密钥。",faq4q:"显示安全就 100% 放心吗?", faq4a:"意味着本工具检测的四种缺陷不存在。加密的其他方面需要单独审查。",faq_warn:"⚠️ 本工具仅可用于你拥有或已获授权检测的设备公钥。未经许可检测或入侵他人系统是违法的。",foot1:"KeyGuard · 公钥自检 · 所有检测仅在你的浏览器内运行",foot2:"用于教育及自有资产检测 · 遵循负责任披露(Responsible Disclosure)原则",b_safe:"安全", b_weak:"注意", b_bad:"危险",s_tot:"已检测密钥", s_safe:"安全", s_warn:"注意", s_bad:"危险",13 unmodified linesal_consent:"请勾选所有权/授权确认项。", al_nokey:"未找到有效的 RSA 公钥,请检查格式。",busy:"检测中…",cr_label:"已还原的素因子(此密钥已被攻破)", cr_time:"还原耗时", cr_iter:"Fermat 迭代", cr_via:"还原途径", cr_note:"仅凭公开模数任何人都能还原 → 请立即废弃此密钥",vd_cracked:(n)=>`${n} 个密钥被攻破 — CRACKED`, vd_cracked_sub:"私钥已被还原。请立即废弃并更换这些密钥。",vd_weak:(n)=>`${n} 个密钥需注意`, vd_weak_sub:"目前不会被破解,但建议更换。",vd_safe:"全部安全", vd_safe_sub:"未发现本工具检测的四种缺陷。",tab_check:"🔎 自检", tab_bench:"🏆 基准",lb_eye:"在 Spark 实测 · 无挑选", lb_h:"弱密钥检测基准",lb_lead:"在标准弱密钥测试集上实测各检测方法的召回率、误报率与速度并排名。单一方法只能检出部分,组合的 KeyGuard 可检出所有类型。",th_det:"检测器", th_recall:"召回率", th_fpr:"误报", th_time:"耗时", th_cat:"按类型",4 unmodified lineslb_m3h:"可复现", lb_m3d:"固定种子(20262025) — 随时复现,不可篡改",lb_notes:["ROCA 为 0%(本集无合成 ROCA 阳性,为完整性而列入)。","经典分解为 0%(2048 位不可行,在迭代上限内测量)。","小规模自建集 — 数字仅为实测值,无夸大。"],catlabel:{close:"相近",shared:"共享",short:"过短",bade:"指数"}, me_tag:"我们",sample:{fermat:["🤏 相近素数","两素数过近的 1024 位密钥 — 被 Fermat 瞬间分解"],shared:["🔗 素数共享 (2台)","两台设备共享素数 — 被 batch-GCD 同时攻破"],short:["📏 密钥过短","512 位 — 处于可分解范围"],bade:["��️ 异常指数","公开指数 e=2(配置错误)"],safe:["✓ 正常密钥","生成良好的真实 2048 位证书密钥 — 安全"],mix:["🎯 全部混合","一次检测以上所有类型 — 综合报告"]}}};let LANG='ko';4 unmodified linesdocument.querySelectorAll('[data-i18n-ph]').forEach(el=>{const v=t(el.getAttribute('data-i18n-ph'));if(typeof v==='string')el.setAttribute('placeholder',v);});document.querySelectorAll('#langsw button').forEach(b=>b.classList.toggle('on',b.dataset.lang===LANG));renderChips();renderBoard();}function detectLang(){try{const s=localStorage.getItem('kg-lang');if(s&&I18N[s])return s;}catch(e){}18 unmodified linesfunction rocaHeuristic(n){try{for(const p of ROCA_PRIMES){const P=bi(p);let res=new Set();let x=1n;for(let k=1;k<p;k++){x=(x*65537n)%P;res.add(x.toString());}const r=(n%P);if(r!==0n&&!res.has(r.toString()))return false;}return true;}catch(e){return false;}}function b64ToBytes(b64){const bin=atob(b64.replace(/\s+/g,''));const a=new Uint8Array(bin.length);for(let i=0;i<bin.length;i++)a[i]=bin.charCodeAt(i);return a;}function derIntegers(bytes){const out=[];let i=0;function len(){let l=bytes[i++];if(l&0x80){let k=l&0x7f;l=0;while(k--)l=(l<<8)|bytes[i++];}return l;}function walk(end){while(i<end){const tag=bytes[i++];const l=len();const s=i;if(tag===0x02){let hex='';for(let j=s;j<s+l;j++)hex+=bytes[j].toString(16).padStart(2,'0');if(hex)out.push(BigInt('0x'+hex));i=s+l;}else if(tag===0x30||tag===0x31||tag===0x03){walk(s+l);i=s+l;}else{i=s+l;}}}try{walk(bytes.length);}catch(e){}return out;}function parseNum(s){s=s.trim().replace(/\s/g,'');if(/^0x/i.test(s))return BigInt(s);if(/^[0-9]+$/.test(s))return BigInt(s);if(/^[0-9a-fA-F]+$/.test(s))return BigInt('0x'+s);throw 'bad';}function parseKey(line){line=line.trim();if(!line)return null;if(line.includes('BEGIN')){const m=line.match(/-----BEGIN[^-]+-----([\s\S]*?)-----END/);if(m){const ints=derIntegers(b64ToBytes(m[1]));if(ints.length){let n=ints.reduce((a,b)=>bitlen(b)>bitlen(a)?b:a,0n);let e=ints.filter(x=>x!==n&&x>2n&&x<(1n<<64n)).sort((a,b)=>bitlen(b)-bitlen(a))[0]||65537n;return{n,e};}}return null;}if(line.includes(':')){const[a,b]=line.split(':');try{return{n:parseNum(a),e:parseNum(b)};}catch(e){return null;}}try{return{n:parseNum(line),e:65537n};}catch(e){return null;}}function assess(n,e){const bits=bitlen(n);const flags=[];let level='safe';const rec={};if(bits<=768){level='critical';flags.push(t('f_size_c')(bits));}else if(bits<2048){level='weak';flags.push(t('f_size_w')(bits));}if(e<3n||e%2n===0n){level='critical';flags.push(t('f_exp')(e));}21 unmodified linesif(BUSY)return;if(!$('consent').checked){alert(t('al_consent'));return;}BUSY=true;const btn=$('runbtn');const prev=btn.textContent;btn.textContent=t('busy');btn.style.opacity='.7';await sleep(30);try{await doCheck();}finally{btn.textContent=prev;btn.style.opacity='1';BUSY=false;}}async function doCheck(){const lines=$('keyin').value.split('\n');const blocks=[];let buf='';for(const ln of lines){if(ln.includes('BEGIN'))buf=ln+'\n';else if(buf){buf+=ln+'\n';if(ln.includes('END')){blocks.push(buf);buf='';}}else if(ln.trim())blocks.push(ln);}const parsed=[];blocks.forEach((b,i)=>{const k=parseKey(b);if(k&&k.n>1n)parsed.push({idx:i+1,...k});});if(!parsed.length){$('results').style.display='none';alert(t('al_nokey'));return;}const shared=[];const sharedMap={};const sharedG={};for(let a=0;a<parsed.length;a++)for(let b=a+1;b<parsed.length;b++){const g=bgcd(parsed[a].n,parsed[b].n);if(g!==1n&&g!==parsed[a].n&&g!==parsed[b].n){const bits=bitlen(g);shared.push([parsed[a].idx,parsed[b].idx,bits]);(sharedMap[parsed[a].idx]=sharedMap[parsed[a].idx]||[]).push(parsed[b].idx);(sharedMap[parsed[b].idx]=sharedMap[parsed[b].idx]||[]).push(parsed[a].idx);sharedG[parsed[a].idx]=g;sharedG[parsed[b].idx]=g;}}let nSafe=0,nWeak=0,nBad=0;const rows=[];for(const k of parsed){await sleep(0);const r=assess(k.n,k.e);if(sharedMap[k.idx]){r.level='critical';r.flags.unshift(t('f_shared')(sharedMap[k.idx].map(x=>'#'+x).join(', ')));if(!r.rec.p){const g=sharedG[k.idx];r.rec={p:g,q:k.n/g,method:'shared'};}}if(r.level==='safe')nSafe++;else if(r.level==='weak')nWeak++;else nBad++;const emoji=r.level==='safe'?'✓':r.level==='weak'?'!':'✕';const badge=r.level==='safe'?t('b_safe'):r.level==='weak'?t('b_weak'):t('b_bad');rows.push(`<div class="res ${r.level}"><div class="ic">${emoji}</div><div class="body"><div class="tt">${esc(t('key_n')(k.idx,r.bits))}</div><div class="ds">${r.flags.length?esc(r.flags.join(' / ')):esc(t('f_nodefect'))}</div>${crackHTML(r.rec,r.bits)}</div><span class="badge">${badge}</span></div>`);}// 극적 판정 배너if(nBad>0){$('verdict').innerHTML=`<div class="verdict bad"><div class="lock">🔓</div><div class="big">${esc(t('vd_cracked')(nBad))}</div><div class="sub2">${esc(t('vd_cracked_sub'))}</div></div>`;}else if(nWeak>0){$('verdict').innerHTML=`<div class="verdict bad" style="border-color:var(--warn);background:radial-gradient(120% 140% at 50% 0,rgba(251,191,36,.18),transparent)"><div class="big" style="color:var(--warn)">${esc(t('vd_weak')(nWeak))}</div><div class="sub2">${esc(t('vd_weak_sub'))}</div></div>`;}else{$('verdict').innerHTML=`<div class="verdict safe"><div class="big">🛡️ ${esc(t('vd_safe'))}</div><div class="sub2">${esc(t('vd_safe_sub'))}</div></div>`;}$('summary').innerHTML=`<div class="card stat tot"><div class="n">${parsed.length}</div><div class="l">${esc(t('s_tot'))}</div></div><div class="card stat ok"><div class="n">${nSafe}</div><div class="l">${esc(t('s_safe'))}</div></div><div class="card stat warn"><div class="n">${nWeak}</div><div class="l">${esc(t('s_warn'))}</div></div><div class="card stat bad"><div class="n">${nBad}</div><div class="l">${esc(t('s_bad'))}</div></div>`;8 unmodified linesbox.querySelectorAll('.schip').forEach(b=>b.onclick=()=>{const s=SAMPLES[b.dataset.k];$('keyin').value=s.keys.join('\n');$('consent').checked=true;runCheck();});}$('clearbtn').onclick=()=>{$('keyin').value='';$('results').style.display='none';};$('runbtn').onclick=runCheck;document.querySelectorAll('#langsw button').forEach(b=>b.onclick=()=>{LANG=b.dataset.lang;try{localStorage.setItem('kg-lang',LANG);}catch(e){}applyLang();});$('themeToggle').onclick=()=>{const r=document.documentElement;r.setAttribute('data-theme',r.getAttribute('data-theme')==='dark'?'light':'dark');try{localStorage.setItem('kg-theme',r.getAttribute('data-theme'));}catch(e){}};try{const th=localStorage.getItem('kg-theme');if(th)document.documentElement.setAttribute('data-theme',th);}catch(e){}14 unmodified lines}).join('');$('lbnotes').innerHTML=t('lb_notes').map(n=>`<li>${esc(n)}</li>`).join('');}/* ===== tabs ===== */function showTab(which){const chk=which==='check';$('tab-check').style.display=chk?'block':'none';$('tab-bench').style.display=chk?'none':'block';$('tabCheck').classList.toggle('on',chk);$('tabBench').classList.toggle('on',!chk);if(!chk)renderBoard();try{localStorage.setItem('kg-tab',which);}catch(e){}}$('tabCheck').onclick=()=>showTab('check');$('tabBench').onclick=()=>showTab('bench');LANG=detectLang();applyLang();try{const tb=localStorage.getItem('kg-tab');if(tb==='bench')showTab('bench');}catch(e){}</script></body></html>
README.md+1-4
del_openfree.pyAdded+13
index.html+41-133