Documentation ¶
Index ¶
- func Decrypter(b cipher.Block, iv []byte, r io.Reader) (io.ReadCloser, error)
- func Encrypter(b cipher.Block, iv []byte, w io.Writer) (io.WriteCloser, error)
- func NewAes(k []byte) (cipher.Block, error)
- func NewReader(c Reader, r io.Reader) io.Reader
- func NewWriter(c Writer, w io.Writer) io.WriteCloser
- type CBK
- func (e *CBK) BlockSize() int
- func (e *CBK) Decrypt(dst, src []byte)
- func (e *CBK) Deshuffle(b []byte)
- func (e *CBK) Encrypt(dst, src []byte)
- func (e *CBK) Flush(w io.Writer) error
- func (e *CBK) Read(r io.Reader, b []byte) (int, error)
- func (e *CBK) Reset() error
- func (e *CBK) Shuffle(b []byte)
- func (e *CBK) Write(w io.Writer, b []byte) (int, error)
- type Reader
- type Writer
- type XOR
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypter ¶ added in v0.1.0
Decrypter creates a data.Reader type from the specified block Cipher, IV and Reader.
This is used to Decrypt data. This function returns an error if the blocksize of the Block does not equal the length of the supplied IV.
func Encrypter ¶ added in v0.1.0
Encrypter creates a data.Reader type from the specified block Cipher, IV and Writer.
This is used to Encrypt data. This function returns an error if the blocksize of the Block does not equal the length of the supplied IV.
func NewAes ¶
NewAes attempts to create a new AES block Cipher from the provided key data. Errors will be returned if the key length is invalid.
Types ¶
type CBK ¶
type CBK struct { // Random Source to use for data generation from keys. // This source MUST be repeatable. Source source A, B byte C, D byte // contains filtered or unexported fields }
CBK is the representation of the CBK Cipher. CBK is a block based cipher that allows for a variable size index in encoding.
func NewCBK ¶
NewCBK returns a new CBK Cipher with the D value specified. The other A, B and C values are randomally generated at runtime.
func NewCBKEx ¶
NewCBKEx returns a new CBK Cipher with the D value, BlockSize and Entropy source specified. The other A, B and C values are randomally generated at runtime.
func NewCBKSource ¶ added in v0.1.0
NewCBKSource returns a new CBK Cipher with the A, B, C, D, BlockSize values specified.
func (*CBK) Decrypt ¶
Decrypt decrypts the first block in src into dst. Dst and src must overlap entirely or not at all.
func (*CBK) Deshuffle ¶
Deshuffle will reverse the switch around the bytes in the array based on the Cipher bytes.
func (*CBK) Encrypt ¶
Encrypt encrypts the first block in src into dst. Dst and src must overlap entirely or not at all.
func (*CBK) Flush ¶
Flush pushes the remaining bytes stored into the buffer into the supplies Writer.
func (*CBK) Read ¶
Read reads the contents of the Reader to the byte array after decrypting with this Cipher.
type Reader ¶
Reader is an interface that supports reading bytes from a Reader through the wrapped Cipher.
type Writer ¶
Writer is an interface that supports writing bytes to a Writer through the wrapped Cipher.
type XOR ¶
type XOR []byte
XOR is an alias for a byte array that acts as the XOR key data buffer.
func (XOR) Decrypt ¶
Decrypt preforms the XOR operation on the specified byte array using the cipher as the key.
func (XOR) Encrypt ¶
Encrypt preforms the XOR operation on the specified byte array using the cipher as the key.
func (XOR) Operate ¶
Operate preforms the XOR operation on the specified byte array using the cipher as the key.