Created
June 20, 2017 09:59
-
-
Save trusch/978cdb13e9709ec7320684efddf2cbe1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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