Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [hex]

The tag has no usage guidance.

3
votes
3answers
384 views

How can I list the different hex characters between two files?

allHexChars.txt \x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\...
-1
votes
1answer
26 views

How do we get the readable string from big endian hex string

How do we get the readable string from hex string 0049006e00740072006f of BE which means as normal word, ie. we dont have to swap the byte pair per word tried with xxd in vain, cause I dont know ...
6
votes
2answers
352 views

How to read string as hex number in bash?

I have the bash line: expr substr $SUPERBLOCK 64 8 Which is return to me string line: 00080000 I know that this is, actually, a 0x00080000 in little-endian. Is there a way to create integer-...
0
votes
0answers
48 views

How are ext4fs checksums being calculated?

I've been studying ext4 file system contents and stumbled upon this paragraph: https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Checksums It says how blocks of data for different structures ...
1
vote
1answer
134 views

Hex code for '(' in bash regex

I have a strange behaviour in shell. When I try to match '_' in regex with its hex code it works, but not with '('. $ regex1=$'\x5f' $ pattern1='_' $ if [[ $pattern1 =~ $regex1 ]]; then echo yes; ...
1
vote
1answer
195 views

Can you edit address values in “/proc/$pid/mem” to reflect changes in that process?

I would like to see if I can edit a value in my program while it is running by directly changing the memory. My thought process (untested) is to do the following: Run the program. Open up "System ...
2
votes
1answer
1k views

Hex dump only the beginning and the end of a file with xxd [duplicate]

I am looking for a command to display three .png files using xxd, displaying the first two and last two lines of the hexadecimal for each. I have used the command below to display one file at a time ...
-2
votes
2answers
100 views

Reverse engineering the hex file [closed]

reverse engineering the hex file Written in c language From atmega16 Want source code from the hex code By reverse engineering need to extract the library file of the code is their any possible ...
3
votes
2answers
2k views

Get hex-only output from objdump

Say for example I've got this C function: void f(int *x, int *y) { (*x) = (*x) * (*y); } When saved to f.c, compiling with gcc -c f.c produces f.o. objdump -d f.o gives this: f.o: file ...
0
votes
4answers
222 views

Finding how many hex values a string containing hex and random string

I have the file ~/dummy_hex.txt containing hex and random string: \x12\xA1\xF1\xE3somegibberigh I want to count how many hex values (groups of \x^hex_digit^^hex_digit^) the string above has. In the ...
7
votes
3answers
898 views

convert hex IP address into hostname

I would like to switch between hostnames and hex IP addresses, and vice versa. I have installed syslinux-utils on Debian Stretch, which provides gethostip: gethostip -x google.com D83ACD2E How can ...
2
votes
2answers
2k views

printf in shell script can't do \x%x

where ECHO-VAR produces \xFF\xFF\xFF\x00 ($fb_COLOR15) these work on the command line: CP="`ECHO-VAR`" printf $CP | dd status=none bs=4 count=$(( ( 1360 * 100 ) + 100 )) > /dev/fb0 printf "`ECHO-...
2
votes
1answer
3k views

Find hex value in files/folder

