|
@@ -14,8 +14,8 @@ import "strconv"
|
|
|
const BlockSize = 8
|
|
const BlockSize = 8
|
|
|
|
|
|
|
|
// A Cipher is an instance of an XTEA cipher using a particular key.
|
|
// A Cipher is an instance of an XTEA cipher using a particular key.
|
|
|
-// table contains a series of precalculated values that are used each round.
|
|
|
|
|
type Cipher struct {
|
|
type Cipher struct {
|
|
|
|
|
+ // table contains a series of precalculated values that are used each round.
|
|
|
table [64]uint32
|
|
table [64]uint32
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -54,7 +54,7 @@ func (c *Cipher) BlockSize() int { return BlockSize }
|
|
|
// instead, use an encryption mode like CBC (see crypto/cipher/cbc.go).
|
|
// instead, use an encryption mode like CBC (see crypto/cipher/cbc.go).
|
|
|
func (c *Cipher) Encrypt(dst, src []byte) { encryptBlock(c, dst, src) }
|
|
func (c *Cipher) Encrypt(dst, src []byte) { encryptBlock(c, dst, src) }
|
|
|
|
|
|
|
|
-// Decrypt decrypts the 8 byte buffer src using the key k and stores the result in dst.
|
|
|
|
|
|
|
+// Decrypt decrypts the 8 byte buffer src using the key and stores the result in dst.
|
|
|
func (c *Cipher) Decrypt(dst, src []byte) { decryptBlock(c, dst, src) }
|
|
func (c *Cipher) Decrypt(dst, src []byte) { decryptBlock(c, dst, src) }
|
|
|
|
|
|
|
|
// initCipher initializes the cipher context by creating a look up table
|
|
// initCipher initializes the cipher context by creating a look up table
|