index.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <!-- saved from url=(0014)about:internet -->
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>crypty</title>
  7. <script src="../js/jquery-1.7.2.js"></script>
  8. <script src="../js/aes.js"></script>
  9. <script src="../js/tripledes.js"></script>
  10. <script src="../js/rabbit.js"></script>
  11. <script src="../js/rc4.js"></script>
  12. <!-- <link async rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
  13. integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous"> -->
  14. <link rel="stylesheet" href="../css/bootstrap.min.css" crossorigin="anonymous">
  15. <link rel="preconnect" href="https://fonts.gstatic.com">
  16. <link href="https://fonts.loli.net/css2?family=Anonymous+Pro:ital,wght@0,400;0,700;1,400;1,700
  17. &family=Noto+Serif+SC:wght@300;400;500;600;700&display=swap" rel="stylesheet">
  18. <link rel="stylesheet" href="../css/style.css">
  19. <!-- <link rel="stylesheet" href="/css/style.css"> -->
  20. </head>
  21. <body>
  22. <a class="btn btn-info" href="/" style="text-shadow: rgb(85, 85, 85) 3px 2px 4px;"><span
  23. class="glyphicon glyphicon-home" aria-hidden="true"></span>&nbsp;返回</a>
  24. <div>
  25. <div>明文:</div>
  26. <textarea rows="10" cols="64" name="message" id="msg_source" class="text_source"></textarea>
  27. <div>
  28. <p>加密算法:</p>
  29. <ul>
  30. <input type="radio" name="Etype" value="aes" checked="checked" />AES
  31. <input type="radio" name="Etype" value="des" />DES
  32. <input type="radio" name="Etype" value="rc4" />RC4
  33. <input type="radio" name="Etype" value="rabbit" />Rabbit
  34. <input type="radio" name="Etype" value="tripledes" />TripleDes
  35. </ul>
  36. </div>
  37. <div class="OptDetail Button">
  38. <p class="input">密码:
  39. <input type="text" id="pwd" />
  40. </p>
  41. <ul>
  42. <button class="btn btn-default" onclick="encrypt();"
  43. style="text-shadow: rgb(185, 185, 185) 3px 2px 4px;"><span class="glyphicon glyphicon-arrow-down"
  44. aria-hidden="true"></span>&nbsp;加密</button>
  45. <button class="btn btn-default" onclick="decrypt();"
  46. style="text-shadow: rgb(185, 185, 185) 3px 2px 4px;"><span class="glyphicon glyphicon-arrow-up"
  47. aria-hidden="true"></span>&nbsp;解密</button>
  48. </ul>
  49. </div>
  50. <div>密文:</div>
  51. <textarea rows="10" cols="64" name="cipher" id="encrypt_result" onclick="this.select();"></textarea>
  52. <script>
  53. function encrypt() {
  54. switch ($('input[name="Etype"]:checked').val()) {
  55. case "aes":
  56. $("#encrypt_result").val(CryptoJS.AES.encrypt($("#msg_source").val(), $("#pwd").val()));
  57. break;
  58. case "des":
  59. $("#encrypt_result").val(CryptoJS.DES.encrypt($("#msg_source").val(), $("#pwd").val()));
  60. break;
  61. case "rabbit":
  62. $("#encrypt_result").val(CryptoJS.Rabbit.encrypt($("#msg_source").val(), $("#pwd").val()));
  63. break;
  64. case "rc4":
  65. $("#encrypt_result").val(CryptoJS.RC4.encrypt($("#msg_source").val(), $("#pwd").val()));
  66. break;
  67. case "tripledes":
  68. $("#encrypt_result").val(CryptoJS.TripleDES.encrypt($("#msg_source").val(), $("#pwd").val()));
  69. break;
  70. }
  71. }
  72. function decrypt() {
  73. switch ($('input[name="Etype"]:checked').val()) {
  74. case "aes":
  75. $("#msg_source").val(CryptoJS.AES.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
  76. break;
  77. case "des":
  78. $("#msg_source").val(CryptoJS.DES.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
  79. break;
  80. case "rabbit":
  81. $("#msg_source").val(CryptoJS.Rabbit.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
  82. break;
  83. case "rc4":
  84. $("#msg_source").val(CryptoJS.RC4.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
  85. break;
  86. case "tripledes":
  87. $("#msg_source").val(CryptoJS.TripleDES.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
  88. break;
  89. }
  90. }
  91. </script>
  92. </div>
  93. </body>
  94. </html>