From b2c4533ffbadc50301a6d5704f5b5035d965f2c7 Mon Sep 17 00:00:00 2001 From: Farmerx <90bibin@gmail.com> Date: Thu, 16 Nov 2017 20:38:45 -0600 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=B8=80=E4=B8=8Breadme.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi! alexmullins: 在我使用你这个包的时候,着了所有的例子,都没有成功。 最后当我看你你的这个zip fork golang zip 。我恍然大悟,原来你的这个包是这么用的。为了以后更多的人使用你的这个zip包,请接收我的提交 --- README.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.txt b/README.txt index 24a6265..2134a00 100644 --- a/README.txt +++ b/README.txt @@ -22,6 +22,38 @@ The process 1. hello.txt -> compressed -> encrypted -> .zip 2. .zip -> decrypted -> decompressed -> hello.txt +Example Encrypt zip +========== +``` +package main + +import ( + "bytes" + "log" + "os" + "github.com/alexmullins/zip" +) + +func main() { + contents := []byte("Hello World") + fzip, err := os.Create(`./test.zip`) + if err != nil { + log.Fatalln(err) + } + zipw := zip.NewWriter(fzip) + defer zipw.Close() + w, err := zipw.Encrypt(`test.txt`, `golang`) + if err != nil { + log.Fatal(err) + } + _, err = io.Copy(w, bytes.NewReader(contents)) + if err != nil { + log.Fatal(err) + } + zipw.Flush() +} +``` + WinZip AES specifies ===================== 1. Encryption-Decryption w/ AES-CTR (128, 192, or 256 bits)