3

私は2つの同一の.fitイメージを持っています。

Linux@Linux: ~/imgs/ImageTesting# sha256sum hexd_ss.fit ss.fit

dff6b019b590edb3e9c61c984205c5f49a4064be34feb6207c88dc920aad17e0 hexd_ss.fit dff6b019b590edb3e9c61c984205c5f49a4064be34feb6207c88dc920aad17e0

hexd_ss.fit を 1 ビット変更しました

Linux@Linux:~/imgs/ImageTesting# vi hexd_ss.fit

から

0000 0000

0000 0001

だから私は2つの異なるファイルサイズと異なるハッシュを持っています

> Linux@Linux:~/imgs/ImageTesting# ls -l total 9344
> -rw-r--r-- 1 root root 4781261 Jun 16 15:45 hexd_ss.fit
> -rw-r--r-- 1 root root 4781260 Jun 16 15:33 ss.fit
> 

Linux@Linux: ~/imgs/ImageTesting# sha256sum hexd_ss.fit ss.fit

f3277110043b4170c111fa7d4291aa7df23de68c9e504259ae6158e5133faf1a hexd_ss.fit dff6b019b590edb3e9c61c984205c5f49a4064be34feb6207c88dc920asad17e

しかし、以前のようにビット 0 を再度変更すると、サイズは変更されず、2 つの異なるハッシュも変更されません。

変更後

> 0000 0001  to > 0000 0000

Linux@Linux:~/imgs/ImageTesting# ls -l

-rw-r--r-- 1 root root 4781261 Jun 16 15:47 hexd_ss.fit
-rw-r--r-- 1 root root 4781260 Jun 16 15:33 ss.fit

2 つの 0 バイトを 2 つの 1 バイトに変更しても、サイズは同じままです。として、

0000 1111

Linux@Linux:~/imgs/ImageTesting# ls -l

-rw-r--r-- 1 root root 4781261 Jun 16 15:47 hexd_ss.fit
-rw-r--r-- 1 root root 4781260 Jun 16 15:33 ss.fit

だから私の質問は -

  1. HexEdit を元に戻すことができないのはなぜですか?
  2. 編集を元に戻す方法または他の方法は?
4

1 に答える 1

5

I opened my python3.5 binary with vi python3.5, then did :%!xxd, :%!xxd -r, :wq ... and ended up with a file that's 1 byte larger. Note how I didn't even edit anything. You shall use

vi -b <file>

to open binary files with vi... or they get converted when you open them :P

My python3.5 binary got a 0a appended to it - a line feed. After removing this byte, the file was exactly the same as the original again.

于 2016-06-16T14:57:11.507 に答える