Documentation ¶
Index ¶
- Variables
- func DecryptFile(src io.Reader, dst io.Writer, pass string) (err error)
- func EncryptFile(src io.Reader, dst io.Writer, pass string) (err error)
- type ChecksumStage
- type ChunkInfo
- type ChunkStage
- type CryptoStage
- type DechunkStage
- type DestStage
- type FileFooter
- type FileHeader
- type MiddleStage
- type Pipeline
- type SourceStage
- type Stage
Constants ¶
This section is empty.
Variables ¶
var ( ErrWrongFileType = errors.New("wrong file type") ErrWrongChecksum = errors.New("wrong checksum") ErrLimitExceeded = errors.New("limit exceeded") )
zenc errors
var ( Magic = [4]byte{0x5A, 0x45, 0x4E, 0x43} // ZENC Version = [4]byte{0x00, 0x01, 0x00, 0x00} // 0.1.0.0 )
File header constants
Functions ¶
func DecryptFile ¶
DecryptFile decrypts file using the given password
Types ¶
type ChecksumStage ¶
type ChecksumStage struct { MiddleStage Sum uint32 }
ChecksumStage maintains a checksum of the data being processed
func NewChecksumStage ¶
func NewChecksumStage() *ChecksumStage
NewChecksumStage creates a Stage for calculating checksum
type ChunkInfo ¶
type ChunkInfo struct {
Size int32
}
ChunkInfo holds the information of a chunk
type ChunkStage ¶
type ChunkStage struct { MiddleStage // contains filtered or unexported fields }
ChunkStage encodes contiguous bytes into chunks
func NewChunkStage ¶
func NewChunkStage() *ChunkStage
NewChunkStage creates a Stage for encoding data
func (*ChunkStage) Close ¶
func (cs *ChunkStage) Close() (err error)
Close flushes the buffer and ends the chunk stream
func (*ChunkStage) Flush ¶
func (cs *ChunkStage) Flush() (err error)
Flush writes the buffered data to the underlying writer
type CryptoStage ¶
type CryptoStage struct { MiddleStage // contains filtered or unexported fields }
CryptoStage encrypts/decrypts input data using the cipher key-stream
func NewCryptoStage ¶
func NewCryptoStage(key string, iv []byte) *CryptoStage
NewCryptoStage creates a Stage for both encryption and decryption
type DechunkStage ¶
type DechunkStage struct { MiddleStage // contains filtered or unexported fields }
DechunkStage decodes chunks to contiguous bytes
func NewDechunkStage ¶
func NewDechunkStage() *DechunkStage
NewDechunkStage creates a Stage for decoding chunks
type DestStage ¶
type DestStage struct {
// contains filtered or unexported fields
}
DestStage outputs data to a destination Writer
func NewDestStage ¶
NewDestStage creates a DestStage from a Writer
type FileFooter ¶
type FileFooter struct {
}FileFooter is used to store extra file information
type FileHeader ¶
FileHeader is used to identify encrypted file
type MiddleStage ¶
type MiddleStage struct {
// contains filtered or unexported fields
}
MiddleStage processes data and writes them to next stage
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline represents a data flow consisting of one or more stages
type SourceStage ¶
type SourceStage struct {
// contains filtered or unexported fields
}
SourceStage gets input data from a source Reader
func NewSourceStage ¶
func NewSourceStage(s io.Reader) *SourceStage
NewSourceStage creates a SourceStage from a Reader
func (*SourceStage) SetNext ¶
func (ss *SourceStage) SetNext(n Stage)
SetNext on SourceStage will panic