C语言 使用 linux 命令将十六进制信息转换为二进制信息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7826526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Transform a hex info to binary using linux command
提问by Udit Gupta
I have this binary file on my linux system ..
我的 linux 系统上有这个二进制文件..
udit@udit-Dabba ~ $ cat file.enc
Salted__s?bO??<0?F???Jw!???]?:`C?LK??l
Using hexdump command I see its information like this ..
使用 hexdump 命令我看到它的信息是这样的..
udit@udit-Dabba ~ $ hexdump -C file.enc
00000000 53 61 6c 74 65 64 5f 5f 1b 73 a1 62 4f 15 be f6 |Salted__.s.bO...|
00000010 3c 30 cc 46 ee 10 13 11 84 bf 4a 77 21 a4 84 99 |<0.F......Jw!...|
00000020 0e 5d ef 11 18 3a 60 43 a0 4c 4b 1e c8 86 e6 6c |.]...:`C.LK....l|
00000030
Now I am given a file on some other system whose contents are like this ..
现在我在其他一些系统上得到了一个文件,其内容是这样的..
53 61 6c 74 65 64 5f 5f 1b 73 a1 62 4f 15 be f6
3c 30 cc 46 ee 10 13 11 84 bf 4a 77 21 a4 84 99
0e 5d ef 11 18 3a 60 43 a0 4c 4b 1e c8 86 e6 6c
and I need to find out that same exact binary information from this hexdump.
我需要从这个 hexdump 中找出完全相同的二进制信息。
How to proceed for that?
如何进行?
If there is no switch for that then a C code will also work fine.
如果没有开关,那么 C 代码也可以正常工作。
(but a linux command with some switch is preferable)
(但最好使用带有一些开关的 linux 命令)
LIMITATION:
局限性:
The binary information in the file is output of an encryption algo so contents should exactly match ..
文件中的二进制信息是加密算法的输出,因此内容应完全匹配..

