I have to read a PPM file with its data encrypted (metadata is not encrypted), using Go, and the file format is given to me containing:
The "P3" magic number (read as string)
Image width (read as integer)
Image height (read as integer)
Maximum color value (read as integer)
Then, I need to read the rest of the file is the encrypted bits, which I have to read as a single byte array/slice.
e.g.:
P6
480 360
255
�š��GHFHFI�GHFHFG~EG~EG~E
...
HFD{BR�Rz�y|�vxyyhlf%8&NFzx
What is a good way to read string and integers (the 4 initial metadata values) and the rest (encrypted part) as bytes from the file? It can be the most efficient, but the cleanest (less lines) is preferred.