[c] Transform hexadecimal information to binary using a Linux command

I have this binary file on my Linux system...

 udit@udit-Dabba ~ $ cat file.enc
 Salted__s?bO??<0?F???Jw!???]?:`C?LK??l

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.

How can I proceed for that?

If there isn't any switch for that then C code will also work fine.

(But a Linux command with some switch is preferable)

Limitation:

The binary information in the file is output of an encryption algorithm, so contents should exactly match...

This question is related to c command command-line-arguments binaryfiles hexdump

The answer is


As @user786653 suggested, use the xxd(1) program:

xxd -r -p input.txt output.bin

Examples related to c

conflicting types for 'outchar' Can't compile C program on a Mac after upgrade to Mojave Program to find largest and second largest number in array Prime numbers between 1 to 100 in C Programming Language In c, in bool, true == 1 and false == 0? How I can print to stderr in C? Visual Studio Code includePath "error: assignment to expression with array type error" when I assign a struct field (C) Compiling an application for use in highly radioactive environments How can you print multiple variables inside a string using printf?

Examples related to command

'ls' is not recognized as an internal or external command, operable program or batch file Command to run a .bat file how to run python files in windows command prompt? Run a command shell in jenkins How to recover the deleted files using "rm -R" command in linux server? Split text file into smaller multiple text file using command line ansible : how to pass multiple commands Jmeter - Run .jmx file through command line and get the summary report in a excel cocoapods - 'pod install' takes forever Daemon not running. Starting it now on port 5037

Examples related to command-line-arguments

How to pass arguments to Shell Script through docker run How can I pass variable to ansible playbook in the command line? Use Robocopy to copy only changed files? mkdir's "-p" option What is Robocopy's "restartable" option? How do you run a .exe with parameters using vba's shell()? Bash command line and input limit Check number of arguments passed to a Bash script Parsing boolean values with argparse Import SQL file by command line in Windows 7

Examples related to binaryfiles

Transform hexadecimal information to binary using a Linux command How can I save a base64-encoded image to disk? How to edit binary file on Unix systems Managing large binary files with Git What is the best place for storing uploaded images, SQL database or disk file system? How can you encode a string to Base64 in JavaScript?

Examples related to hexdump

Transform hexadecimal information to binary using a Linux command