Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

decode 7-bit GSM

I found this post on how to encode ascii data to 7-bit GSM character set, how would I decode 7-bit GSM character again (reverse it back to ascii)?

like image 497
johannes Avatar asked Oct 29 '12 23:10

johannes


1 Answers

For example:

C7F7FBCC2E03 stands for 'Google'
Python 3.4

def gsm7bitdecode(f):
   f = ''.join(["{0:08b}".format(int(f[i:i+2], 16)) for i in range(0, len(f), 2)][::-1])
   return ''.join([chr(int(f[::-1][i:i+7][::-1], 2)) for i in range(0, len(f), 7)])

print(gsm7bitdecode('C7F7FBCC2E03'))

Google

like image 108
noiam Avatar answered Nov 07 '22 03:11

noiam