C# "hex shift" in binary file
Example (nat开发者_如何学运维ive GIF header):
GIF89a (47 49 46 38 39 61)
I want to read this file, and shift its hex content (--++ pattern)
FHG98` (46 48 47 39 38 60)
File.WriteAllBytes("output.dat", File.ReadAllBytes("input.dat")
.Select((b,i)=> (byte)(i%4 < 2 ? b-1 : b+1))
.ToArray());
精彩评论