使用Linux命令将十六进制信息转换为二进制信息 [英] Transform hexadecimal information to binary using a Linux command
问题描述
我的Linux系统上有此二进制文件...
I have this binary file on my Linux system...
udit@udit-Dabba ~ $ cat file.enc
Salted__s�bO��<0�F���Jw!���]�:`C�LKȆ�l
使用hexdump命令,我会看到如下信息:
Using the hexdump command, I see its information like this:
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.
我该怎么做?
如果没有任何选择,那么C代码也可以正常工作.
If there isn't any switch for that then C code will also work fine.
(但最好是带有一些开关的Linux命令)
(But a Linux command with some switch is preferable)
限制条件:
文件中的二进制信息是加密算法的输出,因此内容应完全匹配...
The binary information in the file is output of an encryption algorithm, so contents should exactly match...
推荐答案
按照@ user786653的建议,使用 xxd(1)
程序:
As @user786653 suggested, use the xxd(1)
program:
xxd -r -p input.txt output.bin
这篇关于使用Linux命令将十六进制信息转换为二进制信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!