Khazad is a Non Feistel Block Cipher scheme designed by Paulo S. L. M. Barreto and Vincent Rijmen. This cipher consists of 8 rounds of simple operation such XOR, shift, and substitution. Khazad block cipher has capability of encrypting and decrypting 64-bit block of data with 128-bit keys supplied. The authors said that khazad cipher is free to use and never be patented.
The cipher was easy, straightforward and easy to understand. Here, i provided you an example of Tweaked Khazad Block cipher implementation on PIC18F4550 microcontroller. The implementation here is based on the original C code Khazad implemementation on 64-bit microprocessor platform, therefore this way of implementation employs large lookup table approximately 16kbytes.
Basically, Khazad runs fast on PIC18F4550. It requires 9903 cyles for key setup and 3872 cycles for encryption and decryption. Since Khazad was an involutional block cipher, you may notice that encrypting and decrypting speed was the same as well as its strength. The only thing that differ is about subkeys.
The source code here was developed and simulated on MPLAB v8.0 and released under the term of GNU Public License 3.0. Feel free to use it by your own risk🙂 . See screenshots below.
Khazad Plain text (Blue = key, Orange = Plain Text)
Khazad Cipher Text (Blue = Cipher Text)
Khazad Generated Subkeys (Blue = Encrypting Subkeys, Orange = Decrypting Subkeys)
I realized that this implementation hoggs memory much and i may not fit on real implementation such smart cards. I will scale down this implementatio so that it fit on smaller microcontroller such PIC16F84 and PIC16F877. Keep visiting this blog for more updates. Cheers😀
– Khazad Block Cipher