In
cryptography,
ABC is a
block cipher designed in 2002 by Dieter Schmidt.
ABC is a
substitution-permutation network comprising 17 rounds with 3 different kinds of round functions. The first 8 rounds use
XORs,
modular multiplications as in
MMB, and an expanded version of the
pseudo-Hadamard transform (PHT) from
SAFER. The middle round uses just XORs and multiplications. The final 8 rounds are similar to the first 8, but using the inverse PHT. ABC's
block size of 256 bits and
key size of 512 bits are both larger than in typical block cipher algorithms. The
key schedule is very simple: 256-bit round keys are taken from the
key, which is rotated by a fixed amount in each round.
Sample implementation
This
Python implementation is used in the Encryption Module Pycrypto:<source lang="python">
- implementation by douglas funnie used in pycrypto
def MAKEITABC(string,key):
key = key+(key*17)
string = string+("x00"*(len(string)-len(key)))
output = ''
#SPLIT INTO EVEN LENGTH STRINGS USING Pseudo-Hadamard transform
dfhusion = key,key
salt = dfhusion+dfhusion+dfhusion+(2*dfhusion)#y
location = 0
for x in range(1,17):
#COMPARE
if location >= x:
location -= 17
#GET LETTAR
startKey = string
#XOR BY KEY
startKey = chr(ord(startKey)^ord(salt))
#OG-MMB BY LOC
startKey = chr(ord(startKey)%(location+1))
if x == 8:
salt =......
Read More