If data is hidden using the technique from the previous example, it can be detected by searching for the ZIP file signature in the image. A file may have a .jpg extension and still load properly in a photo viewer, but it may still have a ZIP archive stored in the file. The following program searches through a file and looks for a ZIP file signature. We can run it against the file created in the previous example:
package mainimport ( "bufio" "bytes" "log" "os")func main() { // Zip signature is "\x50\x4b\x03\x04" filename := "stego_image.jpg" file, err := os.Open(filename) if err != nil { log.Fatal(err) } bufferedReader := bufio.NewReader(file) fileStat, _ := file.Stat() // 0 is being cast to an int64 ...