Have you ever heard about A5/1 stream cipher. A5 is one of three famous and “secret” GSM algorithm (instead of A3 and A8). This cipher was pretty famous because it was used to encrypt all GSM conversation on the earth. I dont know exactly, perhaps all GSM provider were migrating to A5/2 or even the newest one, which is A5/3 (a.k.a kasumi cipher).

Many crypto geniuses, crypto nerds and crypto nutters said that A5/1 cipher was not designed perfectly to encrypt GSM conversation. It was such a “dummy” cryptosystem to fool human being, so intelligent guys could work behind😳 . Others people said that A5/2 is even weaker than A5/1 and other said that A5/3 (kasumi) is pretty secure than its two predecessors. Nice scenario ha..😈

I do totally blind about this, lets just assume that everyting is true. Even in fact, i even don’t give a damn to those issues😀 . For now on, lets have fun with A5/1 cipher. Our job here is about implementing A5/1 cipher in hardware, if you are questioning this issues lets check it out👿 .

A5/1 cipher is a kind of stream cipher that employs LFSR (Linear Feedback Shift Register). Below, i picked a picture from Wikipedia. As you can see, A5/1 cipher uses 3 shift registers with different length and different taps. Taps are used to determine next Least Significant Bit of Shift Register, when it is going to be shifted. For example, register R1 which has 19 bits length, it taps and XORs its 13rd, 16th, 17th and 18th bit to produce next Least Significant Bit. R2 and R3 also have their own way to tap inputs and produce next least significant bit.

When clock occurs, each bit will shifted 1 unit to the left. The most left bit (least significant bit) will be filled by value that produced by each taps output. Lets just see the picture, it is easier to understand than describing word by word literally.

Notice that all those three register have such a “clocking rule”. It is said that a register will be clocked if its middle bit equal to majority bit of all middle bit from each registers. Majority bit will be “1” if and only if 2 or more middle bits are “1”, else will be zero. From the picture, you can see that middle bit is colored orange.

Middle bit of R1 = bit 8, lets define this bit as x_{1}

Middle bit of R2 = bit 10, let define this bit as x_{2}

Middle bit of R3 = bit 10, lets define this bit as x_{3}

Lets define y_{1} as clocking condition of R1

Lets define y_{2} as clocking condition of R2

Lets define y_{3} as clocking condition of R3

if y_{1} =”1″ then R1 is clocked, and so on for R2 and R3.

From truth table, we can derive karnaugh-map table then retrieve boolean equation as follows:

y_{1} = m_{0} + m_{1} + m_{2} + m_{5} + m_{6} + m_{7}

y_{2} = m_{0} + m_{1} + m_{3} + m_{4} + m_{6} + m_{7}

y_{3} = m_{0} + m_{2} + m_{3} + m_{4} + m_{5} + m_{7}

Finally, we get ourself to destinantion. Lets draw everything clearly .

Clocking Control (Just click it to see full-sized one)

The complete picture of A5/1 cipher is depicted below (click it to see the full-sized one).

Hot news! : A5/1 Implementation on PIC16F84 microcontroller

## RELATED STUFF

**References**

Pedagogical Implementation Of A5/1 Cipher

A5 Cipher

Hi , it was very helpful for me . Can you please tell me the importance of implementing a5/1 algorithm on hardware or VLSI ? . It would be of great help to me . Thanks

Comment by Ranjit — 13 September 2011 @ 8:39 am

well, i just did this for the sake of curiosity. if you need performance vlsi helps

Comment by edipermadi — 13 September 2011 @ 3:35 pm

sorry, it was not accessible to me

Comment by edipermadi — 22 March 2012 @ 5:25 am

this one is caesar cipher

Comment by edipermadi — 22 March 2012 @ 5:25 am

Hallo mas permadi, kira-kira butuh berapa lama untuk menghasilkan kunci bit jika algoritma a5-1 di implementasi ke microcontroller arm 7. thanks.

Comment by sutomo — 12 September 2012 @ 12:49 pm

Hehe. Maaf saya belum benchmark d arm7. Jadi ndak tahu

Comment by edipermadi — 13 September 2012 @ 9:24 am