本文介紹了將十六進制轉換為 ascii 字符的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
是否可以用一個0-9a-zA-Z字符的序列來表示一個十六進制字符(0-9A-F)的序列,所以結果序列更小,可以解碼?
Is it possible to represent a sequence of hex characters (0-9A-F) with a sequence of 0-9a-zA-Z characters, so the the result sequence is smaller and can be decoded?
例如:
$hex = '5d41402abc4b2a76b9719d911017c592';
echo $string = encode($hex); // someASCIIletters123
echo decode(string) == $hex; //true
推薦答案
你可以簡單地調整我提出的解決方案 此處 使用函數base_convert_arbitrary
.
You can trivially adapt the solution I presented here using the function base_convert_arbitrary
.
我沒有仔細閱讀:) Base 16 到 base 62 仍然非常可行,如上所述.
I had not read carefully enough :) Base 16 to base 62 is still very doable, as above.
查看實際操作.
這篇關于將十六進制轉換為 ascii 字符的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!