Created
September 8, 2017 07:33
-
-
Save browny/0ca92cbbf9f743459f2ba1fe3e1bd64e 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
type IReader interface { | |
Read() ([]byte, error) | |
} | |
type IWriter interface { | |
Write(dat []byte) error | |
} | |
func (e *Encryptor) Run(r IReader, w IWriter) error { | |
// read file | |
dat, err := r.Read() | |
if err != nil { | |
return nil | |
} | |
// encrypt | |
result := e.encrypt(dat) | |
// output encrypted content | |
return w.Write(result) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment