MCC Expt 6 GSM A5 - A8
MCC Expt 6 GSM A5 - A8
MCC Expt 6 GSM A5 - A8
Student Name
Roll Number 17102A0057
Grade and Subject
Teacher’s Signature
Experiment Number 6
Encryption:
A8 - Key generation:
Department of Computer Engineering Exp. No.6
The key generation algorithm A8 is very similar to A3. In fact the same
COMP128 algorithm is used to create the 64-bit ciphering key (Kc)
which is subsequently used in A5. Taking the 128-bit RAND received
from the Mobile Services Switching Center (MSC) and the 128-bit Ki
stored in the SIM as input, A8 calculates 128 bits of output.
A5 – Encryption:
Program:
import random
lhs_xor = []
rhs_xor = []
for i in range(64):
lhs_xor.append(left_rand[i] ^ right_k[i])
rhs_xor.append(right_rand[i] ^ left_k[i])
result = []
for i in range(64):
result.append(lhs_xor[i] ^ rhs_xor[i])
return int("".join(result), 2)
def A5_test():
print("\nTesting A5 Algorithm")
global stored_Ki
global rand
Kc = A5(rand, stored_Ki)
encrypted_data = Kc ^ int_data
print("Encrypted Data:", encrypted_data)
decrypted_data = encrypted_data ^ Kc
print("Decrypted Data:", decrypted_data)
stored_Ki = 128
stored_Ki = [int(x) for x in list(bin(stored_Ki)[2:])]
stored_Ki = (128 - len(stored_Ki)) * [0] + stored_Ki
rand = []
for i in range(128):
rand.append(random.choice([0, 1]))
A5_test()
Department of Computer Engineering Exp. No.6
Output