forked from mirror/zip
Merge pull request #1 from farmerx/patch-1
modify readme.md add example
This commit is contained in:
commit
f15f84f02c
32
README.txt
32
README.txt
|
@ -22,6 +22,38 @@ The process
|
||||||
1. hello.txt -> compressed -> encrypted -> .zip
|
1. hello.txt -> compressed -> encrypted -> .zip
|
||||||
2. .zip -> decrypted -> decompressed -> hello.txt
|
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
|
WinZip AES specifies
|
||||||
=====================
|
=====================
|
||||||
1. Encryption-Decryption w/ AES-CTR (128, 192, or 256 bits)
|
1. Encryption-Decryption w/ AES-CTR (128, 192, or 256 bits)
|
||||||
|
|
Loading…
Reference in New Issue