base62x This is Base62x

-1. Base62x Converter online / Base62x 在线编解码


    ↑Input/输入    Output/输出 ↓   


0. What

Base62x: An Alternative Approach to Base64 for non-Alphanumeric Characters.

In computer systems, printable characters include not only 62 alphanumeric characters (0-9, a-z and A-Z) but also non-alphanumeric characters (e.g. *, \, ^, %). Base64 is a commonly used encoding scheme that represents binary data in an ASCII string format. However, for Base64, non-alphanumeric characters (e.g. *, \, ^, %) are problematic for filenames and URLs. For example, "+" is error-prone in URL and "/" is not allowed in filenames. To address this issue, we propose a new method, Base62x, as an alternative approach to Base64. The proposed method is more effective in application development and fully compatible with symbol-sensitive applications, such as, file systems, IP addresses and safe transmission of non-ASCII over the Internet.
By: Zhenxing Liu, Lu Liu, Richard Hill, Yongzhao Zhan

base62x-algorithm
1. Usage:
after download from the link below and compile it, execute like:
shell> ./base62x
Usage: ./base62x <-enc|dec> string
e.g.
shell> ./base62x -enc "abcd"
Output:[OM9ZP0]
shell> ./base62x -dec "OM9ZP0"
Output:[abcd]
shell> ./base62x -enc @#$%^
Output:[G2Ca9Lu]
shell> ./base62x -dec G2Ca9Lu
Output:[@#$%^]

base62x-design

after v4, no-compatible with other versions
shell> ./base62xv4 -enc "beijing weather"
Output:[beijingxRweatherx]
shell> ./base62xv4 -dec "beijingxRweatherx"
Output:[beijing weather]
shell> ./base62xv4 -enc "北京 天气"
Output:[vOoNvBgi8EMagUQmb0]
shell> ./base62xv4 -dec "vOoNvBgi8EMagUQmb0"
Output:[北京 天气]
shell> ./base62xv4 -enc "hello **人民网××"
Output:[Q6LiR6zWAYhakhhci97dlP73bzEN]
shell> ./base62xv4 -dec "Q6LiR6zWAYhakhhci97dlP73bzEN"
Output:[hello **人民网××]


after v6, support -n ibase with numeric conversion
shell> ./base62x -n 16 -enc 16AF
1Ql
shell> ./base62x -n 16 -dec 1Ql
16AF


shell> ./base62x
Usage: ./base62x [-v] [-n <2|8|10|16|32>] <-enc|dec> string
Version: 0.60


2. Download:
2.5.Base62x source code(v0.7, update 20160814) base62x.class.php , Base62x.class.jsp
2.4.Base62x source code(v0.6, update 20130526)
2.4.Base62x source code(v0.5, update 20130222)
2.3.Base62x source code(v0.4, update 20130101)
2.2.Base62x source code(v0.3, update 201108)
2.1. Base62x source code.

3. A brief look:
base62x.presentation.201107.pdf
 -GitHub-Wadelau
 
4. The full paper:
IEEE: Base62x: An alternative approach to Base64 for non-alphanumeric characters
 
5. Examples:
5.1. Dot-Base62x: IPv6 Addresses Text Representation.
5.2. Base62x用处举例之一
5.3. 使用Base62x对网址进行编码

6. Updates/更新:
-Base62x Blog

Back to UFQI dev.


More from -github-wadelau

---- ---- ---- ----

Base62x in -PHP

base62x.class.php

base62x_test.php

In base62x_test.php

<?php

include("./base62x.class.php");

$s = "abcd1234";

$s2 = "abc中文123";

$s3 = "Tcler's Wiki: UTF-8 bit by bit (Revision 6). 2009-04-25. Retrieved 2009-05-22.";

print "[$s] encoded:[".($s_enc=Base62x::encode($s))."]\n";

print "[$s_enc] decoded:[".($s_dec=Base62x::decode($s_enc))."]\n";

print "\n[$s2] encoded:[".($s2_enc=Base62x::encode($s2))."]\n";

print "[$s2_enc] decoded:[".($s2_dec=Base62x::decode($s2_enc))."]\n";

print "\n[$s3] encoded:[".($s3_enc=Base62x::encode($s3))."]\n";

print "[$s3_enc] decoded:[".($s3_dec=Base62x::decode($s3_enc))."]\n";

?>

Output of base62x_test.php:

[abcd1234] encoded:[abcd1234x]

[abcd1234x] decoded:[abcd1234]

[abc中文123] encoded:[OM9ZvBYjvfQ7CJ8p]

[OM9ZvBYjvfQ7CJ8p] decoded:[abc中文123]

[Tcler's Wiki: UTF-8 bit by bit (Revision 6). 2009-04-25. Retrieved 2009-05-22.] 
encoded:[TclerxYsxRWikixhxRUTFxe8xRbitxRbyxRbitxRxZRevisionxR6xaxfxR2009xe04xe25xfxRRetrievedxR2009xe05xe22xfx]

[TclerxYsxRWikixhxRUTFxe8xRbitxRbyxRbitxRxZRevisionxR6xaxfxR2009xe04xe25xfxRRetrievedxR2009xe05xe22xfx]
decoded:[Tcler's Wiki: UTF-8 bit by bit (Revision 6). 2009-04-25. Retrieved 2009-05-22.]


---- ---- ---- ----

Base62x in -Java

Base62x.class.jsp

base62x_test.jsp

In base62x_test.jsp

<%@page 
    import="java.util.Date,
            java.util.HashMap,
            java.util.Map,
            java.util.Iterator"
    language="java" 
    pageEncoding="UTF-8"%><%

//- system
System.setProperty("sun.jnu.encoding", "UTF-8");
System.setProperty("file.encoding", "UTF-8"); //- set " -Dfile.encoding=utf8 " in jvm start script

//- request
request.setCharacterEncoding("UTF-8");

//- response
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");

%><%@include file="./Base62x.class.jsp"%><%

//- Test and examples of Base62x
//- Sun Aug 14 14:09:45 CST 2016
//- Wadelau@ufqi.com

String s = "abcd1234";
String s2 = "abc中文123";
String s3 = "Tcler's Wiki: UTF-8 bit by bit (Revision 6). 2009-04-25. Retrieved 2009-05-22.";

String s_enc, s_dec, s2_enc, s2_dec, s3_enc, s3_dec;

out.println("<br/>["+s+"] encoded:["+(s_enc=Base62x.encode(s))+"]");
out.println("<br/>["+s_enc+"] decoded:["+(s_dec=Base62x.decode(s_enc))+"]");

out.println("<br/>["+s2+"] encoded:["+(s2_enc=Base62x.encode(s2))+"]");
out.println("<br/>["+s2_enc+"] decoded:["+(s2_dec=Base62x.decode(s2_enc))+"]");

out.println("<br/>["+s3+"] encoded:["+(s3_enc=Base62x.encode(s3))+"]");
out.println("<br/>["+s3_enc+"] decoded:["+(s3_dec=Base62x.decode(s3_enc))+"]");

out.println("<br/><br/>Time:["+(new Date())+"] "+((new java.util.Random()).nextInt(999999)));

%>

Output of base62x_test.jsp:

[abcd1234] encoded:[abcd1234x]

[abcd1234x] decoded:[abcd1234]

[abc中文123] encoded:[OM9ZvBYjvfQ7CJ8p]

[OM9ZvBYjvfQ7CJ8p] decoded:[abc中文123]


[Tcler's Wiki: UTF-8 bit by bit (Revision 6). 2009-04-25. Retrieved 2009-05-22.] 
encoded:[TclerxYsxRWikixhxRUTFxe8xRbitxRbyxRbitxRxZRevisionxR6xaxfxR2009xe04xe25xfxRRetrievedxR2009xe05xe22xfx]

[TclerxYsxRWikixhxRUTFxe8xRbitxRbyxRbitxRxZRevisionxR6xaxfxR2009xe04xe25xfxRRetrievedxR2009xe05xe22xfx]
decoded:[Tcler's Wiki: UTF-8 bit by bit (Revision 6). 2009-04-25. Retrieved 2009-05-22.]

Time:[Sun Aug 14 22:00:45 CST 2016] 515373


Tips: 'Ctrl + F' to search in the page; right click and select 'Save as' can save a local copy of this page.
Technical support: wadelau at gmail.com or 100198948 at unimail.derby.ac.uk .
Since April 2011