1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609
| import tkinter as tk from tkinter import scrolledtext import math
import re import base64 import base58 import base91
from cryptography.hazmat.primitives import serialization from cryptography.hazmat.backends import default_backend from Crypto.Util.number import long_to_bytes from collections import Counter, defaultdict import string import hashlib
def fermat_factor(n, max_iter=1000000): a = math.isqrt(n) if a * a < n: a += 1 for _ in range(max_iter): b2 = a*a - n b = math.isqrt(b2) if b*b == b2: return a - b, a + b a += 1 return None
def pollard_p1(n, B=1000000): a = 2 for j in range(2, B): a = pow(a, j, n) g = math.gcd(a-1, n) if 1 < g < n: return g, n // g return None
def continued_fraction(numerator, denominator): cf = [] while denominator: a = numerator // denominator cf.append(a) numerator, denominator = denominator, numerator - a * denominator return cf
def convergents_from_cf(cf): n0, d0 = cf[0], 1 yield (n0, 1) if len(cf) == 1: return n1 = cf[1] * cf[0] + 1 d1 = cf[1] yield (n1, d1) for i in range(2, len(cf)): ni = cf[i] * n1 + n0 di = cf[i] * d1 + d0 yield (ni, di) n0, d0, n1, d1 = n1, d1, ni, di
def is_perfect_square(x): if x < 0: return False s = math.isqrt(x) return s * s == x
def wiener_attack(e, n): cf = continued_fraction(e, n) for k, d in convergents_from_cf(cf): if k == 0: continue if (e * d - 1) % k != 0: continue phi = (e * d - 1) // k s = n - phi + 1 discr = s*s - 4*n if discr >= 0 and is_perfect_square(discr): t = math.isqrt(discr) p = (s + t) // 2 q = (s - t) // 2 if p * q == n: return d return None
root = tk.Tk() root.title("CryptexLab") root.geometry("800x800") font_title = ('微软雅黑', 12, 'bold') font_text = ('微软雅黑', 10)
menubar = tk.Menu(root) root.config(menu=menubar)
def show_frame(frame): for f in (decode_frame, Caesar_frame,Vigenere_frame, rsa_pem_frame, rsa_crack_frame, sha256_frame, md5_frame): f.pack_forget() frame.pack(fill=tk.BOTH, expand=True)
def is_binary(s): return all(c in '01' for c in s) and len(s) % 8 == 0
def decode_bytes(byte_data): try: text = byte_data.decode('utf-8') return text, True except UnicodeDecodeError: return byte_data.hex(), False
def looks_like_base64(s): return len(s) % 4 == 0 and re.fullmatch(r'[A-Za-z0-9+/=]+', s) is not None
def looks_like_base32(s): return len(s) % 8 == 0 and re.fullmatch(r'[A-Z2-7=]+', s, re.IGNORECASE) is not None
def looks_like_base58(s): return all(c in base58.alphabet.decode() for c in s)
def looks_like_base91(s): return all(33 <= ord(c) <= 126 for c in s)
def try_decode(s, func): decoded = func(s) return decode_bytes(decoded)
def recursive_decode(s, path=None, all_paths=None, max_depth=10): if path is None: path = [] if all_paths is None: all_paths = [] if len(path) >= max_depth: return all_paths
decoders = [ ('Base64', looks_like_base64, base64.b64decode), ('Base32', looks_like_base32, base64.b32decode), ('Base58', looks_like_base58, base58.b58decode), ('Base91', looks_like_base91, base91.decode), ('Binary', is_binary, lambda x: bytes(int(x[i:i + 8], 2) for i in range(0, len(x), 8))), ('Hex', lambda x: True, lambda x: bytes.fromhex(x)), ]
for name, detector, func in decoders: if detector(s): try: text, is_utf8 = try_decode(s, func) except Exception: continue mode = '(UTF-8)' if is_utf8 else '(hex)' new_path = path + [(name, text, mode)] all_paths.append(new_path) if is_utf8: recursive_decode(text, new_path, all_paths, max_depth) return all_paths
def select_final_path(paths): utf_paths = [p for p in paths if p[-1][2] == '(UTF-8)'] if utf_paths: max_len = max(len(p) for p in utf_paths) for p in utf_paths: if len(p) == max_len: return p max_len = max(len(p) for p in paths) for p in paths: if len(p) == max_len: return p
def decode_input(): raw = input_text.get('1.0', tk.END).strip().replace(' ', '') decode_output_text.delete('1.0', tk.END) if not raw: return
paths = recursive_decode(raw) if not paths: decode_output_text.insert(tk.END, '无法识别或解码此内容。') return
final = select_final_path(paths) for i, (name, text, mode) in enumerate(final, 1): decode_output_text.insert(tk.END, f"第{i}步 - {name} {mode}\n结果:{text}\n\n")
if len(final) == 1 and final[0][2] == '(UTF-8)': s = final[0][1] extra_decoders = [ ('Base64', looks_like_base64, base64.b64decode), ('Base32', looks_like_base32, base64.b32decode), ('Base58', looks_like_base58, base58.b58decode), ('Base91', looks_like_base91, base91.decode), ('Binary', is_binary, lambda x: bytes(int(x[i:i + 8], 2) for i in range(0, len(x), 8))) ] for name, detector, func in extra_decoders: if detector(s): try: data = func(s) hex_out = data.hex() decode_output_text.insert(tk.END, f"第2步 - {name} (hex)\n结果:{hex_out}\n") break except Exception: continue
decode_frame = tk.Frame(root) tk.Label(decode_frame, text='请输入编码内容:', font=font_title).pack(pady=(10, 0)) input_text = scrolledtext.ScrolledText(decode_frame, height=6, font=font_text, wrap=tk.WORD) input_text.pack(fill=tk.BOTH, padx=20, pady=5, expand=True) tk.Button(decode_frame, text='开始解码', font=font_title, bg='#4CAF50', fg='white', command=decode_input).pack(pady=10) tk.Label(decode_frame, text='输出结果:', font=font_title).pack() decode_output_text = scrolledtext.ScrolledText(decode_frame, height=10, font=font_text, wrap=tk.WORD) decode_output_text.pack(fill=tk.BOTH, padx=20, pady=5, expand=True)
def caesar_decrypt(text, shift): result = '' for ch in text: if 'A' <= ch <= 'Z': result += chr((ord(ch)-ord('A')-shift)%26+ord('A')) elif 'a' <= ch <= 'z': result += chr((ord(ch)-ord('a')-shift)%26+ord('a')) else: result += ch return result
def decrypt_caesar(): text = caesar_input.get('1.0', tk.END).strip() caesar_output_text.delete('1.0', tk.END) keyword = keyword_entry.get().strip() if var_traverse.get(): for k in range(26): dec = caesar_decrypt(text, k) if not keyword or keyword.lower() in dec.lower(): caesar_output_text.insert(tk.END, f"Key={k}:\n{dec}\n\n") else: try: k = int(key_entry.get()) dec = caesar_decrypt(text, k) caesar_output_text.insert(tk.END, dec) except ValueError: caesar_output_text.insert(tk.END, "密钥应为整数。")
Caesar_frame = tk.Frame(root)
tk.Label(Caesar_frame, text='凯撒密文输入:', font=font_title).pack(pady=(10,0)) caesar_input = scrolledtext.ScrolledText(Caesar_frame, height=5, font=font_text) caesar_input.pack(fill=tk.BOTH, padx=20, pady=5, expand=True) key_row = tk.Frame(Caesar_frame) tk.Label(key_row, text='密钥 (0-25):', font=font_text).pack(side=tk.LEFT) key_entry = tk.Entry(key_row, width=5) key_entry.pack(side=tk.LEFT, padx=(5,15)) tk.Label(key_row, text='关键词 (可选):', font=font_text).pack(side=tk.LEFT) keyword_entry = tk.Entry(key_row, width=20) keyword_entry.pack(side=tk.LEFT, padx=5) key_row.pack(pady=10) var_traverse = tk.BooleanVar(value=True) tk.Checkbutton(Caesar_frame, text='遍历所有可能', variable=var_traverse).pack() tk.Button(Caesar_frame, text='开始解密', font=font_title, bg='#2196F3', fg='white', command=decrypt_caesar).pack(pady=10, fill='x', padx=20) tk.Label(Caesar_frame, text='输出结果:', font=font_title).pack() caesar_output_text = scrolledtext.ScrolledText(Caesar_frame, height=10, font=font_text) caesar_output_text.pack(fill=tk.BOTH, padx=20, pady=5, expand=True)
ENG_FREQ_RAW = { 'A': 8.167, 'B': 1.492, 'C': 2.782, 'D': 4.253, 'E':12.702, 'F': 2.228, 'G': 2.015, 'H': 6.094, 'I': 6.966, 'J': 0.153, 'K': 0.772, 'L': 4.025, 'M': 2.406, 'N': 6.749, 'O': 7.507, 'P': 1.929, 'Q': 0.095, 'R': 5.987, 'S': 6.327, 'T': 9.056, 'U': 2.758, 'V': 0.978, 'W': 2.360, 'X': 0.150, 'Y': 1.974, 'Z': 0.074, } ENG_FREQ = {k: v / sum(ENG_FREQ_RAW.values()) for k, v in ENG_FREQ_RAW.items()} ALPHABET = string.ascii_uppercase
def index_of_coincidence(text): N = len(text) if N < 2: return 0.0 freq = Counter(text) return sum(n * (n - 1) for n in freq.values()) / (N * (N - 1))
def avg_ic_for_len(cipher, k): return sum(index_of_coincidence(cipher[i::k]) for i in range(k)) / k
def chi_square_list(col): N = len(col) observed = Counter(col) result = [] for shift in range(26): chi = 0.0 for i, c in enumerate(ALPHABET): expected = ENG_FREQ[c] * N shifted = ALPHABET[(i + shift) % 26] observed_count = observed.get(shifted, 0) chi += ((observed_count - expected) ** 2) / expected result.append(chi) return result
def kasiski_candidates(cipher, n_min=3, n_max=6, key_lo=10, key_hi=50, top_n=8): positions = defaultdict(list) for n in range(n_min, n_max + 1): for i in range(len(cipher) - n + 1): gram = cipher[i:i+n] positions[gram].append(i) votes = {} for locs in positions.values(): if len(locs) < 2: continue for i in range(len(locs)): for j in range(i + 1, len(locs)): dist = locs[j] - locs[i] for k in range(key_lo, key_hi + 1): if dist % k == 0: votes[k] = votes.get(k, 0) + 1 return sorted(votes, key=votes.get, reverse=True)[:top_n]
def recover_key(cipher, key_lo=10, key_hi=50, kasiski_top=8, ic_top=3): cipher = ''.join(filter(str.isalpha, cipher.upper())) candidates = kasiski_candidates(cipher, key_lo=key_lo, key_hi=key_hi, top_n=kasiski_top) if not candidates: candidates = list(range(key_lo, key_hi + 1)) ic_scores = {k: avg_ic_for_len(cipher, k) for k in candidates} top_lengths = sorted(ic_scores, key=ic_scores.get, reverse=True)[:ic_top]
best_key = None best_score = float('inf') for k in top_lengths: key = [] total_chi = 0.0 for i in range(k): col = cipher[i::k] chis = chi_square_list(col) best_shift = chis.index(min(chis)) key.append(ALPHABET[best_shift]) total_chi += chis[best_shift] if total_chi < best_score: best_key = ''.join(key) best_score = total_chi return best_key, best_score
def vigenere_decrypt(cipher, key): vigenere_result = '' klen = len(key) j = 0 for c in cipher: if c.isalpha(): k = key[j % klen] ki = ord(k.upper()) - ord('A') if c.isupper(): vigenere_result += chr((ord(c) - ord('A') - ki) % 26 + ord('A')) else: vigenere_result += chr((ord(c) - ord('a') - ki) % 26 + ord('a')) j += 1 else: vigenere_result += c return vigenere_result
def decrypt_vigenere(): text = vigenere_input.get('1.0', tk.END).strip() key = vigenere_key_entry.get().strip() vigenere_output_text.delete('1.0', tk.END)
if not text: vigenere_output_text.insert(tk.END, "请输入密文。") return
if not key: key, score = recover_key(text) vigenere_output_text.insert(tk.END, f"[自动识别密钥]:{key} (χ²得分={score:.2f})\n\n")
result = vigenere_decrypt(text, key) vigenere_output_text.insert(tk.END, result)
Vigenere_frame = tk.Frame(root)
tk.Label(Vigenere_frame, text='维吉尼亚密文输入:', font=font_title).pack(pady=(10,0)) vigenere_input = scrolledtext.ScrolledText(Vigenere_frame, height=5, font=font_text) vigenere_input.pack(fill=tk.BOTH, padx=20, pady=5, expand=True) key_row = tk.Frame(Vigenere_frame) tk.Label(key_row, text='密钥:', font=font_text).pack(side=tk.LEFT) vigenere_key_entry = tk.Entry(key_row, width=20) vigenere_key_entry.pack(side=tk.LEFT, padx=5) key_row.pack(pady=10) tk.Label(Vigenere_frame, text='(如果没有密钥则默认进行词频分析)', font=font_text, fg='gray').pack()
tk.Button(Vigenere_frame, text='开始解密', font=font_title, bg='#009688', fg='white', command=decrypt_vigenere).pack(pady=10, fill='x', padx=20) tk.Label(Vigenere_frame, text='输出结果:', font=font_title).pack() vigenere_output_text = scrolledtext.ScrolledText(Vigenere_frame, height=10, font=font_text) vigenere_output_text.pack(fill=tk.BOTH, padx=20, pady=5, expand=True)
def parse_pem(): global parsed_pem_values parsed_pem_values = {} rsa_pem_output.delete('1.0', tk.END) pem_data = pem_input.get('1.0', tk.END).strip().encode() try: if b'BEGIN PUBLIC KEY' in pem_data: pub_key = serialization.load_pem_public_key(pem_data, backend=default_backend()) nums = pub_key.public_numbers() rsa_pem_output.insert(tk.END, f"类型:公钥\nn={nums.n}\ne={nums.e}\n") parsed_pem_values = {'n': nums.n, 'e': nums.e} else: priv_key = serialization.load_pem_private_key(pem_data, password=None, backend=default_backend()) nums = priv_key.private_numbers() rsa_pem_output.insert(tk.END, f"类型:私钥\nn={nums.public_numbers.n}\ne={nums.public_numbers.e}\nd={nums.d}\np={nums.p}\nq={nums.q}\n") parsed_pem_values = { 'n': nums.public_numbers.n, 'e': nums.public_numbers.e, 'd': nums.d, 'p': nums.p, 'q': nums.q } except Exception as e: rsa_pem_output.insert(tk.END, f"解析失败: {e}") def transfer_to_rsa_crack(): show_frame(rsa_crack_frame) for key, entry in rsa_entries.items(): if key in parsed_pem_values: entry.delete(0, tk.END) entry.insert(0, str(parsed_pem_values[key]))
rsa_pem_frame = tk.Frame(root)
tk.Label(rsa_pem_frame, text='请输入 PEM 格式的密钥:', font=font_title).pack(pady=(10,0)) pem_input = scrolledtext.ScrolledText(rsa_pem_frame, height=10, font=font_text) pem_input.pack(fill=tk.BOTH, padx=20, pady=5, expand=True) tk.Button(rsa_pem_frame, text='解析 PEM', font=font_title, bg='#9C27B0', fg='white', command=parse_pem).pack(pady=10) tk.Label(rsa_pem_frame, text='解析结果:', font=font_title).pack() rsa_pem_output = scrolledtext.ScrolledText(rsa_pem_frame, height=10, font=font_text) rsa_pem_output.pack(fill=tk.BOTH, padx=20, pady=5, expand=True)
tk.Button(rsa_pem_frame, text='传递到RSA破解', font=font_title, bg='#FF9800', fg='white', command=lambda: transfer_to_rsa_crack()).pack(pady=10)
def rsa_crack_handler(): rsa_crack_output.delete('1.0', tk.END) def get_int(name): txt = rsa_entries[name].get().strip().replace(" ", "") return int(txt) if txt else None n = get_int('n') p = get_int('p') q = get_int('q') d = get_int('d') e = get_int('e') c = get_int('c') if None not in (n,d,c): m = pow(c, d, n) try: text = long_to_bytes(m).decode('utf-8', errors='ignore') except: text = str(long_to_bytes(m)) rsa_crack_output.insert(tk.END, f"解密结果: {text}\n") return if None not in (n,p,q,e): phi = (p-1)*(q-1) d_calc = pow(e, -1, phi) rsa_crack_output.insert(tk.END, f"计算出的 d: {d_calc}\n") if c is not None: m = pow(c, d_calc, n) try: text = long_to_bytes(m).decode('utf-8', errors='ignore') except: text = str(long_to_bytes(m)) rsa_crack_output.insert(tk.END, f"解密结果: {text}\n") return if n is not None: if None not in (n,e): if attack_vars["Wiener's Attack"][0].get(): rsa_crack_output.insert(tk.END, "执行 Wiener 攻击...\n") d_w = wiener_attack(e,n) if d_w: rsa_crack_output.insert(tk.END, f"成功: d={d_w}\n") else: rsa_crack_output.insert(tk.END, "失败。\n") return if attack_vars['Fermat Factorization'][0].get(): lim = int(attack_vars['Fermat Factorization'][1].get()) rsa_crack_output.insert(tk.END, "执行 Fermat 分解...\n") res = fermat_factor(n, lim) if res: rsa_crack_output.insert(tk.END, f"成功: p={res[0]}, q={res[1]}\n") else: rsa_crack_output.insert(tk.END, "失败。\n") if attack_vars["Pollard's p-1"][0].get(): B = int(attack_vars["Pollard's p-1"][1].get()) rsa_crack_output.insert(tk.END, "执行 Pollard p-1...\n") res = pollard_p1(n, B) if res: rsa_crack_output.insert(tk.END, f"成功: p={res[0]}, q={res[1]}\n") else: rsa_crack_output.insert(tk.END, "失败。\n") return rsa_crack_output.insert(tk.END, "请至少输入 n 或更多参数。\n") rsa_crack_frame = tk.Frame(root)
tk.Label(rsa_crack_frame, text='请输入 RSA 参数(十进制整数):', font=font_title).pack(pady=(10,5)) rsa_entries = {} for label in ['n','p','q','d','e','c']: row = tk.Frame(rsa_crack_frame) tk.Label(row, text=f"{label} =", font=font_text, width=3).pack(side=tk.LEFT) entry = tk.Entry(row, font=font_text, width=40) entry.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=5) rsa_entries[label] = entry row.pack(padx=20, pady=3, fill=tk.X)
attack_vars = {} for name in ['Fermat Factorization',"Pollard's p-1","Wiener's Attack"]: row = tk.Frame(rsa_crack_frame) var_enable = tk.BooleanVar(value=False) tk.Checkbutton(row, text=name, variable=var_enable, font=font_text).pack(side=tk.LEFT) tk.Label(row, text='循环上限:', font=font_text).pack(side=tk.LEFT, padx=5) param_entry = tk.Entry(row, width=10) param_entry.insert(0,'1000000') param_entry.pack(side=tk.LEFT) attack_vars[name] = (var_enable,param_entry) row.pack(anchor='w', padx=40, pady=3)
tk.Button(rsa_crack_frame, text='破解', font=font_title, bg='#FF9800', fg='white', command=rsa_crack_handler).pack(pady=10) tk.Label(rsa_crack_frame, text='输出结果:', font=font_title).pack() rsa_crack_output = scrolledtext.ScrolledText(rsa_crack_frame, height=12, font=font_text) rsa_crack_output.pack(fill=tk.BOTH, padx=20, pady=5, expand=True)
def compute_sha256(): sha256_output_text.delete('1.0', tk.END) raw = sha256_input_text.get('1.0', tk.END).strip() if not raw: sha256_output_text.insert(tk.END, "请输入文本内容。") return h = hashlib.sha256(raw.encode()).hexdigest() sha256_output_text.insert(tk.END, h)
sha256_frame = tk.Frame(root)
tk.Label(sha256_frame, text='请输入文本内容:', font=font_title).pack(pady=(10,0)) sha256_input_text = scrolledtext.ScrolledText(sha256_frame, height=6, font=font_text) sha256_input_text.pack(fill=tk.BOTH, padx=20, pady=5, expand=True) tk.Button(sha256_frame, text='计算哈希', font=font_title, bg='#E91E63', fg='white', command=compute_sha256).pack(pady=10) tk.Label(sha256_frame, text='SHA256 结果:', font=font_title).pack() sha256_output_text = scrolledtext.ScrolledText(sha256_frame, height=6, font=font_text) sha256_output_text.pack(fill=tk.BOTH, padx=20, pady=5, expand=True)
def compute_md5(): md5_output_text.delete('1.0', tk.END) raw = md5_input_text.get('1.0', tk.END).strip() if not raw: md5_output_text.insert(tk.END, "请输入文本内容。") return h = hashlib.md5(raw.encode()).hexdigest() md5_output_text.insert(tk.END, h)
md5_frame = tk.Frame(root)
tk.Label(md5_frame, text='请输入文本内容:', font=font_title).pack(pady=(10,0)) md5_input_text = scrolledtext.ScrolledText(md5_frame, height=6, font=font_text) md5_input_text.pack(fill=tk.BOTH, padx=20, pady=5, expand=True) tk.Button(md5_frame, text='计算哈希', font=font_title, bg='#7E57C2', fg='white', command=compute_md5).pack(pady=10) tk.Label(md5_frame, text='MD5 结果:', font=font_title).pack() md5_output_text = scrolledtext.ScrolledText(md5_frame, height=6, font=font_text) md5_output_text.pack(fill=tk.BOTH, padx=20, pady=5, expand=True)
menubar.add_command(label='解码', command=lambda: show_frame(decode_frame))
classical_menu = tk.Menu(menubar, tearoff=0) menubar.add_cascade(label='古典密码', menu=classical_menu) classical_menu.add_command(label='凯撒密码', command=lambda: show_frame(Caesar_frame)) classical_menu.add_command(label='维吉尼亚密码', command=lambda: show_frame(Vigenere_frame))
rsa_menu = tk.Menu(menubar, tearoff=0) menubar.add_cascade(label='RSA', menu=rsa_menu) rsa_menu.add_command(label='解析PEM', command=lambda: show_frame(rsa_pem_frame)) rsa_menu.add_command(label='破解 RSA', command=lambda: show_frame(rsa_crack_frame))
hash_menu = tk.Menu(menubar, tearoff=0) menubar.add_cascade(label='哈希', menu=hash_menu) hash_menu.add_command(label='SHA256', command=lambda: show_frame(sha256_frame)) hash_menu.add_command(label='MD5', command=lambda: show_frame(md5_frame))
show_frame(decode_frame) root.mainloop()
|