{"id":2153,"date":"2020-02-20T18:20:02","date_gmt":"2020-02-20T10:20:02","guid":{"rendered":"http:\/\/ufqi.com\/blog\/?p=2153"},"modified":"2020-02-20T18:20:02","modified_gmt":"2020-02-20T10:20:02","slug":"base62x-codec-in-c-plus-plus","status":"publish","type":"post","link":"https:\/\/ufqi.com\/blog\/base62x-codec-in-c-plus-plus\/","title":{"rendered":"Base62x\u7f16\u89e3\u7801\u5f00\u6e90\u7c7b\u5e93\u589e\u52a0C++\u7248\u672c"},"content":{"rendered":"<p>2020\u5e74\u4ee5\u6765\u8fd1\u4e24\u4e2a\u6708\u6765\uff0c<a href=\"https:\/\/ufqi.com\/news\/ulonglist.2286.html\">\u65b0\u51a0\u80ba\u708e<\/a>\u00a0\u75ab\u60c5\u8086\u8650\u4e2d\u534e\u5927\u5730\uff0c\u4e5d\u6d32\u540c\u60b2\uff0c\u56db\u6d77\u6050\u614c\uff0c\u552f\u671b\u708e\u9ec4\u5b50\u5b59\u540c\u4ec7\u654c\u5ffe\uff0c\u5c06\u4f20\u67d3\u6027\u75c5\u6bd2\u65e9\u65e5\u9694\u79bb\u5e76\u6355\u83b7\u8fdb\u7262\u7b3c\uff0c\u6253\u5165\u5341\u516b\u5c42\u5730\u72f1\uff0c\u6c38\u4e16\u4e0d\u5f97\u7ffb\u8eab\uff01<\/p>\n<p>\u81ea\u6211\u56da\u7981\u4e4b\u4f59\uff0c\u5b89\u6392\u65f6\u95f4\u5bf9 <a href=\"https:\/\/ufqi.com\/dev\/base62x\/\">-Base62x<\/a>\u00a0\u7f16\u89e3\u7801\u7a0b\u5e8f\u8fdb\u884c\u7ffb\u9605\uff0c\u540c\u65f6\u8003\u8651\u5e76\u589e\u52a0\u4e86 Base62x \u7f16\u89e3\u7801\u7a0b\u5e8f\u7684 C++\u7248\u672c\u3002<\/p>\n<p>\u8fd9\u662f\u7ee72016\u5e74\u589e\u52a0 Base62x in Java, 2017\u5e74\u589e\u52a0 Base62x in JavaScript, 2018\u5e74\u589e\u52a0 Base62x in Perl, 2019\u5e74\u589e\u52a0 Base62x in Python\u4e4b\u540e\u7684\u53c8\u4e00\u4e2a\u65b0\u8bed\u8a00\u7248\u672c\uff0c\u6b64\u540e\uff0cC++\u7684\u5e94\u7528\u9879\u76ee\uff0c\u53ef\u4ee5\u76f4\u63a5\u4e0b\u8f7d\u4f7f\u7528\u5373\u53ef\u3002Base62x \u7f16\u89e3\u7801\u7684\u5b9e\u73b0\uff0c\u9996\u5148\u662fC\u8bed\u8a00\u7248\u672c\u3002<\/p>\n<p>\u8ddd\u79bb\u4e0a\u6b21\u65b0\u589e\u5e76\u5b8c\u5584 <a href=\"https:\/\/ufqi.com\/blog\/base62x-encode-imprv-and-base62x-in-python\/\">Base62x in Python<\/a>\u00a0\u5df2\u7ecf\u6709\u5dee\u4e0d\u591a\u4e00\u5e74\u7684\u65f6\u95f4\uff0c\u5728\u8fd9\u671f\u95f4\uff0c Base62x \u5f97\u5230\u66f4\u5e7f\u6cdb\u7684\u5e94\u7528\u548c\u90e8\u7f72\uff0c\u4e5f\u5728 -Github \u4e0a\u83b7\u5f97\u66f4\u591a\u7684\u70b9\u8d5e\u3002\u8fd9\u662f\u4ee4\u4eba\u6b23\u6170\u7684\u3002<\/p>\n<p>Base62x in C++ \u7684\u7a0b\u5e8f\u4ee3\u7801\u5305\u62ec\u4e24\u90e8\u5206\uff1a<\/p>\n<ol>\n<li><strong>Base62x.class.hpp<\/strong><br \/>\u8fd9\u662f Base62x \u7684C++\u7248\u672c\u7684\u4e3b\u4f53\u7a0b\u5e8f\uff0c\u7528\u4e8e\u6784\u5efa Base62x \u5bf9\u8c61\u53ca\u5176\u4e24\u4e2a\u4e3b\u8981\u65b9\u6cd5\uff1a encode\/decode .<br \/>\u53e6\u5916\u8fd8\u6709\u4e00\u4e9b\u8f85\u52a9\u5de5\u5177\u65b9\u6cd5.\n<\/li>\n<li><strong>Base62x_test.cpp<\/strong><br \/><strong>\u8fd9<\/strong>\u662f\u4e3a\u6d4b\u8bd5 Base62x in C++ \u800c\u7f16\u5199\u7684\u8f85\u52a9\u7a0b\u5e8f\uff0c\u4e3b\u8981\u7ed9\u51fa\u8c03\u7528 Base62x in C++\u7684\u6837\u4f8b\u3002\n<p>Base62x in C++\u7684\u4f7f\u7528\u6837\u4f8b<\/p>\n<p># include \u201cBase62x.class.hpp\u201d<\/p>\n<p>using namespace std;<br \/>\/\/- init.<br \/>Base62x myb62x;<br \/>char *input = &#8220;Hello Base62x!\\n&#8221;;<br \/>char *output;<br \/>int ibase = 0; \/\/ zero for string<br \/>\/\/- encode<br \/>output = myb62x.encode(input, ibase);<br \/>\/\/- decode<br \/>int obase = ibase<br \/>input = myb62x.decode(output, obase);<\/li>\n<\/ol>\n<p>\u501f\u52a9 C++ \uff08C with class\uff09\u7684\u9762\u5411\u5bf9\u8c61\u652f\u6301\uff0cBase62x in C++\u51e0\u4e4e\u53ef\u4ee5\u501f\u7528 Base62x in Java\u7684\u903b\u8f91\u548c Base62x in C\u7684\u4ee3\u7801\uff0c\u878d\u5408\u800c\u6210\u5373\u53ef\u3002<\/p>\n<p>\u622a\u6b62\u76ee\u524d\uff082020\u5e742\u6708\uff09\uff0cBase62x \u5df2\u7ecf\u53ef\u4ee5\u63d0\u4f9b\u7684\u7f16\u7a0b\u8bed\u8a00\u7248\u672c\u5305\u62ec C, Java, PHP, JavaScript, Perl, Python, C++. <br \/>\u5176\u4e2dBase62x in JavaScript \u8fd8\u6709\u4e24\u4e2a\u5b9e\u73b0\uff0c Base62x.class.js \u548c <a href=\"https:\/\/www.npmjs.com\/package\/base62x\">npm base62x<\/a>.<\/p>\n<p>2019\u5e74\uff0cBase62x \u7684\u76f8\u5173\u8bf4\u660e\u5185\u5bb9\u8fd8\u6ca1\u5199\u5165\u7f51\u4e0a\u5404\u4e2a\u4e3b\u8981\u77e5\u8bc6Wiki\u7ad9\u70b9\uff0c\u7531\u6b64\u4e5f\u4f20\u64ad\u7ed9\u66f4\u591a\u7684\u4eba\u3002\u6b64\u5916\uff0c<a href=\"https:\/\/www.researchgate.net\/publication\/221088109_Base62x_An_alternative_approach_to_Base64_for_non-alphanumeric_characters\">Base62x \u8bba\u6587\u76f8\u5173\u7684\u8f85\u52a9\u6750\u6599\u4e5f\u53d1\u5e03\u5728 -ResearchGate \u4e0a<\/a>\uff0c\u53ef\u4f9b\u514d\u8d39\u7ffb\u9605\u3002\u4e0e\u6b64\u540c\u65f6\uff0c\u8fd8\u5b8c\u5584\u4e86 -Base62x \u7684\u5b98\u65b9\u7f51\u9875\uff0c\u8ba9\u5728\u7ebf\u7f16\u89e3\u7801\u4f53\u9a8c\u3001\u6d4f\u89c8\u548c\u7ffb\u9605\u66f4\u7b80\u4fbf\u5feb\u6377\u3002<\/p>\n<p>\u7c4d\u6b64\uff0c\u611f\u8c22\u4e3a Base62x \u7684\u6e90\u4ee3\u7801\u548c\u8bf4\u660e\u6587\u6863\u505a\u51fa\u8d21\u732e\u7684\u670b\u53cb\u4eec\uff0c\u4ed6\u4eec\u7684\u540d\u5b57\u90fd\u8bb0\u8f7d\u5728 -Github\u7684\u4ee3\u7801\u5e93\u91cc\u6216\u8005\u77e5\u8bc6Wiki\u7ad9\u70b9\u91cc\uff0c\u8c22\u8c22\u4f60\u4eec\uff01<\/p>\n<p>\u6700\u597d\u7684\u7248\u672c\u6c38\u8fdc\u662f\u4e0b\u4e00\u4e2a\u7248\u672c\uff0c\u7ee7\u7eed\u671f\u5f85 Base62x \u80fd\u4e3a\u6280\u672f\u540c\u884c\u4eec\u5e26\u6765\u5e2e\u52a9\uff0c\u4e5f\u671f\u5f85\u4e00\u8d77\u4fee\u6539\u8ba2\u6b63\uff0c\u4f7f\u5176\u65e5\u76ca\u5b8c\u5584\u3002<\/p>\n<hr \/>\n<p><img src=\"https:\/\/ufqi.com\/blog\/wp-content\/uploads\/2016\/09\/b62x-icon-201306.png\" \/><br \/>Base62x: An alternative approach to Base64 for only-alphanumeric characters in output.<br \/>Base62x is an non-symbolic Base64 encoding scheme. It can be used safely in computer file systems, programming languages for data exchange, internet communication systems, and is an ideal substitute and successor of many variants of Base64 encoding scheme.<\/p>\n<p>Base62x \u662f\u4e00\u79cd\u65e0\u7b26\u53f7\u7684Base64\u7f16\u7801\u65b9\u6848\u3002<br \/>\u5728\u8ba1\u7b97\u673a\u6587\u4ef6\u7cfb\u7edf\u3001\u7f16\u7a0b\u8bed\u8a00\u6570\u636e\u4ea4\u6362\u3001\u4e92\u8054\u7f51\u7edc\u901a\u4fe1\u7cfb\u7edf\u4e2d\u53ef\u4ee5\u5b89\u5168\u5730\u4f7f\u7528\uff0c\u540c\u65f6\u662f\u5404\u79cd\u53d8\u79cdBase64\u7f16\u7801\u65b9\u6848\u7684\u7406\u60f3\u66ff\u4ee3\u54c1\u3001\u7ee7\u4efb\u8005\u3002<\/p>\n<p><img loading=\"lazy\" class=\"\" src=\"https:\/\/ufqi.com\/dev\/base62x\/base62x-algorithm.PNG\" alt=\"base62x-algorithm\" width=\"486\" height=\"414\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>2020\u5e74\u4ee5\u6765\u8fd1\u4e24\u4e2a\u6708\u6765\uff0c\u65b0\u51a0\u80ba\u708e\u00a0\u75ab\u60c5\u8086\u8650\u4e2d\u534e\u5927\u5730\uff0c\u4e5d\u6d32\u540c\u60b2\uff0c\u56db\u6d77\u6050\u614c\uff0c\u552f\u671b\u708e &hellip; <a href=\"https:\/\/ufqi.com\/blog\/base62x-codec-in-c-plus-plus\/\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[161,6,2],"tags":[154,333,332],"_links":{"self":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts\/2153"}],"collection":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/comments?post=2153"}],"version-history":[{"count":10,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts\/2153\/revisions"}],"predecessor-version":[{"id":2163,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts\/2153\/revisions\/2163"}],"wp:attachment":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/media?parent=2153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/categories?post=2153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/tags?post=2153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}