Cipher contains an expanded key structure. It is safe for concurrent use if the underlying block cipher is safe for concurrent use.
type Cipher struct {
// contains filtered or unexported fields
}
func NewCipher(cipherFunc func([]byte) (cipher.Block, error), key []byte) (c *Cipher, err error)
NewCipher creates a Cipher given a function for creating the underlying block cipher (which must have a block size of 16 bytes). The key must be twice the length of the underlying cipher's key.
func (c *Cipher) Decrypt(plaintext, ciphertext []byte, sectorNum uint64)
Decrypt decrypts a sector of ciphertext and puts the result into plaintext. Plaintext and ciphertext must overlap entirely or not at all. Sectors must be a multiple of 16 bytes and less than 2²⁴ bytes.
func (c *Cipher) Encrypt(ciphertext, plaintext []byte, sectorNum uint64)
Encrypt encrypts a sector of plaintext and puts the result into ciphertext. Plaintext and ciphertext must overlap entirely or not at all. Sectors must be a multiple of 16 bytes and less than 2²⁴ bytes.