CAST-128

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Alirezabot (talk | contribs) at 17:57, 29 June 2012 (r2.7.2) (Robot: Adding fa:Cast-۱۲۸). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

CAST-128
General
DesignersCarlisle Adams and Stafford Tavares
First published1996
SuccessorsCAST-256
Cipher detail
Key sizes40 to 128 bits
Block sizes64 bits
StructureFeistel network
Rounds12 or 16
Three rounds of the CAST-128 block cipher

In cryptography, CAST-128 (alternatively CAST5) is a block cipher used in a number of products, notably as the default cipher in some versions of GPG and PGP. It has also been approved for Canadian government use by the Communications Security Establishment. The algorithm was created in 1996 by Carlisle Adams and Stafford Tavares using the CAST design procedure; another member of the CAST family of ciphers, CAST-256 (a former AES candidate) was derived from CAST-128. According to some sources, the CAST name is based on the initials of its inventors, though Bruce Schneier reports the authors' claim that "the name should conjure up images of randomness" (Schneier, 1996).

CAST-128 is a 12- or 16-round Feistel network with a 64-bit block size and a key size of between 40 to 128 bits (but only in 8-bit increments). The full 16 rounds are used when the key size is longer than 80 bits. Components include large 8×32-bit S-boxes based on bent functions, key-dependent rotations, modular addition and subtraction, and XOR operations. There are three alternating types of round function, but they are similar in structure and differ only in the choice of the exact operation (addition, subtraction or XOR) at various points.

Although Entrust holds a patent on the CAST design procedure, CAST-128 is available worldwide on a royalty-free basis for commercial and non-commercial uses.

Test vectors :

Below is a sample test vector, providing the input and the expected output for the above algorithm. Even, the values of Key Schedule, Km and Kr is provided for both encryption and decryption.

Encryption :

128-bit key = 01 23 45 67 12 34 56 78 23 45 67 89 34 56 78 9A

plaintext = 01 23 45 67 89 AB CD EF

ciphertext = 23 8B 4F E5 84 7E 44 B2

i K[i] Km[i] Kr[i]
1 BC173E26 BC173E26 00000015
2 78A207EF 78A207EF 0000001B
3 ECE0A7F5 ECE0A7F5 00000001
4 7CB0FB6B 7CB0FB6B 00000005
5 A5D2D636 A5D2D636 00000003
6 D78B9407 D78B9407 0000001F
7 56C069D3 56C069D3 0000001F
8 82E8240C 82E8240C 0000001C
9 33543749 33543749 00000010
10 8813D5C7 8813D5C7 0000001F
11 B9FCD732 B9FCD732 00000012
12 59106B36 59106B36 00000001
13 496AF1A9 496AF1A9 0000001D
14 18F8DC43 18F8DC43 00000019
15 8D9DEF0F 8D9DEF0F 00000001
16 83EDA384 83EDA384 0000000F

Decryption :

128-bit key = 01 23 45 67 12 34 56 78 23 45 67 89 34 56 78 9A

plaintext = 23 8B 4F E5 84 7E 44 B2

ciphertext = 01 23 45 67 89 AB CD EF

i K[i] Km[i] Kr[i]
1 BC173E26 BC173E26 00000015
2 78A207EF 78A207EF 0000001B
3 ECE0A7F5 ECE0A7F5 00000001
4 7CB0FB6B 7CB0FB6B 00000005
5 A5D2D636 A5D2D636 00000003
6 D78B9407 D78B9407 0000001F
7 56C069D3 56C069D3 0000001F
8 82E8240C 82E8240C 0000001C
9 33543749 33543749 00000010
10 8813D5C7 8813D5C7 0000001F
11 B9FCD732 B9FCD732 00000012
12 59106B36 59106B36 00000001
13 496AF1A9 496AF1A9 0000001D
14 18F8DC43 18F8DC43 00000019
15 8D9DEF0F 8D9DEF0F 00000001
16 83EDA384 83EDA384 0000000F

See also

References

External links