{{tag>Brouillon Encodage Script}}
= Notes Hexa
Voir l'excellent éditeur Hexadécimal wxHexEditor :
* http://www.wxhexeditor.org/
* https://github.com/EUA/wxHexEditor
Exemple
hexdump -C plop.bin
xxd plop.bin
Diff
$ diff <(xxd Bootable_NoEmulation.img) <(xxd Bootable_NoEmulation_1.img)
1c1
< 00000000: faea 407c 0000 9090 1000 0000 e20a 0000 ..@|............
---
> 00000000: faea 407c 0000 9090 1000 0000 e800 0000 ..@|............
#colordiff -y <(xxd Bootable_NoEmulation.img) <(xxd Bootable_NoEmulation_1.img)
$ cmp -b Bootable_NoEmulation.img Bootable_NoEmulation_1.img
Bootable_NoEmulation.img Bootable_NoEmulation_1.img differ: byte 13, line 1 is 342 M-b 350 M-h
$ cmp -l Bootable_NoEmulation.img Bootable_NoEmulation_1.img
13 342 350
14 12 0
$ cmp -bl Bootable_NoEmulation.img Bootable_NoEmulation_1.img
13 342 M-b 350 M-h
14 12 ^J 0 ^@
$ echo -n "co" | od -x --endian=big
0000000 636f
$ echo -n "co" | hexdump -C
00000000 63 6f |co|
00000002
$ echo -n "co" | xxd
0000000: 636f co
$ printf "\x63\x6f\n"
co
$ echo "636f" | sed -e 's/\(..\)/\\x\1/g' | xargs -0 printf
co
== Fonctions
HexToAscii() {
echo "$@" |sed -e 's/[[:space:]]//g' |sed -e 's/\(..\)/\\x\1/g' |xargs -0 printf
}
AsciiToHex() {
echo -n "$@" |od -x --endian=big |sed -e 's/^....... //' |sed '$d'
}
== Autres
wxHexEditor --compare file1 file2