Docsity

TEA Encryption and Decryption Function and TEA in Use in Electronic Commerce, Slides of Fundamentals of E-Commerce

Toggle sidebar
bg1
4-31
Electronic Commerce (WS-02/03)
TEA encryption function
void encrypt(unsigned long k[], unsigned long text[]) {
unsigned long y = text[0], z = text[1]; 1
unsigned long delta = 0x9e3779b9, sum = 0; int n; 2
for (n= 0; n < 32; n++) { 3
sum += delta; 4
y += ((z << 4) + k[0]) ^ (z+sum) ^ ((z >> 5) + k[1]); 5
z += ((y << 4) + k[2]) ^ (y+sum) ^ ((y >> 5) + k[3]); 6
}
text[0] = y; text[1] = z; 7
}
Docsity.com
pf3
pf4
pf5

Partial preview of the text

Download TEA Encryption and Decryption Function and TEA in Use in Electronic Commerce and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

Electronic Commerce (WS-02/03) 4-

TEA encryption function

void encrypt(unsigned long k[], unsigned long text[]) {

unsigned long y = text[0], z = text[1]; 1

unsigned long delta = 0x9e3779b9, sum = 0; int n; 2

for (n= 0; n < 32; n++) { 3

sum += delta; 4

y += ((z << 4) + k[0]) ^ (z+sum) ^ ((z >> 5) + k[1]); 5

z += ((y << 4) + k[2]) ^ (y+sum) ^ ((y >> 5) + k[3]); 6

text[0] = y; text[1] = z; 7

Electronic Commerce (WS-02/03) 4-

TEA decryption function

void decrypt(unsigned long k[], unsigned long text[]) {

unsigned long y = text[0], z = text[1];

unsigned long delta = 0x9e3779b9, sum = delta << 5; int n;

for (n= 0; n < 32; n++) {

z -= ((y << 4) + k[2]) ^ (y + sum) ^ ((y >> 5) + k[3]);

y -= ((z << 4) + k[0]) ^ (z + sum) ^ ((z >> 5) + k[1]);

sum -= delta;

text[0] = y; text[1] = z;

Electronic Commerce (WS-02/03) 4-

Cryptography: Public Keys

D(K

d

(E(K

e

,M)) = M

Decryption key K

d

must be a secret

Encryption key K

e

is public

Electronic Commerce (WS-02/03) 4-

RSA Encryption - 1

To find a key pair e, d:

  1. Choose two large prime numbers, P and Q (each greater than 10100), and form: N = P x Q Z = (P–1) x (Q–1)
  2. For d choose any number that is relatively prime with Z (that is, such that d has no common factors with Z). We illustrate the computations involved using small integer values for P and Q: P = 13, Q = 17 – > N = 221, Z = 192 d = 5
  3. To find e solve the equation: e x d = 1 mod Z That is, e x d is the smallest element divisible by d in the series Z+1, 2 Z+1, 3 Z+1, .... e x d = 1 mod 192 = 1, 193, 385, ... 385 is divisible by d e = 385/5 = 77

Electronic Commerce (WS-02/03) 4-

Blowfish

Symmetric block cipher encryption/decryption algorithm

Can be used as a drop-in replacement for DES or IDEA.

Takes a variable-length key, from 32 bits to 448 bits, ...

... making it ideal for both domestic and exportable use.

Blowfish was designed in 1993 by Bruce Schneier as a fast, free

alternative to existing encryption algorithms. Since then it has

been analyzed considerably, and it is slowly gaining

acceptance as a strong encryption algorithm. Blowfish is

unpatented and license-free, and is available free for all uses.