当前位置:网站首页>PHP converts strings to hex and hex to string - PHP convert string to hex and hex to string
PHP converts strings to hex and hex to string - PHP convert string to hex and hex to string
2022-06-25 06:37:00 【Rich in starch】
problem :
I got the problem when convert between this 2 type in PHP. stay PHP In this 2 There was a problem converting between types .This is the code I searched in google This is the code I searched in Google
function strToHex($string){ $hex=''; for ($i=0; $i < strlen($string); $i++){ $hex .= dechex(ord($string[$i])); } return $hex;}function hexToStr($hex){ $string=''; for ($i=0; $i < strlen($hex)-1; $i+=2){ $string .= chr(hexdec($hex[$i].$hex[$i+1])); } return $string;}I check it and found out this when I use XOR to encrypt. I check it and use it XOR This was discovered during encryption .
I have the string "this is the test" , after XOR with a key, I have the result in string ↑§P§P *§T§ . I have a string "this is the test" , After using a key XOR , My result is a string ↑§P§P *§T§ .After that, I tried to convert it to hex by function strToHex() and I got these 12181d15501d15500e15541215712 . after , I try to use the function strToHex() Convert it to hexadecimal , I got these 12181d15501d15500e15541215712 .Then, I tested with the function hexToStr() and I have ↑§P§P*§T§q . then , I use functions hexToStr() Tested , I have a ↑§P§P*§T§q .So, what should I do to solve this problem? that , What should I do to solve this problem ?Why does it wrong when I convert this 2 style value? Why do I switch this 2 An error occurs when a style value is ?
Solution :
Reference resources : https://stackoom.com/en/question/zZas边栏推荐
- STL map的用法
- Research Report on demand and Competitive Prospect of global and Chinese welding personal protective equipment industry 2022-2027
- Your local changes to the following files would be overwritten by merge: .vs/slnx.sqlite
- Face++ realizes face detection by flow
- Analysis report on investment and financing status and operation benefits of global and Chinese dental industry (2022 Edition)
- 这些老系统代码,是猪写的么?
- China rehabilitation hospital industry operation benefit analysis and operation situation investigation report 2022
- Research Report on marketing channel analysis and competitive strategy of China's polycarbonate industry 2022
- Aviator an expression evaluation engine
- Arm instructions and others
猜你喜欢

2022-02-19: fence installation. In a two-dimensional garden, there are some trees represented by (x, y) coordinates. As the installation cost is very expensive, your task is to enclose all the trees w

How to realize the stable output of 3.3v/3.6v (1.2-5v) voltage of lithium battery by using the voltage rise and fall chip cs5517

Cs5092 5V USB input boost two section lithium battery charging management IC, SOT23-6 miniature package

DataX tutorial (10) - hot plug principle of dataX plug-in

Monitoring access: how to grant minimum WMI access to the monitoring service account

Large funds support ecological construction, and Plato farm builds a real meta universe with Dao as its governance

Single lithium battery 3.7V power supply 2x12w stereo boost audio power amplifier IC combination solution

Sleep quality today 67 points

You can see the classification of SQL injection. SQL injection point /sql injection type /sql injection has several /sql injection point classifications

Self adjustment process of MySQL index tree when adding data
随机推荐
2022 AI trend 8 forecast!
十大券商公司哪个佣金最低,最安全可靠?有知道的吗
Why can't GC () free memory- Why does gc() not free memory?
TCP BBR as rate based
Go language library management restful API development practice
What is the slice flag bit
Advantages and disadvantages of using SNMP and WMI polling
Ht7180 3.7V L 12v/2a built in MOS high current boost IC solution
DataX tutorial (09) - how does dataX achieve speed limit?
The perfect presentation of Dao in the metauniverse, and platofarm creates a farm themed metauniverse
fastadmin 联级清空数据
[short time energy] short time energy of speech signal based on MATLAB [including Matlab source code 1719]
Monitoring access: how to grant minimum WMI access to the monitoring service account
Arm register (cortex-a), coprocessor and pipeline
Wan Yin revealed that he was rejected by MIT in this way: "the department doesn't like you". He confronted the principal and realized
IQ debugging of Hisilicon platform ISP and image (1)
Period to string [repeat] - period to string [duplicate]
System dilemma and software complexity: Why are our systems so complex?
原子Alpha开发板--SD卡和emmc烧录工具
We cannot activate inspection type for article master in transaction code MM41?