Go Home Page
The Go Programming Language

Package xtea

import "crypto/xtea"

This package implements XTEA encryption, as defined in Needham and Wheeler's 1997 technical report, "Tea extensions."

Package files

block.go cipher.go

Constants

The XTEA block size in bytes.

const BlockSize = 8

type Cipher

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 {
    // contains unexported fields
}

func NewCipher

func NewCipher(key []byte) (*Cipher, os.Error)

NewCipher creates and returns a new Cipher. The key argument should be the XTEA key. XTEA only supports 128 bit (16 byte) keys.

func (*Cipher) BlockSize

func (c *Cipher) BlockSize() int

BlockSize returns the XTEA block size, 8 bytes. It is necessary to satisfy the Cipher interface in the package "crypto/block".

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(src, dst []byte)

Decrypt decrypts the 8 byte buffer src using the key k and stores the result in dst.

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(src, dst []byte)

Encrypt encrypts the 8 byte buffer src using the key and stores the result in dst. Note that for amounts of data larger than a block, it is not safe to just call Encrypt on successive blocks; instead, use an encryption mode like CBC (see crypto/block/cbc.go).

func (*Cipher) Reset

func (c *Cipher) Reset()

Reset zeros the table, so that it will no longer appear in the process's memory.

type KeySizeError

type KeySizeError int

func (KeySizeError) String

func (k KeySizeError) String() string