index.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. <style>
  20. .sel:hover {
  21. background-color: rgb(220, 220, 220);
  22. cursor: pointer;
  23. }
  24. .sel input:hover {
  25. cursor: pointer;
  26. }
  27. </style>
  28. </head>
  29. <body>
  30. <a class="btn btn-info" href="/"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>&nbsp;返回</a>
  31. <div>
  32. <div class="row">
  33. <div class="col-lg-6 col-md-6 col-xs-12">
  34. 明文:
  35. <textarea class="col-xs-12" rows="10" name="message" id="msg_source" class="text_source"></textarea>
  36. </div>
  37. </div>
  38. <div class="row" style="padding:5px">
  39. <div class="col-lg-6 col-md-6 col-xs-12">
  40. <div class="input-group" style="margin:5px">
  41. <span class="input-group-addon">加密算法</span>
  42. <span class="input-group-addon sel" value="aes"><input type="radio" name="Etype" value="aes"
  43. checked="checked" />AES</span>
  44. <span class="input-group-addon sel" value="des"><input type="radio" name="Etype"
  45. value="des" />DES</span>
  46. <span class="input-group-addon sel" value="rc4"><input type="radio" name="Etype"
  47. value="rc4" />RC4</span>
  48. <span class="input-group-addon sel" value="rabbit"><input type="radio" name="Etype"
  49. value="rabbit" />Rabbit</span>
  50. <span class="input-group-addon sel" value="tripledes"><input type="radio" name="Etype"
  51. value="tripledes" />TripleDes</span>
  52. </div>
  53. <div class="input-group" style="margin:5px">
  54. <span class="input-group-addon">密码</span>
  55. <input type="text" class="form-control" id="pwd" />
  56. </p>
  57. <span class="input-group-btn">
  58. <button class="btn btn-default" onclick="encrypt();"
  59. style="text-shadow: rgb(185, 185, 185) 3px 2px 4px;"><span
  60. class="glyphicon glyphicon-arrow-down" aria-hidden="true"></span>&nbsp;加密</button>
  61. <button class="btn btn-default" onclick="decrypt();"
  62. style="text-shadow: rgb(185, 185, 185) 3px 2px 4px;"><span
  63. class="glyphicon glyphicon-arrow-up" aria-hidden="true"></span>&nbsp;解密</button>
  64. </span>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="row">
  69. <div class="col-lg-6 col-md-6 col-xs-12">
  70. <div>密文:</div>
  71. <textarea rows="10" class="col-xs-12" name="cipher" id="encrypt_result"
  72. onclick="this.select();"></textarea>
  73. </div>
  74. </div>
  75. <script>
  76. $('span').on("click", function () {
  77. $('input[value="' + $(this).attr('value') + '"]').attr('checked', 'checked')
  78. })
  79. function encrypt() {
  80. switch ($('input[name="Etype"]:checked').val()) {
  81. case "aes":
  82. $("#encrypt_result").val(CryptoJS.AES.encrypt($("#msg_source").val(), $("#pwd").val()));
  83. break;
  84. case "des":
  85. $("#encrypt_result").val(CryptoJS.DES.encrypt($("#msg_source").val(), $("#pwd").val()));
  86. break;
  87. case "rabbit":
  88. $("#encrypt_result").val(CryptoJS.Rabbit.encrypt($("#msg_source").val(), $("#pwd").val()));
  89. break;
  90. case "rc4":
  91. $("#encrypt_result").val(CryptoJS.RC4.encrypt($("#msg_source").val(), $("#pwd").val()));
  92. break;
  93. case "tripledes":
  94. $("#encrypt_result").val(CryptoJS.TripleDES.encrypt($("#msg_source").val(), $("#pwd").val()));
  95. break;
  96. }
  97. }
  98. function decrypt() {
  99. switch ($('input[name="Etype"]:checked').val()) {
  100. case "aes":
  101. $("#msg_source").val(CryptoJS.AES.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
  102. break;
  103. case "des":
  104. $("#msg_source").val(CryptoJS.DES.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
  105. break;
  106. case "rabbit":
  107. $("#msg_source").val(CryptoJS.Rabbit.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
  108. break;
  109. case "rc4":
  110. $("#msg_source").val(CryptoJS.RC4.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
  111. break;
  112. case "tripledes":
  113. $("#msg_source").val(CryptoJS.TripleDES.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
  114. break;
  115. }
  116. }
  117. </script>
  118. </div>
  119. </body>
  120. </html>