Circular bit rotation is an operation where bits are moved in a circular fashion such that bits change their positional values and do not fall off, but rather are placed back to the other end [1, 2]. A left rotation operation is where bits that fall off at the left end are placed back at the right end [1, 2]. In a right rotation operation, bits that fall off at the right end are placed back at the left end [1, 2]. A shift operation that is circular seeks to rearrange the entries present in a data structure by moving the bit to the next position whiles the last bit is moved to the position of the first bit [1, 2]. Elimination of bits is not done by the rotate instructions. For a left rotate (rol), as shown in Fig. 1, bits shifted off the left end of a data word fill the vacated positions on the right. Likewise, for a right rotate (ror), bits “falling off” the right end appear in the vacated positions at left [1, 2].
The bit sequence 00010111 rotated circularly to the left by one bit position produces the bit sequence 00101110 in Fig. 1 above. No bits are lost after the rotational operation or process [1, 2].
With reference to Fig. 2, if the bit sequence 00010111 were subjected to a circular shift of one bit position to the right would yield: 10001011 [1, 2].
The concept of circular bit rotation is made clearer by the example below. Assuming we have an 8 bit sequence, say 11100101, moving the bits by 3 places to the left produces 00101111 bit sequence. This implies that the first 3 bits are placed back at the end of the bit sequence. Moving the bits in the original bit sequence by 3 places to the right produces 10111100 bit sequence. This implies that the last 3 bits are placed back at the beginning of the bit sequence. If we have a 16 bit sequence, say 0000000001110010, moving the bits by 3 places to the left produces 0000001110010000 bit sequence. Moving the bits in the original bit sequence by 3 places to the right produces 0100000000001110 bit sequence [1, 2].
A number of cryptographic researchers used the logical XOR gate (digital logical gate which performs a logical operation on one or more logic inputs and produces a single logic output) or operation in their encryption protocols [3, 4].
Rotators and shifter move bits and multiply or divide by powers of 2. A shifter shifts a number in base 2 left or right by some specified number of positions. Some commonly used shifter kinds include; Logical shifter, Arithmetic shifter and Rotator [5, 6]. Logical shifter shifts the number to the left (LSL) or right (LSR) and fills empty spots or positions with zeros. Ex: 11001 LSL 2 = 00100, 11001 LSR 2 = 00110. The arithmetic shifter operates just like the logical shifter but with some slight operation difference [5, 6]. On the right shift, it fills the most significant bit (msb) with a copy of the old significant bit, which is vital or key for dividing and multiplying signed numbers. Arithmetic shift left works the same as the logical shift left. Ex: 11001 ROR 2 = 01110; 11001 ROL 2 = 00111. Rotators rotate the bit string in a circle such that empty spots are filled with bits shifted off the other end. Ex: 11001 ROR 2 = 01110; 11001 ROL 2 = 00111 [5, 6].
A shifter that perform left shifts, logical and arithmetic right shifts, or no shift is shown in Fig. 3 below from a classical perspective [7].
In 2008, Renesas Electronics Corporation demonstrated a method for decreasing the time taken by a H8 CPU in performing an 8 bit rotate from LSB first to MSB first. This approach has two methods for completing an 8 bit rotate. The first method employs a look up table; the second rotates physically the data from MSB first to LSB first [8].
The OR, AND, NOT and XOR are simple bit-parallel operations supported in word-oriented processors. They are logical operations that are typically implemented with integer arithmetic operations in computer system, specifically the arithmetic and logic unit, which is the most basic functional unit in a processor. In bit rotations, shifter and mix operations can be used [9].
The standard set of bitwise operations, including OR, AND, XOR, LEFT/RIGHT SHIFT, NOT, is incorporated or available in the C and C++ programming languages. However, circular shift is excluded in the language [10]. When a computer integer is rotated, any bit that falls off one end of the register is moved to the other end as if they are connected end-to-end in a conceptual manner. Circular rotation has some applications in cryptography, for the purposes of encryption and decryption [10].
Bennett disclosed the secret of saving energy by maintaining a unique mapping between input and output vectors called logical reversibility of computation [11]. A reversible circuit is composed of reversible gates only whereas a reversible gate has the property of maintaining one-to-one mapping between input and output vectors. Among the conventional logic gates, NOT operation is the only one which itself is reversible. However, the other conventional logic operations have their reversible counterpart, which is known as n × n dimensional reversible gate. In designing reversible circuits, there exist 2 × 2 and several 3 × 3 gates [12,13,14]. A typical example of the 2 × 2 gate is the Feynman gate [12]. Fredkin gate [14] and Feynman double gate [13] are examples of 3 × 3 gates.
Muwafi et al. also proposed a circuit for rotating, left shifting, or right shifting bit where a circuit for rotating bits of an input word during a single cycle, by duplicating the input word to form an extended word, shifting bits of the extended word, and selecting a subset of the shifted bits of the extended word [15].
Application
Bit rotation is employed in barrel shifters (a logic circuits extensively used in embedded digital signal processors as well as in general purpose processors to manipulate the data as rotating and shifting information is required in few fields including bit-indexing, arithmetic tasks and variable-length coding) [16, 17]. Bharathesh et al. proposed a low power mux based on dynamic barrel shifter using footed diode domino logic [16, 17]. There are bidirectional barrel shifters that can perform six unique tasks: shift right arithmetic (SRA), shift right logical (SRL), rotate left (RL), shift left logical (SLL), shift left arithmetic (SLA), and rotate right (RR) [16, 17].
Shah et al. designed a fully custom 8 bit barrel shifter using 8 × 1 multiplexer with the help of GDI technique. The barrel shifter is simply a bit-rotating shift register [18]. A robust architecture of logarithmic barrel shifter that performs bidirectional arithmetic and logical shifting, including rotate operation [19]. Aarthi et al. conducted an image encryption using binary bit plane and rotation method for an image security. Yeng et al. also used the concept of bit rotation to design an encryption algorithm [2, 20]. A new universal hash function, circulant hash based on bit rotation was proposed and is a variant of the classical random matrix-based hash of Carter and Wegman, called H3, and Toeplitz hash by Krawczyk [21]. An encryption approach for Images using Bits Rotation Reversal and Extended Hill Cipher Technique was also devised [22] as well as an Adaptive Bit Rotation and Inversion Scoring, a novel approach to LSB Image Steganography [23].
Quantum perspective
In quantum computing, unit of data is called qubit and the value of qubit is the superposition of |0> and |1> . Every quantum operation is reversible if it is represented by a unitary matrix which is used to multiply the state of qubit(s) that produces output [24]. Quantum computers process data by applying a universal set of quantum gates that can emulate any rotation of the quantum state vector [25]. The comparative quantum realization of any reversible circuit is used to verify the operability of that circuit [19].
A quantum circuit called quantum shift register in which shift and rotation operations on qubits are performed by swap gates and controlled swap gates. For quantum computers to perform arithmetic operations that are elementary (bitwise comparison of qubits and multiplication), these operations are of essence [26].
Rotation operators are defined as Rx, Ry and Rz and are shown in Fig. 4 below.
When the Pauli matrices are exponentiated, rotation operators are generated according to exp (iAx) = cos(x) I + I sin(x) A, where A is one of the three Pauli Matrices [27, 28].
Problem, objective and contribution
The current or existing circular bit rotation techniques never ends because it is in a cycle and is continuous. Unlike a logical shift, the vacant bit positions are not filled in with zeros but are filled in with the bits that are shifted out of the sequence [29]. Repetition of bit strings tend to show up at some point when the bit string is rotated circularly using shifts progressively and this poses as a weakness and danger, even to computing and cryptography [2]. For the quantum–classical perspective also, no work has been done with circular bit rotation. The objectives of this paper include;
-
1.
Address the problem of repetitions in emergent/resulting bit strings when the incident/original bit string is rotated circularly.
-
2.
Add or contribute to existing knowledge using a novel concept.
-
3.
Provide a quantum perspective to bit rotation using the quantum swap gate.
-
4.
Provide a performance analysis based on execution times of classical implementation and quantum implementation codes on the binary bit strings.