Class: Tea

Tea

Tiny Encryption Algorithm. David Wheeler & Roger Needham, Cambridge University Computer Lab. www.movable-type.co.uk/scripts/tea.pdf - TEA, a Tiny Encryption Algorithm (1994) www.movable-type.co.uk/scripts/xtea.pdf - Tea extensions (1997) www.movable-type.co.uk/scripts/xxtea.pdf - Correction to xtea (1998)

Constructor

new Tea()

Source:

Methods

(static) base64Decode()

Decodes base64
Source:

(static) base64Encode()

Encodes base64 - developer.mozilla.org/en-US/docs/Web/API/window.btoa, nodejs.org/api/buffer.html
Source:

(static) decode(v, k) → {Array.<number>}

XXTEA: decodes array of unsigned 32-bit integers using 128-bit key.
Parameters:
Name Type Description
v Array.<number> Data vector.
k Array.<number> Key.
Source:
Returns:
Decoded vector.
Type
Array.<number>

(static) decrypt(ciphertext, password) → {string}

Decrypts text using Corrected Block TEA (xxtea) algorithm.
Parameters:
Name Type Description
ciphertext string String to be decrypted.
password string Password to be used for decryption (1st 16 chars).
Source:
Throws:
Invalid ciphertext
Type
Error
Returns:
Decrypted text.
Type
string

(static) encode(v, k) → {Array.<number>}

XXTEA: encodes array of unsigned 32-bit integers using 128-bit key.
Parameters:
Name Type Description
v Array.<number> Data vector.
k Array.<number> Key.
Source:
Returns:
Encoded vector.
Type
Array.<number>

(static) encrypt(plaintext, password) → {string}

Encrypts text using Corrected Block TEA (xxtea) algorithm.
Parameters:
Name Type Description
plaintext string String to be encrypted (multi-byte safe).
password string Password to be used for encryption (1st 16 chars).
Source:
Returns:
Encrypted text (encoded as base64).
Type
string

(private, static) longsToStr()

Converts array of longs to string.
Source:

(private, static) strToLongs()

Converts string to array of longs (each containing 4 chars).
Source:

(static) utf8Decode()

Decodes utf8 string to multi-byte
Source:

(static) utf8Encode()

Encodes multi-byte string to utf8 - monsur.hossa.in/2012/07/20/utf-8-in-javascript.html
Source: