{"modulePath":"code.cloudfoundry.org/cli-sapi","version":"v6.1.1+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package xts\n\nPackage xts implements the XTS cipher mode as specified in IEEE P1619/D16.\n\nXTS mode is typically used for disk encryption, which presents a number of novel problems that make more common modes inapplicable. The disk is conceptually an array of sectors and we must be able to encrypt and decrypt a sector in isolation. However, an attacker must not be able to transpose two sectors of plaintext by transposing their ciphertext.\n\nXTS wraps a block cipher with Rogaway's XEX mode in order to build a tweakable block cipher. This allows each sector to have a unique tweak and effectively create a unique key for each sector.\n\nXTS does not provide any authentication. An attacker can manipulate the ciphertext and randomise a block (16 bytes) of the plaintext.\n\n(Note: this package does not implement ciphertext-stealing so sectors must be a multiple of 16 bytes.)\n\n## Types\n\n```go\ntype Cipher struct {\n\t// contains filtered or unexported fields\n}\n```\nCipher contains an expanded key structure. It doesn't contain mutable state and therefore can be used concurrently.\n\n```go\nfunc NewCipher(cipherFunc func([]byte) (cipher.Block, error), key []byte) (c *Cipher, err error)\n```\nNewCipher 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.\n\n```go\nfunc (c *Cipher) Decrypt(plaintext, ciphertext []byte, sectorNum uint64)\n```\nDecrypt decrypts a sector of ciphertext and puts the result into plaintext. Plaintext and ciphertext may be the same slice but should not overlap. Sectors must be a multiple of 16 bytes and less than 2²⁴ bytes.\n\n```go\nfunc (c *Cipher) Encrypt(ciphertext, plaintext []byte, sectorNum uint64)\n```\nEncrypt encrypts a sector of plaintext and puts the result into ciphertext. Plaintext and ciphertext may be the same slice but should not overlap. Sectors must be a multiple of 16 bytes and less than 2²⁴ bytes.\n\n","path":"code.cloudfoundry.org/cli-sapi/src/code.google.com/p/go.crypto/xts","name":"xts","synopsis":"Package xts implements the XTS cipher mode as specified in IEEE P1619/D16.","isRedistributable":true}
