{"id":4110,"date":"2013-11-14T00:13:52","date_gmt":"2013-11-13T16:13:52","guid":{"rendered":"https:\/\/lttt.blog.ustc.edu.cn\/?p=4110"},"modified":"2013-11-14T00:13:52","modified_gmt":"2013-11-13T16:13:52","slug":"%e7%9f%a9%e9%98%b5%e5%8a%a0%e5%af%86%e7%9a%84%e4%b8%80%e7%a7%8d%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/lttt.vanabel.cn\/?p=4110","title":{"rendered":"\u77e9\u9635\u52a0\u5bc6\u7684\u4e00\u79cd\u5b9e\u73b0"},"content":{"rendered":"<p>\u6f14\u793a\u5730\u5740:http:\/\/runjs.cn\/detail\/zuagsvix.<br \/>\n\u529f\u80fd\u6982\u8ff0. \u8f93\u5165\u4e00\u4e2a2\u9636\u77e9\u9635\u4f5c\u4e3a\u5bc6\u94a5. \u8bfb\u53d6\u8f93\u5165\u6587\u672c\u4e2d\u7684\u5b57\u6bcd, \u5c06\u5176\u6620\u5c04\u5230\u6570\u5b571\u523026, \u7136\u540e\u4e24\u4e24\u53d6\u51fa\u4f9d\u6b21\u4f5c\u4e3a\u4e00\u4e2a\u5411\u91cf. \u7ecf\u5bc6\u94a5\u53d8\u6362(\u77e9\u9635\u4e58\u6cd5)\u540e, \u518d\u901a\u8fc7\u6570\u5b57\u6620\u5c04\u56de\u5b57\u6bcd\u5f97\u5230\u5bc6\u6587.<br \/>\n<a href=\"https:\/\/lttt.vanabel.cn\/wp-content\/uploads\/2013\/11\/matrix_crypt.png\"><img decoding=\"async\" src=\"https:\/\/lttt.vanabel.cn\/wp-content\/uploads\/2013\/11\/matrix_crypt.png\" alt=\"matrix_crypt\"\/><\/a><br \/>\n<!--more--><\/p>\n<pre lang=\"javascript\">\n$(document).ready(function () {\n    $('#s').click(function () {\n        \/\/\u83b7\u53d6\u8f93\u5165\u6587\u672c\u53ca\u5176\u957f\u5ea6\n        var str = $('#input').val();\n        var len = str.length;\n        \/\/\u83b7\u53d6\u5b57\u6bcd\u4f4d\u7f6e\n        var arrayposi = [];\n        var k = 0;\n        var kk = 0;\n        while (k < = len) {\n            if (str[k] >= 'A' & str[k] < = 'z') {\n                arrayposi[kk++] = k;\n            }\n            k++;\n        }\n        \/\/\u603b\u5b57\u6bcd\u4e2a\u6570\n        var lenposi = arrayposi.length;\n        \/\/\u5982\u679c\u662f\u5947\u6570\u4e2a\u5b57\u6bcd, \u5219\u4e22\u6389\u4e00\u4e2a\n        if (1 + lenposi % 2) {\n            lenposi -= 1;\n        }\n\n        \/\/\u83b7\u53d6\u52a0\u5bc6\u77e9\u9635\n        var matin = $('#matrix').val();\n        var mat = [];\n        mat = matin.split(',');\n        \/\/\u683c\u5f0f\u68c0\u67e5\n        function isrange(a) {\n            return (a >= 0 & a < = 26) ? true : false;\n        }\n        if (mat.length != 4) {\n            alert('Wrong format! Length shoud be 7! Example: 1,2,3,5');\n            return false;\n        } else\n        if (!(isrange(mat[0]) &#038; isrange(mat[1]) &#038; isrange(mat[2]) &#038; isrange(mat[3]))) {\n            alert('Wrong format! Input 4 numbers! Example: 1,2,3,5');\n            return false;\n        } else {\n            var a = mat[0];\n            var b = mat[1];\n            var c = mat[2];\n            var d = mat[3];\n        }\n        \/\/\u4e92\u7d20\u68c0\u67e5\n        function gcd(a, b) {\n            return (b == 0) ? a : gcd(b, a % b);\n        }\n        var gcddet = Math.abs(gcd(26, a * d - b * c));\n        if (gcddet != 1) {\n            alert('Wrong format! ' + gcddet + ' is not invertible! Example: 1,2,3,5');\n            return false;\n        }\n        \/\/\u5927\u5c0f\u5199\u5224\u65ad\n        function isAa(a) {\n            return (a >= 'a' & a < = 'z') ? 0 : 1;\n        }\n        \/\/\u5927\u5c0f\u5199\u521d\u503c\n        function iniAa(a) {\n            return (isAa(a)) ? 'A'.charCodeAt(0) : 'a'.charCodeAt(0);\n        }\n\n        \/\/\u77e9\u9635\u52a0\u5bc6:\u6bcf\u4e24\u4e2a\u5143\u7d20\n        function cal(x, y) {\n            var arrayxy = [];\n            var xx, yy;\n            if (isAa(x)) {\n                xx = x.charCodeAt(0) - 'A'.charCodeAt(0);\n            } else {\n                xx = x.charCodeAt(0) - 'a'.charCodeAt(0);\n            }\n            if (isAa(y)) {\n                yy = y.charCodeAt(0) - 'A'.charCodeAt(0);\n            } else {\n                yy = y.charCodeAt(0) - 'a'.charCodeAt(0);\n            }\n            arrayxy[0] = (xx * a + yy * b) % 26;\n            arrayxy[1] = (xx * c + yy * d) % 26;\n            return arrayxy;\n        }\n        var strout = [];\n        \/\/\u975e\u5b57\u6bcd\u7684\u8f6c\u5f55\n        $.each(str, function (i, n) {\n            var num = 0; \/\/\u975e\u5b57\u6bcd\u7684\u5b57\u7b26\u4e2a\u6570\n            if (i + num != n) {\n                num++;\n            }\n            strout[i] = str[i];\n        });\n        \/\/\u77e9\u9635\u52a0\u5bc6:\u5206\u7ec4\u904d\u5386\n        var k = 0;\n        while (k <= lenposi - 1) {\n            {\n                var tempxy = [];\n                var x = str[arrayposi[k]];\n                var y = str[arrayposi[k + 1]];\n                tempxy = cal(x, y);\n                strout[arrayposi[k]] = String.fromCharCode(tempxy[0] + iniAa(x));\n                strout[arrayposi[k + 1]] = String.fromCharCode(tempxy[1] + iniAa(y));\n            }\n            k = k + 2;\n        }\n\n        $('#output').val(strout.join(''));\n\n    });\n});\n<\/pre>\n<p>\u8bd5\u89e3\u5bc6\u5982\u4e0b\u4e24\u6bb5\u8bdd:<\/p>\n<p>\nKnev, id hhi ockbkg yt fsyan utevdo, uv joeuuks xiooksknc hat yvm xqsvti vc tecmkjdc hhi bkjuvmwwh bctjk yxmqz hodc eunniobyp lpae muvh opqhhmh, anp lo ccmsye ioozs hhi bgqmhu ar ppa eidnt tpa awperiby anl seowh epmfkgz fg qxmqz hha psou af xmfcne itj yr nahuzu&#8217;e Cul evjkptq npam, y lskqzf zuwdiof ra hpa svidkgxc yr myheidl fkekmzue phof rpai yjeqvj piolwzu hhi ooiawk yxmqz gaxqx bpay da hpa awperijkop.<\/p>\n<p>\nEe jerf hhokq nfqhhe pq fo kapn-wlolszf, hhmf whj gev izi ozumfkr keuox; bhof rpay wzu evfweef jk bpaqp Kdeivcj wuvx mbvmhevt mtj idwhqcnaxjm Huitte; phot moozs hhoke, izu Bunw, Bujodny, wtj hhi bcngsuv yr Hotxidoke; phof ry eiocnq npaaw hguhdo, Icdcrvukzfs kzu idepuvgtkr ykope Wev, lshglozs hhugj jeqx fgqmhc ztyy dpa euxcevv cr ppa icdcrvkr; hhmf knevutmh ani Lwbo or Cenmhlkevv piommok lsepfqojybg yr ppaaw evni, uv ss hhm Huitt yr hhi bgyllq no cxbmh wb cdkjssx mt, mtj vc idepuvgte vww Icdcrvukzf, lwouzs uvc zcktjmfkgp qx cyul hhgrgmjtis, ktj wbgmdypwzs uvw dgqmhi ix cyur dwbm, ye pa hpaw ahohd awcs ooep busghq vc oxnwoj hhugb Kkpqny wtj Hotxidoks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6f14\u793a\u5730\u5740:http:\/\/runjs.cn\/detail\/zuagsvix. \u529f\u80fd &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/lttt.vanabel.cn\/?p=4110\"> <span class=\"screen-reader-text\">\u77e9\u9635\u52a0\u5bc6\u7684\u4e00\u79cd\u5b9e\u73b0<\/span> \u9605\u8bfb\u66f4\u591a &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[37,278],"class_list":["post-4110","post","type-post","status-publish","format-standard","hentry","category-net","tag-37","tag-278"],"_links":{"self":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/posts\/4110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4110"}],"version-history":[{"count":0,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/posts\/4110\/revisions"}],"wp:attachment":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}