Is there a way to search for a hex value in files / folders? I've tried the following: grep -P "[\x01\x02\x03]" but that doesn't work (there is no error, but it doesn't search for these hex values).
0
votes
1answer
207 views

Hex viewer for Solaris (SunOS 5.11)

Can anyone point me at a decent hex viewer for Solaris? Looking for something with a front-end similar to bless on Ubuntu or Binary Viewer on Windows or ..almost the Delta Hex Editor Netbeans plugin. ...
2
votes
1answer
675 views

Why does xxd not show the byte order mark?

I have a Java class which the compiler refuses to compile due to \ufeff at the start of the file. I can view the fact that the BOM is present by vim -b file.java, but neither xxd nor hexdump show the ...
0
votes
1answer
668 views

Command for converting little endian memory addresses to hex code?

I'm wondering is there's a command or utility already built within the terminal that can take a little endian memory address (for e.g. 5F4A358F) and convert it into a hex code (in this case \x8f\x35\...
1
vote
2answers
270 views

swap bits position in linux

i have hex value B455 when i change it to binary i got 1011 0100 0101 0101 i want to swap the bits with a rule of : origin bits index : 0123456789ABCDEF result bits index : D5679123C4EF80AB` ...
8
votes
3answers
1k views

Bash expansion hexadecimal

I would like to know if there is a way of using bash expansion to view all possibilities of combination for a number of digits in hexadecimal. I can expand in binaries In base 2: echo {0..1}{0..1}{0....
8
votes
5answers
4k views

Reverse a hexadecimal number in bash

Is there a simple command to reverse an hexadecimal number? For example, given the hexadecimal number: 030201 The output should be: 010203 Using the rev command, I get the following: 102030 ...
16
votes
4answers
15k views

How to calculate hexadecimal xor (^) from shell?

Unfortunately bc and calc don't support xor.
0
votes
1answer
95 views

Hex has unknown character / in the output

I need to create a Rc2Key variable and then convert this to hexadecimal. I have done this with two commands. The Rc2Key variable has to be 16 characters long, so in my test module I used "...
2
votes
1answer
4k views

Grep is not matching non-ascii characters

I found a problematic sequence of a supposedly UTF-8 encoded text file. The strange thing is that grep seems unable to match this non-ASCII line. $ iconv -f utf8 -t iso88591 corrupt_part.txt --output ...
3
votes
2answers
726 views

How can I do a binary search of a text file for a specific character string?

I have a text file that contains a large number of records, each on a single line. Some of the records have special characters that have been corrupted, and I'm attempting to find those by looking for ...
1
vote
2answers
276 views

Appending Echo [Password Generator]

I am creating a password generator however I am not get the passwords to append properly. Here is my script i="0" while [ $i -lt 5 ] do echo -n '#' >> passwords.txt && openssl rand ...
2
votes
2answers
440 views

How to use grep to return lines with an hexadecimal number in a given range?

If I have, say: blah;PC=1234abcd PC=4444bbcd;blah PC=0000abcd;;foo PC=1234abff How do I grep for lines with PC values in a given range, say 1234ab00 to 1234b0ff. The - range option seems to only ...
1
vote
1answer
104 views

Bash script: hex

I'm trying to do the following: ch='\x21' line="\x21" len=50 for i in `seq 1 $len` do line+="$ch" done Instead of 50 '!' (hex code \x21) I get a list of 50 '\x21'. How can I do this in bash?
2
votes
2answers
754 views

How to convert an special hex character from an html page in bash? [duplicate]

I have a script which process some information coming from a web page. I guess that because of the encoding of the page, some special characters are encoded in hexadecimal. For example, I have the the ...
2
votes
2answers
881 views

DASH hexadecimal string comparison

I am attempting to compare two strings containing hexadecimal numbers in a dash test, one which has leading zeros and one which doesn't: hex_string_1: 0x02a0000b hex_string_2: 0x2a0000b Trying if [ $...
1
vote
2answers
118 views

Viewing Binary not Hex

Debian jess 64 I was wondering if it is possible to view the binary of a file in the 00101000 form and edit it, I am able to view it but in the hex form and I am looking to view and edit it in a the ...
0
votes
1answer
7k views

blessdiff for the “full featured hexadecimal editor”?

I am trying to find some hex diftool which allows me to compare to documents in the view but also the internal differences like in bless so two bless windows side-by-side but with diff capability ...
3
votes
1answer
694 views

Is it possible to echo characters directly to network?

Even when this is a network problem, I would say this is rather a Unix/Linux experienced users question. I am trying to manually send a network magic packet by using echo and redirectors (file ...
1
vote
3answers
852 views

Match hexadecimal values in a case statement

I'm trying to match exit codes of a process that is documented to return hexadecimal exit codes (e.g. 0x00 for success, 0x40 - 0x4F on user error, 0x50 - 0x5F on internal error, etc.). I'd like to ...
0
votes
1answer
1k views

Commands for data manipulation of binary to octave/hex formats?

I need to convert binary data to hex/octave/any suitable format and back to binary when I am splitting one big 1GB file into files containing 777 events each which are not of the same size such that ...
1
vote
1answer
903 views

What is the meaning of Star symbol * in Hex data?

I see sometimes star symbol (*) in the hex editor, like ... 00001d0 0000 0000 0000 0000 0000 0000 0000 0000 * 00001f0 0000 0000 0000 0000 0008 0000 0000 0000 ... It is probably some sort of ...
1
vote
3answers
386 views

Put big data of heterogenous byte offset into arrays by AWK

Assume the data consists of byte offset which is not fixed i.e. the distance of two subsequent file headers varies. The point of this thread is to go through each size of events separately in arrays. ...
21
votes
4answers
51k views

BASH base conversion from decimal to hex

In Bash, how does one do base conversion from decimal to another base, especially hex. It seems easy to go the other way: $ echo $((16#55)) 85 With a web-search, I found a script that does the ...
6
votes
3answers
2k views

Hexdump of a string starting at new lines?

Say I have a multi-line strings, but the entries on it are short; if I try to hexdump, then I get something like this: echo "something is being written here" | hexdump -C #00000000 73 6f 6d 65 74 ...
1
vote
1answer
1k views

hexedit: change number of columns (bytes per line)

I am using hexedit to show/edit disk MBR (512 Bytes, copied with dd). When I open the file, hexedit displays the file as 9 columns, 4 bytes per column (36 bytes per line). That is very unfortunate. I ...
2
votes
2answers
5k views

Which Hex code for /boot partition

I planned to install ArchLinux on my laptop. I'm only at the begining, trying to understand all the step before doing them. I'm only at the first step, i.e. partitioning, that I already have a small ...
2
votes
3answers
1k views

Check if a drive has been Zeroed with xxd and uniq?

I'm looking for a way to check if the entire binary contents of a USB device are purely 0s. I'm trying this command: sudo xxd /dev/sdb | uniq but it has no output and just runs forever. I've ...
0
votes
1answer
202 views

Why is od calculating decimal values wrong?

This question is related to the answer from enzotib to the question: How could I use Bash to find 2 bytes in a binary file, increase their values, and replace? This converts the two bytes into its ...
5
votes
2answers
4k views

In emacs, is there a way to Hex edit/view a buffer without losing the undo info?

When I use hexl-mode in emacs, it discards the buffer's undo info. Is there another way to hex-edit the buffer and yet retain the undo info? If there is no alternative hex-editor, is there a hex-...