Comp128 Out
Comp128 Out
* simoutput[0..11]: what you'd get back if you fed rand and key to a
real
* SIM.
//COMP128
//This is the Python wrapper over the COMP128 v1, v2 and v3
algorithms. The C code has been taken from the FreeRADIUS project.
from pycomp128 import *
key='AGILENT TECHNO\x00\x00'
key='\x41\x47\x49\x4c\x45\x4e\x54\x20\x54\x45\x43\x48\x4e\x4f\x
00\x00'
rand=16*'\x00'
comp128v1(key, rand)
comp128v2(key, rand)
comp128v3(key, rand)
Milenage.c1
Milenage
This is Python wrapper over the Milenage algorithm. The mode of
operation is written in Python, and makes use of the AES function
from the pycrypto package.
c1 to c5 and r1 to r5 constants are implemented as class attribute.
The class must be instantiated with the OP parameter.
Here is an example on how to use it:
for x in key:
... x.encode('hex')
...
'41'
'47'
'49'
'4c'
'45'
'4e'
'54'
'20'
'54'
'45'
'43'
'48'
'4e'
'4f'
'00'
'00'
key='4147494c454e5420544543484e4f0000'
rand=ʼ00000000000000000000000000000000ʼ
rand=16*'\x00'
def ascii2hex(input):
return hex(ord("c"))
codecs.encode(b"c", "hex")
format(ord("c"), "x")
"c".encode("hex")
import binascii
x = b'test'
x = binascii.hexlify(x)
y = str(x,'ascii')
x_ascii = str(x_unhexed,'ascii')
print(x_ascii) # Outputs test
with open('Hello.DAT','rb') as f:
data = f.read()
print(" ".join("{:02x}".format(c) for c in data))
def hex2intarr(input):
"""converts hex string to an array of integers
"""
return map(lambda a: int(a.encode('hex'),16), (a for a in
input.decode('hex')))
def intarr2hex(input):
"""converts array of integers to hex strings
"""
return ''.join('{:02x}'.format(x) for x in input).upper()
https://web.archive.org/web/20141210145440/http://
bb.osmocom.org/trac/wiki/SIMtrace#no1