{"id":3324,"date":"2018-11-06T14:20:12","date_gmt":"2018-11-06T06:20:12","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3324"},"modified":"2018-11-06T14:20:12","modified_gmt":"2018-11-06T06:20:12","slug":"%e7%9f%ad%e7%bd%91%e5%9d%80%e7%9a%843%e7%a7%8d%e7%ae%97%e6%b3%95%ef%bc%9a%e8%bf%9b%e5%88%b6%e7%ae%97%e6%b3%95%e3%80%81%e9%9a%8f%e6%9c%ba%e6%95%b0%e7%ae%97%e6%b3%95%e5%92%8chash%e7%ae%97%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3324","title":{"rendered":"\u77ed\u7f51\u5740\u76843\u79cd\u7b97\u6cd5\uff1a\u8fdb\u5236\u7b97\u6cd5\u3001\u968f\u673a\u6570\u7b97\u6cd5\u548cHASH\u7b97\u6cd5"},"content":{"rendered":"<p>\n\t\u5728Web 2.0\u7684\u4eca\u5929\uff0c\u4e0d\u5f97\u4e0d\u8bf4\uff0c\u77ed\u7f51\u5740\u5df2\u7ecf\u662f\u4e00\u4e2a\u6f6e\u6d41\u3002\u524d\u6bb5\u65f6\u95f4\u6709\u4eba\u5728\u516c\u4f17\u53f7\u91cc\u95ee\u6211 java \u5982\u4f55\u5b9e\u73b0\u77ed\u7f51\u5740\u529f\u80fd\uff0c\u4eca\u5929\u6211\u5c31\u62bd\u4e2a\u65f6\u95f4\uff0c\u7b80\u5355\u7684\u8bf4\u4e00\u4e0b\u77ed\u7f51\u5740\u7684\u76f8\u5173\u7b97\u6cd5\uff01\n<\/p>\n<p>\n\t\u77ed\u7f51\u5740\uff0c\u6216\u8005\u8bf4\u77ed\u57df\u540d\u3002\u987e\u540d\u601d\u4e49\uff0c\u5c31\u662f\u628a\u957f\u7684 URL \u8f6c\u6210\u77ed\u7684 URL, \u73b0\u5728\u63d0\u4f9b\u8fd9\u79cd\u670d\u52a1\u7684\u6709\u5f88\u591a\u516c\u53f8\u3002\u6bd4\u5982\u767e\u5ea6\u7684\uff0c\u65b0\u6d6a\u7684\uff0c\u8c37\u6b4c\u7684\u7b49\u3002\n<\/p>\n<h2>\n\t\u77ed\u7f51\u5740\u7684\u89e3\u6790\u8fc7\u7a0b<br \/>\n<\/h2>\n<p>\n\t\u5f53\u6211\u4eec\u5728\u6d4f\u89c8\u5668\u91cc\u8f93\u5165 https:\/\/dwz.cn\/fJPYNNoX \u56de\u8f66\u540e\uff0cDNS\u9996\u5148\u89e3\u6790\u83b7\u5f97 https:\/\/dwz.cn\/ \u7684 IP \u5730\u5740\u3002\u5f53DNS\u83b7\u5f97IP\u5730\u5740\u4ee5\u540e\uff0c\u4f1a\u5411\u8fd9\u4e2a\u5730\u5740\u53d1\u9001HTTP GET\u8bf7\u6c42\uff0c\u8fd9\u4e2a\u65f6\u5019 https:\/\/dwz.cn\/\u670d\u52a1\u5668\u4f1a\u628a\u8bf7\u6c42\u901a\u8fc7 HTTP 302 \u91cd\u5b9a\u5411\u5230\u5bf9\u5e94\u7684\u957fURL https:\/\/www.xttblog.com \u3002\u6d4f\u89c8\u5668\u4f1a\u518d\u6b21\u53d1\u8d77\u8bf7\u6c42\uff0c\u8bf7 https:\/\/www.xttblog.com \u7f51\u5740\u3002\n<\/p>\n<p>\n\t\u6587\u5b57\u5df2\u7ecf\u89e3\u91ca\u7684\u5f88\u660e\u767d\u4e86\uff01\u770b\u4e0d\u660e\u767d\u7684\u770b\u4e0b\u56fe\uff1a\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\u77ed\u7f51\u5740\u89e3\u6790\u8fc7\u7a0b\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/decode-short-url.png\" style=\"width: 492px;height: 367px\" \/>\n<\/p>\n<p>\n\t\u660e\u767d\u4e86\u77ed\u7f51\u5740\u7684\u89e3\u6790\u8fc7\u7a0b\u540e\uff0c\u6211\u4eec\u6765\u8bf4\u77ed\u7f51\u5740\u7684\u5b9e\u73b0\u7b97\u6cd5\u3002\n<\/p>\n<p>\n\t\u6839\u636e GitHub \u4e0a star \u6570\u91cf\u6700\u591a\u7684\u5341\u4e2a\u77ed\u7f51\u5740\u670d\u52a1\u5bf9\u5e94\u7684\u7b97\u6cd5\uff0c\u5927\u81f4\u5206\u4e3a\u4e09\u7c7b\uff1a\u8fdb\u5236\u7b97\u6cd5\u3001\u968f\u673a\u6570\u7b97\u6cd5\u548cHASH\u7b97\u6cd5\u3002 \u4e0b\u9762\u6211\u4eec\u5206\u522b\u8bf4\u8bf4\u5b83\u4eec\u7684\u5b9e\u73b0\u539f\u7406\uff01\n<\/p>\n<h2>\n\t\u77ed\u7f51\u5740\u8fdb\u5236\u7b97\u6cd5<br \/>\n<\/h2>\n<p>\n\t\u7b97\u6cd5\u7b80\u8ff0\uff1a\u4e00\u4e2a\u4ee5\u6570\u5b57\u3001\u5927\u5c0f\u5199\u5b57\u6bcd\u517162\u4e2a\u5b57\u7b26\u7684\u4efb\u610f\u8fdb\u5236\u7684\u7b97\u6cd5\u3002&nbsp;\n<\/p>\n<p>\n\t\u6570\u636e\u5e93\u4e2dID\u9012\u589e\uff0c\u5f53ID\u4e3a233\uff0c\u5219\u5bf9\u5e94\u77ed\u7f51\u5740\u8ba1\u7b97\u8fc7\u7a0b\u5982\u4e0b\uff1a\n<\/p>\n<ol>\n<li>\n\t\t\u8bbe\u7f6e\u5e8f\u5217\u4e3a&ldquo;0123456789abcdefghijklmnopqrstuvwxyz&rdquo;&nbsp;\n\t<\/li>\n<li>\n\t\t233\/36=6&nbsp;\n\t<\/li>\n<li>\n\t\t233%36= 17&nbsp;\n\t<\/li>\n<li>\n\t\t\u4f9d\u6b21\u53d6\u4e0a\u8ff0\u5b57\u7b26\u76846\u4f4d\uff0c17\u4f4d\uff0c\u5219\u4e3a6h&nbsp;\n\t<\/li>\n<\/ol>\n<p>\n\t\u5176\u751f\u6210\u4e4b\u540e\u7684\u77ed\u7f51\u5740\u4e3axx.xx\/6h \u3002\n<\/p>\n<h2>\n\t\u77ed\u7f51\u5740\u968f\u673a\u6570\u7b97\u6cd5<br \/>\n<\/h2>\n<p>\n\t\u7b97\u6cd5\u7b80\u8ff0\uff1a\u6bcf\u6b21\u5bf9\u5019\u9009\u5b57\u7b26\u8fdb\u884c\u4efb\u610f\u6b21\u968f\u673a\u4f4d\u6570\u9009\u62e9\uff0c\u62fc\u63a5\u4e4b\u540e\u68c0\u67e5\u662f\u5426\u91cd\u590d&nbsp;\n<\/p>\n<p>\n\t\u82e5\u8981\u6c42\u4f4d\u6570\u4e3a2\uff0c\u5219\u5176\u5bf9\u5e94\u77ed\u5730\u5740\u4e3a\u8ba1\u7b97\u8fc7\u7a0b\u5982\u4e0b\uff1a\n<\/p>\n<ol>\n<li>\n\t\t\u8bbe\u7f6e\u5b57\u7b26\u5e8f\u5217&ldquo;0123456789abcdefghijklmnopqrstuvwxyz&rdquo;&nbsp;\n\t<\/li>\n<li>\n\t\t\u6839\u636e\u5b57\u7b26\u4e2a\u6570\u8bbe\u7f6e\u6700\u5927\u503c\u4e3a35\uff0c\u6700\u5c0f\u503c\u4e3a0\uff0c\u53d62\u6b21\u968f\u673a\u6570\u5047\u8bbe\u4e3a\uff1a6,17&nbsp;\n\t<\/li>\n<li>\n\t\t\u4f9d\u6b21\u53d6\u4e0a\u8ff0\u5b57\u7b26\u76846\u4f4d\u548c17\u4f4d\uff0c\u5219\u4e3a6h&nbsp;\n\t<\/li>\n<\/ol>\n<p>\n\t\u5176\u751f\u6210\u4e4b\u540e\u7684\u77ed\u7f51\u5740\u4e3axx.xx\/6h \u3002\n<\/p>\n<h2>\n\t\u77ed\u7f51\u5740HASH\u7b97\u6cd5<br \/>\n<\/h2>\n<p>\n\t\u7b97\u6cd5\u7b80\u8ff0\uff1a\u5bf9id\u8fdb\u884chash\u64cd\u4f5c\uff08 \u53ef\u9009\uff1a\u5229\u7528\u968f\u673a\u6570\u8fdb\u884c\u52a0\u76d0\uff09\uff0c\u5e76\u68c0\u67e5\u662f\u5426\u91cd\u590d&nbsp;\n<\/p>\n<p>\n\t\u8bbe\u7f6eID\u81ea\u589e\uff0c\u82e5ID=233\uff0c\u5219\u5176\u5bf9\u5e94\u77ed\u5730\u5740\u4e3a\u8ba1\u7b97\u8fc7\u7a0b\u5982\u4e0b\uff1a&nbsp;\n<\/p>\n<ol>\n<li>\n\t\t\u53d6\u968f\u673a\u6570\u4e3a\u76d0&nbsp;\n\t<\/li>\n<li>\n\t\t\u5bf9233\u8fdb\u884csha1\u52a0\u5bc6\u4e3a\uff1a aaccb8bb2b4c442a7c16a9b209c9ff448c6c5f35:2&nbsp;\n\t<\/li>\n<li>\n\t\t\u8981\u6c42\u4f4d\u6570\u4e3a7\uff0c\u76f4\u63a5\u53d6\u4e0a\u8ff0\u52a0\u5bc6\u7ed3\u679c\u7684\u524d7\u4f4d\u4e3a\uff1aaaccb8&nbsp;\n\t<\/li>\n<\/ol>\n<p>\n\t\u5176\u751f\u6210\u4e4b\u540e\u7684\u77ed\u7f51\u5740\u4e3axx.xx\/2e8c027 \u3002\n<\/p>\n<h2>\n\t\u77ed\u7f51\u5740\u7684\u672c\u8d28<br \/>\n<\/h2>\n<p>\n\t\u77ed\u7f51\u5740\u672c\u8d28\u4e0a\u662f\u5b9e\u73b0\u4e86\u4e00\u4e2a\u6620\u5c04\u51fd\u6570 f: X -&gt; Y \u3002\u800c\u8fd9\u4e2a\u6620\u5c04\u51fd\u6570\u5fc5\u987b\u540c\u65f6\u5177\u6709\u4e24\u4e2a\u7279\u70b9\uff1a\n<\/p>\n<ol>\n<li>\n\t\t\u5982\u679c x1 != x2, \u5219 f (x1) != f(x2);\n\t<\/li>\n<li>\n\t\t\u5bf9\u4e8e\u6bcf\u4e00\u4e2a y, \u80fd\u591f\u627e\u5230\u552f\u4e00\u7684\u4e00\u4e2a x \u4f7f\u5f97 f(x) = y;\n\t<\/li>\n<\/ol>\n<p>\n\t\u5bf9\u4e8e\u4efb\u4f55\u7684\u7ebf\u6027\u51fd\u6570\uff0c\u6bd4\u5982 f(x) = 2x\uff0c\u90fd\u6ee1\u8db3\u8fd9\u6837\u7684\u6761\u4ef6\u3002\n<\/p>\n<h2>\n\tjava \u5b9e\u73b0\u77ed\u7f51\u5740<br \/>\n<\/h2>\n<p>\n\t\u6839\u636e\u4e0a\u9762\u7684\u89e3\u91ca\uff0c\u4e0b\u9762\u6211\u6765\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684\u77ed\u7f51\u5740\u7b97\u6cd5\uff01\n<\/p>\n<pre class=\"brush:java;\">\r\npublic class ShortUrlTest {\r\n    private static final String ALPHABET =\r\n&quot;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&quot;;\r\n    private static final int    BASE     = ALPHABET.length();\r\n    public static String encode(int num) {\r\n        StringBuilder sb = new StringBuilder();\r\n        while ( num &gt; 0 ) {\r\n            sb.append( ALPHABET.charAt( num % BASE ) );\r\n            num \/= BASE;\r\n        }\r\n        return sb.reverse().toString();\r\n    }\r\n    public static int decode(String str) {\r\n        int num = 0;\r\n        for ( int i = 0; i &lt; str.length(); i++ )\r\n            num = num * BASE + ALPHABET.indexOf(str.charAt(i));\r\n        return num;\r\n    }\r\n    public static void main(String[] args) {\r\n        \/\/ \u5047\u8bbe www.xttblog.com \u5bf9\u5e94\u7684ID\u662f1\r\n        encode(1);\r\n    }\r\n}<\/pre>\n<h2>\n\t\u77ed\u7f51\u5740\u91cd\u5b9a\u5411<br \/>\n<\/h2>\n<p>\n\t\u5173\u4e8e\u77ed\u7f51\u5740\u7684\u91cd\u5b9a\u5411\uff0c\u6211\u5efa\u8bae\u4f7f\u7528302\u3002\u4e0d\u5efa\u8bae\u4f7f\u7528301\u3002\u56e0\u4e3a302\u65b9\u4fbf\u7edf\u8ba1\u548c\u5206\u6790\u7528\u6237\u5c5e\u6027\u7b49\u6570\u636e\u3002\u5927\u5bb6\u53ef\u4ee5\u53c2\u8003\u767e\u5ea6\u3001\u65b0\u6d6a\u3001\u8c37\u6b4c\u7b49\u662f\u5426\u90fd\u4f7f\u7528\u7684\u662f302\u72b6\u6001\uff01\n<\/p>\n<p>\n\t\u6700\u540e\u63d0\u9192\u5927\u5bb6\u4e00\u4e0b\uff0c\u5b9e\u73b0\u77ed\u7f51\u5740\u4e00\u5b9a\u8981\u6ce8\u610f\u5b89\u5168\u95ee\u9898\u3002\u6bd4\u5982\uff0c\u77ed\u7f51\u5740\u5e38\u89c1\u7684SSRF\u5b89\u5168\u95ee\u9898\u3001XSS\u3001SQL\u6ce8\u5165\u7b49\u95ee\u9898\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=3324\">\u77ed\u7f51\u5740\u76843\u79cd\u7b97\u6cd5\uff1a\u8fdb\u5236\u7b97\u6cd5\u3001\u968f\u673a\u6570\u7b97\u6cd5\u548cHASH\u7b97\u6cd5<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u5728Web 2.0\u7684\u4eca\u5929\uff0c\u4e0d\u5f97\u4e0d\u8bf4\uff0c\u77ed\u7f51\u5740\u5df2\u7ecf\u662f\u4e00\u4e2a\u6f6e\u6d41\u3002\u524d\u6bb5\u65f6\u95f4\u6709\u4eba\u5728\u516c\u4f17\u53f7\u91cc\u95ee\u6211 java \u5982\u4f55\u5b9e\u73b0\u77ed\u7f51\u5740\u529f [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6],"tags":[894,1447,1337,1610,1739],"class_list":["post-3324","post","type-post","status-publish","format-standard","hentry","category-java","category-yyzt","tag-atlas","tag-lucene","tag-replugin","tag-rete","tag-1739"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3324"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3324\/revisions"}],"predecessor-version":[{"id":3325,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3324\/revisions\/3325"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}