A Python implementation of the COMP128 GSM authentication algorithms.
Project description
COMP128 algorithms for Python
This is a Python implementation of the COMP128 algorithms used in the GSM A3/A8 authentication process.
Usage example
from comp128.comp128v23 import Comp128v23
from comp128.comp128v1 import Comp128v1
ki = bytearray(bytes.fromhex("00112233445566778899AABBCCDDEEFF"))
rand = bytearray(bytes.fromhex("00112233445566778899AABBCCDDEEFF"))
v1_sres, v1_kc = Comp128v1().comp128v1(ki, rand)
v2_sres, v2_kc = Comp128v23().comp128v2(ki, rand)
v3_sres, v3_kc = Comp128v23().comp128v3(ki, rand)
print(f"v1 SRES: {v1_sres.hex()}, KC: {v1_kc.hex()}")
print(f"v2 SRES: {v2_sres.hex()}, KC: {v2_kc.hex()}")
print(f"v3 SRES: {v3_sres.hex()}, KC: {v3_kc.hex()}")
This should output:
v1 SRES: 04a66ba8, KC: f87eb8222cea3400
v2 SRES: 6fb9eb06, KC: 605d954ffdefe800
v3 SRES: 6fb9eb06, KC: 605d954ffdefea7f
Acknowledgements
This code is a Python conversion of the C source code of libosmocore. Full credit goes to the original authors:
- Harald Welte
- Kévin Redon
- Sylvain Munaut
and also to Alexander Couzens for invaluable help and feedback during this conversion.
State of this project
This code is ready for use and has been tested to calculate correct authentication vectors both in unit-tests and in a real-world scenario when calculating 2G authentication vectors on the 38C3 GSM network.
As such, this project is considered "done" and will not receive any further updates unless a bug is found, or a future Python version breaks the code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file comp128-1.0.0.tar.gz.
File metadata
- Download URL: comp128-1.0.0.tar.gz
- Upload date:
- Size: 88.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44baec3364fce8c0f690fea7957c9a0046382731ff5a9ffa1a076f84ae5c9013
|
|
| MD5 |
2b14d244acfacd35aff5d71fb31f50e8
|
|
| BLAKE2b-256 |
31fb662a2b7ae497ad5c3de122937b79bf419f88b0352aa57192dcc362c2e831
|
Provenance
The following attestation bundles were made for comp128-1.0.0.tar.gz:
Publisher:
python-publish.yml on Takuto88/comp128-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
comp128-1.0.0.tar.gz -
Subject digest:
44baec3364fce8c0f690fea7957c9a0046382731ff5a9ffa1a076f84ae5c9013 - Sigstore transparency entry: 164480158
- Sigstore integration time:
-
Permalink:
Takuto88/comp128-python@05e97801a959130d26b3235e89d9a2bf9ec54ac1 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/Takuto88
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@05e97801a959130d26b3235e89d9a2bf9ec54ac1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file comp128-1.0.0-py3-none-any.whl.
File metadata
- Download URL: comp128-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebf2637a6bfca3ecef40ef824d59676b61a7ee5e8c97c6ccdc2c240e9491f60b
|
|
| MD5 |
3fc2b8593cf7a4d5db22e854da51fdd5
|
|
| BLAKE2b-256 |
b1a0e73e9b0683ae8e63addb21dafed713e6cf18667e411647317d9302b3302e
|
Provenance
The following attestation bundles were made for comp128-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on Takuto88/comp128-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
comp128-1.0.0-py3-none-any.whl -
Subject digest:
ebf2637a6bfca3ecef40ef824d59676b61a7ee5e8c97c6ccdc2c240e9491f60b - Sigstore transparency entry: 164480160
- Sigstore integration time:
-
Permalink:
Takuto88/comp128-python@05e97801a959130d26b3235e89d9a2bf9ec54ac1 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/Takuto88
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@05e97801a959130d26b3235e89d9a2bf9ec54ac1 -
Trigger Event:
push
-
Statement type: