FPGA Implementation of Rectangle Lightweight Block Cipher
FPGA Implementation of Rectangle Lightweight Block Cipher
https://doi.org/10.22214/ijraset.2022.42143
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
Abstract: Block ciphers are basic building blocks for network security. In recent years, designing a lightweight block cipher is
the main goal of VLSI design engineers.
In this paper, we have designed and verified the functionality of the RECTANGLE block cipher which is one of the lightweight
block cipher using Modelsim simulator and implemented using Intel Quartus Prime 18.0 FPGA device. Using the bit-slice
technique a RECTANGLE block cipher allows lightweight and fast implementations. The en-cryption architecture has two parts
one is round transformation and the other is key scheduling.
RECTANGLE uses Substitution-Permutation network. It takes 64-bit plain text and an 80-bit key as an input and converts it into
a 64-bit ciphertext.
There are three main advantages of using the RECTANGLE block cipher. First, it has a simple design. Second, it is very
hardware friendly. By selecting the proper S-block RECTANGLE can achieve good security performance.
Index Terms: Lightweight Block Cipher, Block Ciphers, Encryption, Bit-slice technique, Round Transformation, Key
Scheduling, Substitution Block, Permutation Block.
I. INTRODUCTION
In a world, full of cybercrimes and data misuse, information and network security is the need of the hour. Here cryptography plays
an important role. Cryptography is nothing but a process that converts an ordinary plaintext into ciphertext and vice-versa. It is the
method that protects information and communicates through the codes. Cryptography is classified into two categories first is the
mode of operation and second Feistel network, substitution-permutation network. It can be done by symmetric key and asymmetric
key.
Block ciphers are the primary integrant of cybersecurity as they are used to convert plaintext to ciphertext and back. But light-
weighted block ciphers have substituted all the other conventional block ciphers because of its low computing resource, low
memory usage, and power.
Symmetric cryptography utilizes only one key for encryption and decryption of data, while in the other hand asymmetric or public-
key cryptography utilizes both public and private keys for encryption and decryption of data. Block cipher is a symmetric cipher
process information block of various bits using constant mapping.
A lightweight block cipher is not the same as block ciphers as it used different algorithms that require less area, memory (RAM,
ROM), power, etc. It gives a much simpler and faster result compared to the conventional ones. In this paper, we have verified the
functionality of an architecture that has been designed and implemented using the Intel Quartus Prime 18.0 FPGA tool in the
Cyclone IV device.
Our main objective in this project is to design and verify the functionality of a lightweight RECTANGLE block cipher which
consists of various blocks. For this, we have designed different blocks such as S-blocks, Permutation block, 2:1 multiplexers, round
counters, etc.
In this paper, we present a design of a RECTANGLE lightweight block cipher using 4x4 S-block. The paper contains the following
sub-sections: in section II, a literature review is presented. In that, subsection A explains the rectangular block cipher. The
architecture of RECTANGLE is discussed in subsection B again it has four parts, part 1 explains the subkey state and cipher state.
Part 2 describes the round transformation methodology in the architecture. Subsequently, in part, the 3 S-block design has been
discussed.
In part, 4 explains the key scheduling methodology in architecture. Simulation results are shown in subsection C. Section III will
conclude all the work.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 2426
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
B. Rectangle Architecture
The RECTANGLE Lightweight Block Cipher architecture shown in fig. 1 utilizes a 64-bit datapath to get the encrypted cipher state.
16 S-Boxes operate parallelly as it is applied to all 64-bits. In Key scheduling, S-box substitution is applied to only 16-bits, so
requires only four S-Boxes. The round Transformation and Key scheduling operations run parallelly. These all will be described in
precisionl in the subsequent sections.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 2427
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
1) Sub-Key State and Cipher State: One of the main reasons of naming the lightweighted cipher as RECTANGLE is that the block
sizes can be pictured as a (4 x 16) array of bits. The cipher state consists of a 64-bit plaintext or ar 64-bit cipher text. let w15,
w14.... w1,w0 represent the cipher state in first row. Similarly,w31 .....w17,w16 bits are arranged in second row and so on as
shown below in Matrix1.
For convinience, a cipher text can also be represented in a two-dimensional array as shown in matrix2.
Also, a 64-bit key can be represented as (4 x 16 ) array known as sub-key state. The algorithm requires three steps
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 2428
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
2) Round Transformation: There are two 64-bit registers. One to store the round sub-key and the other for ciphertext. The
ciphertext like we saw above is represented as a 4 x 16 array and at a time only 16-bits are processed sequentially. At every
clock cycle, the leftmost four columns of the current state are being XORed with the correspondent subkey register.
This operation is called the Add Round Key. Then the S-Box used in the RECTANGLE algorithm behaves as a 4-bit x 4-bit S-box
SCHEDULING. Let Ti be the 16-bit temporary state., for i= 1 to 12. The sub-column transformation can be evaluated in 12 steps:
1.T1 = NOT X1, 2. T2= X0 AND T1, 3. T3 = X2 XOR X3,
4. Y0 = T2 XOR T3, 5. T5= X3 OR T1,6.T6 = X0 XOR T5,
7. Y1 = X2 XOR T6, 8. T8 = X1 XOR X2, 9.T9 = T3 AND T6, 10.Y3 = T8 XOR T9, 11. T11 = Y0 OR T8,
12. Y2 = T6 XOR T11
The result of the XOR is put through parallel operation of ( 4 x 4 ) S-Box as illustrated below.
Input of to the S-Box(Matrix 3) is : column(j)= X3;j , X2;j , X1;j , X0;j ; (for j = 0 to 15)
i.e.
and ouput of the S-Box (Matrix 4) is : column(j)= Y3;j , Y2;j , Y1;j , Y0;j; (for j= 0 to 15) i.e.
Similarly, the non-linear substitution is done for all the 16 columns parallelly using 16 (4 x 4) S-Boxes. The values are specified in
hexadecimal that we will discuss in the next subsection. The final step of round Transformation includes Shift Row operation which
is called as the Permutation layer. Row 0 is shifted by 0 bits ( i.e. no rotation). Row 1 is left shifted by 1 bit. Row 2 is left shifted by
12 bits and the last row ( i.e. row 3) is left shifted by 13 bits. Let Y0, Y1, Y2, Y3 be the four 16-bit inputs of shift-row operation and
Z0, Z1, Z2, Z3 be the four 16-bit outputs. So,
Z0 = Y0;
Z1 = left-shift Y1 by 1 bit ;
Z2 = left-shift Y2 by 12 bits;
Z3 = left-shift Y3 by 13 bits;
So, these are the three steps of round transformation.
In the next clock cycle, 16 bits of cipher state is XORed with correspondent bits of subkey register. By the end of one clock cycle ,
the control signal is used to rotate the four rows over the conditions specified in shift row transformation and simultaneously store
the values of the last S-Box output. This is known as Round Transformation.One clock cycle completes one round transformation.
The control signal simultaneously loads the next round key into the sub-key register that is extracted from key-scheduling. After 25
rounds of 64-bit XOR of the current state with a sub-key state, the cipher state gives the final output.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 2429
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
3) S-Box Design : S-box executes substitution operation. Here, we have taken a 4 x 4 S-Box ( i.e. four inputs and four outputs).
We have generated a look up table as shown in table1.
TABLE I
S-BOX LOOKUP TABLE
INPUT OUTPUT
0 6
1 5
2 C
3 A
4 1
5 E
6 7
7 9
8 B
9 0
A 3
B D
C 8
D F
E 4
F 2
4) Key Scheduling: Key scheduling requires 80- bit ( rep-resented as 5 x 16 array) key registers. It can be represented in matrix
form as shown below in matrix 5.
For convinience, it can also be represented in a two-dimensional array (in matrix 6) as Ki;15,...... Ki;1, Ki;0 ,for (i=0 to 4 ).
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 2430
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
At round i (total 25 rounds from i= 0 to 24), the sub-key Ki, contains the first four rows of key register ( Ki = row3, row2, row1,
row0 ). In the first step of key scheduling, S-Box substitution is applied to the bits intersecting the rightmost columns and the four
uppermost rows. i.e. Input of to the S-Box (in matrix 7) is : column(j)= K3;j , K2;j , K1;j , K0;j ; (for j = 0 to 3)
i.e. (for j=0)
and ouput of the S-Box (in matrix 8) is : column(j)= L3;j, L2;j , L1;j , L0;j; (for j= 0 to 3) i.e. ( for j=0 )
Similarly, the non-linear substitution is done for the first four columns parallelly using four (4 x 4) S-Boxes respectively. And the
remaining 64 bits are passed through the wire. Next, one round of Fiestal transformation is used to the existing five rows which are
also referred to as Permutation Layer.
i.e. NewRow0 = ( left-shift Row0 by 8 bits ) XOR with Row1;
NewRow1 = Row2;
NewRow2 = Row3;
NewRow3 = ( left-shift Row0 by 12 bits ) XOR with Row4;
NewRow4 = Row0
After executing this step, we move to the last step where the right-most five bits of NewRow0 is XORed with a round constant RCi
(which is five bits). Each round of iteration has different values of round constants which are being generated by a five-bit LFSR (
linear-feedback shift register).
i.e. ( L
0;4, L0;3, L0;2, L0;1, L0;0 ) = ( K0;4, K0;3, K0;2,
K0;1, K0;0) XORed with (RCi). The values of RCi are as follows:
RC0 = 0X01, RC1] = 0X02,RC2 = 0X04,RC3 = 0X09,RC4
= 0X12, RC5 = 0X05, RC6 = 0X0B, RC7 = 0X16, RC8
= 0X0C, RC9 = 0X19,RC10 = 0X13,RC11 = 0X07, RC12
= 0X0F,RC13 = 0X1F,RC14 = 0X1E,RC15 = 0X1C,RC16 =
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 2431
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
0X18,RC17 = 0X11, RC18 = 0X03,RC19 = 0X06,RC20 = 0X0D,RC21 = 0X1B,RC22 = 0X17,RC23 = 0X0E,RC24 = 0X1D.
After 25 round cycles, K25 is finally extracted.
C. Simulation Results
III. CONCLUSION
A RECTANGLE block cipher is a flexible lightweight ( based on bit-slicing) algorithm that is used in many applica-tions such as
RFID, WSNs, etc. From the simulation results.
Table II
Synthesis Report For Rectangular Block Cipher
Target Device used Cyclone IV E
Logical Elements used 259
Total registers used 149
Pins used 211
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 2432
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
TABLE. III
POWER ANALYSIS SUMMERY
It operates at a maximum of 150MHz. The architecture has been implemented on the Intel Quartus Prime 18.0 device. It has the
flexibility to choose different key sizes. It can trigger many problems in the field of cryptography and design. The P-Layer uses
three left rotations, which not only reduces cost in hardware but also has software efficiency. Yet RECTANGLE is an interesting
design, and there is always a further scope of security-based research in RECTANGLE, be it be in reducing the S-box used, using
fewer clock cycles for each rotation, etc.
IV. ACKNOWLEDGMENT
We owe our deep gratitude to our mentor for his constant encouragement, support, and guidance throughout this journey. His keen
supervision has not only helped us learn but grow our knowledge base to a new horizon.
REFERENCES
[1] Md. Nazmul Hasan, Md. Tariq Hasan, Rafia Nishat Toma, and Md. Maniruzzaman, “Fpga implementation of l-block lightweight block cipher,” March, 2017,
doi: 10.1109/CEEICT.2016.7873062.
[2] Jai Gopal Pandey, Ayush Laddha, and Sashwat Deb Samaddar, “A lightweight vlsi architecture for RECTANGLE cipher and its Im-plementation on an
FPGA,” 24th International Symposium on VLSI Design and Test (VDAT), Bhubaneswar, India, 2020, pp.16, doi: 10.1109/VDAT50263.2020.9190623.
[3] Wentao Zhang, Zhenzhen Bao, Dongdai Lin, Vincent Rijmen, Bohan Yang, and Ingrid Verbauwhede, “Rectangle: a bit-slice lightweight block cipher suitable
for multiple platforms,” Sci. China Inf. Sci. 58, 1–15 (2015).
[4] Hatzivasilis, G., Fysarakis, K., Papaefstathiou, I. et al., “ A review of lightweight block ciphers,” doi:10.1007/s13389-017-0160-y
[5] Soheil Feizi, Ali Nemati, Arash Ahmadi, and Vahab AI-din Makki, “A high-speed fpga implementation of a bit-slice ultra-lightweight block cipher, rectangle,”
2015 5th International Conference on Computer and Knowledge Engineering (ICCKE).
[6] Zheng Gong, Svetla Nikova, and Yee Wei Law. “KLEIN: a new family of lightweight block ciphers”, RFID Security and Privacy, 26-28 June 2011.
[7] D. Hong, J. Sung, S. Hong, J. Lim, S. Lee, B. Koo, C. Lee, D. Chang, K. Jeong, H. Kim and S. Chee, “HIGHT: A new block cipher suitable for low-resource device”, LNCS 4249,
pp. 46-59, Springer-Verlag, 2006.
[8] Sweta K. Parmar, K.C. Dave, “Implementation of Data Encryption and Decryption Algorithm for Information Technology”, International Journal of Advances
in Science Engineering and Technology, Volume-1, Issue- 2, Oct-2013.
[9] Jai Gopal Pandey, Tarun Goel, Mausam Nayak, Chhavi Mitharwal, Abhijit Karmakar, Raj Singh, “A High-performance VLSI Architecture of the PRESENT Cipher and its
Implementations for SoCs”, IEEE, 2018.
[10] George Hatzivasilis, Konstantinos Fysarakis, Ioannis Papaefstathiou, Harry Manifavas, “A review of lightweight Block Ciphers”, DOI: 10.1007/s13389-017-
0160, JCE, 2017.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 2433