# Path: sim_soft/sim_auth.py
# MASK_48_BIT = 0xFFFFFFFFFFFF
# MASK_64_BIT = 0xFFFFFFFFFFFFFFFF
# MASK_128_BIT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
# AUTH_RESULT_OK = 0xDB
# AUTH_RESULT_SYNCHORNISATION_FAILURE = 0xDC
# def rotateLeft128bit(i, n):
# def dummyXor(key, rand, sqn, amf, autn):
# def dummyXorHex(key, rand, sqn, amf, autn):
# def keyHex(key, length=16):
# def dummyXorData(rand, key, sqn, amf, autn=None):
# def authenticateDummyXor(rand, key, sqn, amf, autn=None):


import sys
import os.path
import logging
import unittest
from sim_soft import sim_auth
#!/usr/bin/python
# LICENSE: GPL2
# (c) 2015 Kamil Wartanowicz
# (c) 2015 Mikolaj Bartnicki

sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))

class TestAuthentication(unittest.TestCase):
    def test_1_dummy_xor(self):
        # input:
        key = "00112233445566778899AABBCCDDEEFF"
        rand = "31323131353836343132313135383634"
        sqn = "000000000000"
        amf = "0000"

        # expected output
        res = "31231302716D5043B9AB9B8AF9E5D8CB"
        ck = "231302716D5043B9AB9B8AF9E5D8CB31"
        ik = "1302716D5043B9AB9B8AF9E5D8CB3123"
        kc = "0000000000000000"
        autn = "02716D5043B9000031231302716D5043"

        logging.info("Codes to check:\n"
                     "key=%s\n"
                     "rand=%s\n"
                     "sqn=%s\n"
                     "amf=%s\n"
                        %(key, rand, sqn, amf))

# Path: sim_soft/sim_auth.py
# MASK_48_BIT = 0xFFFFFFFFFFFF
# MASK_64_BIT = 0xFFFFFFFFFFFFFFFF
# MASK_128_BIT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
# AUTH_RESULT_OK = 0xDB
# AUTH_RESULT_SYNCHORNISATION_FAILURE = 0xDC
# def rotateLeft128bit(i, n):
# def dummyXor(key, rand, sqn, amf, autn):
# def dummyXorHex(key, rand, sqn, amf, autn):
# def keyHex(key, length=16):
# def dummyXorData(rand, key, sqn, amf, autn=None):
# def authenticateDummyXor(rand, key, sqn, amf, autn=None):


# Path: tests/soft/test_authentication.py
import sys
import os.path
import logging
import unittest
from sim_soft import sim_auth

#!/usr/bin/python
# LICENSE: GPL2
# (c) 2015 Kamil Wartanowicz
# (c) 2015 Mikolaj Bartnicki

sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))

class TestAuthentication(unittest.TestCase):
    def test_1_dummy_xor(self):
        # input:
        key = "00112233445566778899AABBCCDDEEFF"
        rand = "31323131353836343132313135383634"
        sqn = "000000000000"
        amf = "0000"

        # expected output
        res = "31231302716D5043B9AB9B8AF9E5D8CB"
        ck = "231302716D5043B9AB9B8AF9E5D8CB31"
        ik = "1302716D5043B9AB9B8AF9E5D8CB3123"
        kc = "0000000000000000"
        autn = "02716D5043B9000031231302716D5043"

        logging.info("Codes to check:\n"
                     "key=%s\n"
                     "rand=%s\n"
                     "sqn=%s\n"
                     "amf=%s\n"
                        %(key, rand, sqn, amf))

        result = sim_auth.dummyXorHex(key, rand, sqn, amf, None)