简体   繁体   中英

how to find format of pack() -ed binary data and unpack it

I have stored binary data in Mysql field like this: 0x31 and 0x31303030303332 . this was converted to binary data from string, I don't know that string and I don't know how string had converted to this binary data. As far as I know the pack() and unpack() PHP functions can help me, BUT I can't convert back this binary data to string because I don't know what format (second argument of unpack() function) had been used. How can I find correct format to add in unpack('format', $mybinarystring) function? Or may be this can be converted back via another function or method?

There is no way to definitely find out which format is used to create the binary data, because its just binary data. You can guess, look at the content and find a hint, or just try&error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM