123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>crypty</title>
- <script src="/js/jquery-1.7.2.js"></script>
- <script src="/js/aes.js"></script>
- <script src="/js/tripledes.js"></script>
- <script src="/js/rabbit.js"></script>
- <script src="/js/rc4.js"></script>
- <link rel="stylesheet" href="/css/bootstrap.min.css">
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Anonymous+Pro:ital,wght@0,400;0,700;1,400;1,700
- &family=Noto+Serif+SC:wght@300;400;500;600;700&display=swap" rel="stylesheet">
- <link rel="stylesheet" href="/css/style.css">
- <style>
- .sel:hover {
- background-color: rgb(220, 220, 220);
- cursor: pointer;
- }
- .sel input:hover {
- cursor: pointer;
- }
- </style>
- </head>
- <body>
- <a class="btn btn-info" href="/"><span class="glyphicon glyphicon-home" aria-hidden="true"></span> 返回</a>
- <div>
- <div class="row">
- <div class="col-lg-6 col-md-6 col-xs-12">
- 明文:
- <textarea class="col-xs-12" rows="10" name="message" id="msg_source" class="text_source"></textarea>
- </div>
- </div>
- <div class="row" style="padding:5px">
- <div class="col-lg-6 col-md-6 col-xs-12">
- <div class="input-group" style="margin:5px">
- <span class="input-group-addon">加密算法</span>
- <span class="input-group-addon sel" value="aes"><input type="radio" name="Etype" value="aes" checked="checked" />AES</span>
- <span class="input-group-addon sel" value="des"><input type="radio" name="Etype" value="des" />DES</span>
- <span class="input-group-addon sel" value="rc4"><input type="radio" name="Etype" value="rc4" />RC4</span>
- <span class="input-group-addon sel" value="rabbit"><input type="radio" name="Etype" value="rabbit" />Rabbit</span>
- <span class="input-group-addon sel" value="tripledes"><input type="radio" name="Etype" value="tripledes" />TripleDes</span>
- </div>
- <div class="input-group" style="margin:5px">
- <span class="input-group-addon">密码</span>
- <input type="text" class="form-control" id="pwd" />
- </p>
- <span class="input-group-btn">
- <button class="btn btn-default" onclick="encrypt();" style="text-shadow: rgb(185, 185, 185) 3px 2px 4px;"><span class="glyphicon glyphicon-arrow-down" aria-hidden="true"></span> 加密</button>
- <button class="btn btn-default" onclick="decrypt();" style="text-shadow: rgb(185, 185, 185) 3px 2px 4px;"><span class="glyphicon glyphicon-arrow-up" aria-hidden="true"></span> 解密</button>
- </span>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-6 col-md-6 col-xs-12">
- <div>密文:</div>
- <textarea rows="10" class="col-xs-12" name="cipher" id="encrypt_result" onclick="this.select();"></textarea>
- </div>
- </div>
- <script>
- $('span').on("click", function () {
- $('input[value="' + $(this).attr('value') + '"]').attr('checked', 'checked')
- })
- function encrypt() {
- switch ($('input[name="Etype"]:checked').val()) {
- case "aes":
- $("#encrypt_result").val(CryptoJS.AES.encrypt($("#msg_source").val(), $("#pwd").val()));
- break;
- case "des":
- $("#encrypt_result").val(CryptoJS.DES.encrypt($("#msg_source").val(), $("#pwd").val()));
- break;
- case "rabbit":
- $("#encrypt_result").val(CryptoJS.Rabbit.encrypt($("#msg_source").val(), $("#pwd").val()));
- break;
- case "rc4":
- $("#encrypt_result").val(CryptoJS.RC4.encrypt($("#msg_source").val(), $("#pwd").val()));
- break;
- case "tripledes":
- $("#encrypt_result").val(CryptoJS.TripleDES.encrypt($("#msg_source").val(), $("#pwd").val()));
- break;
- }
- }
- function decrypt() {
- switch ($('input[name="Etype"]:checked').val()) {
- case "aes":
- $("#msg_source").val(CryptoJS.AES.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
- break;
- case "des":
- $("#msg_source").val(CryptoJS.DES.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
- break;
- case "rabbit":
- $("#msg_source").val(CryptoJS.Rabbit.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
- break;
- case "rc4":
- $("#msg_source").val(CryptoJS.RC4.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
- break;
- case "tripledes":
- $("#msg_source").val(CryptoJS.TripleDES.decrypt($("#encrypt_result").val(), $("#pwd").val()).toString(CryptoJS.enc.Utf8));
- break;
- }
- }
- </script>
- </div>
- </body>
|