C # "hex shift" in binary

Example (custom GIF header):

GIF89a (47 49 46 38 39 61)

I want to read this file and transfer its hexadecimal content (- ++ pattern)

FHG98` (46 48 47 39 38 60)

+2


a source to share


1 answer


File.WriteAllBytes("output.dat", File.ReadAllBytes("input.dat")
                                     .Select((b,i)=> (byte)(i%4 < 2 ? b-1 : b+1))
                                     .ToArray());

      



+2


a source







All Articles