我是靠谱客的博主 机智大白,最近开发中收集的这篇文章主要介绍常见Base编码总结,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

    为了自己在手机上也能看,所以就干脆把OneNote上总结的放到上面了。当然只是粗略的总结,看个乐子就行。(以下内容为全散装英文)

Base encode example: (example plain text: helloworldwouldyOul1keacuppaT?)

Base 16: 68656C6C6F776F726C64776F756C64794F756C316B65616375707061543F

Base 32: NBSWY3DPO5XXE3DEO5XXK3DEPFHXK3BRNNSWCY3VOBYGCVB7

Base 36: (only support integers) (encode: integer to string/ decode: string to integer, string can only include int & letters)

Base 45: +8D VD54E04ESVDK4F0%EQVC12AMUD/PD1EC4%EE9ECTA

Base 58-Bitcoin: MvFkp8LAtxbJUbwf5oQc84QxmFnck3TL1QrCXt9Rx

Base 62: 1S1blgSwJnRVZjRyUMfjPS6tGh4IETd1xaAZuHf6F

Base 64-Standard: aGVsbG93b3JsZHdvdWxkeU91bDFrZWFjdXBwYVQ/

Base 85-Standard: BOu!rDg-,?Ch.a.F_kT6:N^J.CLppaF`;;.<'L

Base 91: TPwJh>B|KUVzB_apoMR>t]AI>#}u58xnEE`:P

Base 92: Fc_$aOe!yuo7,OMNH,TA7fc%)|j=A8^>IQ0yb

Base 100: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Characteristic:

Base 16: A string which only include hexadecimal numbers (all letters are uppercase), with numbers more than letters.

Base 32: Use only uppercase letters & numbers 2~7, encoded text is 8/5 times longer than plain text, adds up "=" at the end of encoded text if binary digit lower than 40. May contain 6/4/3/1/0 "="s. depending on plain text length. (length%5=1/2/3/4/0)

Base 36: Using all uppercase letters & numbers. Can be considered as a 36-decimal (Hexatrigesimal) calculation.

Base 45: Using all Base 36 and "[Space]" "$" "+" "-" "*" "/" "." "%". Separate every 2 bytes as a whole unsigned int, then convert to 3 digits in 45-decimal (Pentaquadragesimal) form, in the end convert them to the Base 45 alphabet in reverse order.

Base 58: Using the same as Base 64 except for "0" "O(upper o)" "l(lower L)" "I(upper i)" "+" "/" in order to avoid mistaking. Can be considered as a 58-decimal (Octoquinquagesimal) calculation.

Base 62: Using all letters & numbers. Can be considered as a 62-decimal (Duosexagesimal) calculation. Often used to make long URL shorter.

Base 64: Use upper/lowercase letters & numbers 0~9 & "+""/", turning 3 8-digit byte to 4 6-digit byte and add 2 "0"s in each 6-digit byte to make up a 8-digit byte, so encoded text is 4/3 times longer than plain text. May contain 0/1/2 "="s depending on text length. (length%3=0/2/1)

Base 85: Use upper/lowercase letters & numbers 0~9 & "!" "#" "$" "%" "&" "(" ")" "*" "+" "-" ";" "<" "=" ">" "?" "@" "^" "_" "`" "{" "|" "}" "~". Turning 4 bytes to 5 chars by transforming 4 continuous chars' ASCII into int then 85-decimal of 5 chars, then add up 33 of each new char as ASCII. Encoded text is 5/4 longer than plain text.

Base 91: Using all ASCII chars except for " - " "" " ' ". Similar to UUencode & Base 64, but more efficient. Encoded text is about 114%~123% longer than plain text. Useful for uploading large files on unsafe binary links. One variant uses "" in place of " " ".

Base 92: Using all ASCII chars except for " " " "`" due to confusability.

Base 100: Encoded by emojis, each emoji represents one char in string. (Similar to Wingdings fonts)

Conclusion

    All Base encoding can be considered as a **-decimal calculation while each of them has a specific alphabet for conversion (if the number is lower than 94, which refers to ASCII, of course.). Actually, there are more Base encoding than these shown above, but they are the most used ones.

    There may be variations of these Base encodings, e.g. Z85/IPv6 for Base 85, Atom128/Megan35/XML/(and much more) for Base 64 etc. These variations cannot be all shown here, so you'll have to trial-and-error.

最后

以上就是机智大白为你收集整理的常见Base编码总结的全部内容,希望文章能够帮你解决常见Base编码总结所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(47)

评论列表共有 0 条评论

立即
投稿
返回
顶部