Skip to content

Instantly share code, notes, and snippets.

@trusch
Created June 20, 2017 09:59
Show Gist options
  • Save trusch/978cdb13e9709ec7320684efddf2cbe1 to your computer and use it in GitHub Desktop.
Save trusch/978cdb13e9709ec7320684efddf2cbe1 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"crypto/aes"
"crypto/cipher"
"flag"
"os"
"io"
"compress/gzip"
)
var in = flag.String("in","in.txt","input")
var out = flag.String("out","out.gz.aes","output")
func main() {
flag.Parse()
inFile, err := os.Open(*in)
if err != nil {
log.Fatal(err)
}
outFile, err := os.Create(*out)
if err != nil {
log.Fatal(err)
}
block, _ := aes.NewCipher([]byte("12345678901234567890123456789012"))
aesStream := cipher.NewOFB(block, []byte("1234567890123456"))
aesWriter := cipher.StreamWriter{S: aesStream, W: outFile}
gzWriter := gzip.NewWriter(aesWriter)
io.Copy(gzWriter, inFile)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment