Software Implementation of Block Cipher PRESENT for 8-Bit Platforms

Software Implementation of Block Cipher PRESENT for 8-Bit Platforms

From CIS Lab, SJTU, China

Jump to: navigation, search

Introduction

PRESENT is an ultra-lightweight block cipher well suitable for extremely constrained environments such as RFID tags and sensor networks[1]. However, the authors of PRESENT only concentrate on hardware optimization. Here we give a fast and compact software implementation of PRESENT. The program is written in plain C, which is easy to be changed to work on various platforms.

Lookup tables (1040 bytes in total) are used to speed up the permutation layer (also merged with S-boxes). Our implementation costs 1.83 ms on MICAz wireless sensor node to perform a full-round (31 rounds) encryption of PRESENT. Compared with the software implementation of AES in [2], which needs 1.46 ms and 1915 bytes to perform a full-round encryption, our software implementation of PRESENT is a competitive alternative to traditional ways based on AES. This result has also been included in our paper [3].

Any question or suggestion is welcome to be sent to Bo Zhu and/or Zheng Gong.

Source Code

Download the source code: Block_cipher_present.zip (under BSD license).

There are only two interfaces to use this source codes:

1. The full-round encryption function:

void present(uint8_t *plain, uint8_t *key, uint8_t *cipher)

Before using this function, the plaintext should have already been placed in the 64-bit array leaded by plain, and the 80-bit secret key should also be arranged following key. After the encryption is done, the calculated ciphertext will be copied into cipher. Please note here, the areas identified by plain and cipher can overlap with each other (also key and cipher), and the encrypted data later stored in cipher is always correct, which is very convenient when building hash functions and MACs.

2. We also provide an interface in which the rounds of encryption can be specified:

void present_rounds(uint8_t *plain, uint8_t *key, uint8_t rounds, uint8_t *cipher)

Especially, if rounds is equal to 31, this will be a full-round encryption, same as present().

References

  1. A. Bogdanov, L. R. Knudsen, G. Leander, C. Paar, A. Poschmann, M. J. B. Robshaw, Y. Seurin and C. Vikkelsoe. PRESENT: An Ultra-Lightweight Block Cipher. CHES 2007.
  2. Michael Healy, Thomas Newe and Elfed Lewis. Analysis of Hardware Encryption Versus Software Encryption on Wireless Sensor Network Motes. Smart Sensors and Sensing Technology 2008.
  3. Zheng Gong, Pieter Hartel, Svetla Nikova and Bo Zhu. Towards Secure and Practical MACs for Body Sensor Networks. Indocrypt 2009.