![]() |
A52HackTool 1.3.0
Turnkey & easy to use tool for cracking the GSM A5/2 cipher
|
Implementation of full coding & decoding process. More...
#include <stdlib.h>#include <stdio.h>#include <string.h>#include "utils.h"#include "code.h"#include "firecode.h"#include "const_code.h"#include "convolution.h"#include "interleaving.h"Functions | |
| void | processFullEncodingGMatrix (byte G[FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH]) |
| Calculates the encoding matrix corresponding to all encoding steps (Fire code, Convolution and Interleaving) | |
| void | processFullEncodingGSystematicMatrix (byte G[FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH], byte L[FIRE_SOURCE_LENGTH][FIRE_SOURCE_LENGTH], byte P[INTERLEAVING_LENGTH][INTERLEAVING_LENGTH]) |
| Calculates the encoding matrix corresponding to all encoding steps (Fire code, Convolution and Interleaving) in systematic form. | |
| void | processFullEncodingHSystematicMatrix (byte G[FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH], byte H[INTERLEAVING_LENGTH-FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH]) |
| Calculates the systematic parity-check matrix H associated to the code matrix G in systematic form. | |
| void | processFullEncodingHMatrix (byte G[FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH], byte H[INTERLEAVING_LENGTH-FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH]) |
| Calculates the real parity-check matrix H associated to the code matrix G. Thus, H×g=0 iff g is a codeword. | |
| void | InvertMatrixL (byte L[FIRE_SOURCE_LENGTH][FIRE_SOURCE_LENGTH], byte L_I[FIRE_SOURCE_LENGTH][FIRE_SOURCE_LENGTH]) |
| Inverts the provided L matrix (peculiar case of Gauss elimination when L is a square matrix of size FIRE_SOURCE_LENGTH) | |
| void | processFullDecoding (byte codeword[CODEWORD_LENGTH], byte sourceword[SOURCEWORD_LENGTH]) |
| Decodes a previously encoded message. | |
| int | code_test () |
| Autotests the encoding and decoding on a random set of problem/solution. | |
Implementation of full coding & decoding process.
| int code_test | ( | ) |
Autotests the encoding and decoding on a random set of problem/solution.
References BINPRODUCT_VECTOR_MATRIX, CODEWORD_LENGTH, DEBUG, DUMP_CHAR_VECTOR, processFullDecoding(), processFullEncodingGMatrix(), and SOURCEWORD_LENGTH.
Referenced by main().
| void InvertMatrixL | ( | byte | L[FIRE_SOURCE_LENGTH][FIRE_SOURCE_LENGTH], |
| byte | L_I[FIRE_SOURCE_LENGTH][FIRE_SOURCE_LENGTH] | ||
| ) |
Inverts the provided L matrix (peculiar case of Gauss elimination when L is a square matrix of size FIRE_SOURCE_LENGTH)
| [in,out] | L | Invertible matrix, modified by the function to become Identity Matrix |
| [out] | L_I | inverse of the initial L matrix |
References CHAR_IDENTITY, and FIRE_SOURCE_LENGTH.
Decodes a previously encoded message.
| [in] | codeword | Data to decode |
| [out] | sourceword | Decoded data |
References CONVOLUTION_SOURCE_LENGTH, FIRE_CODE_LENGTH, INTERLEAVING_LENGTH, reverseConvolution(), reverseFire(), and reverseInterleaving().
Referenced by code_test(), and main().
| void processFullEncodingGMatrix | ( | byte | G[FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH] | ) |
Calculates the encoding matrix corresponding to all encoding steps (Fire code, Convolution and Interleaving)
| [out] | G | Full encoding matrix |
References CONVOLUTION_CODE_LENGTH, CONVOLUTION_SOURCE_LENGTH, FIRE_CODE_LENGTH, FIRE_SOURCE_LENGTH, INTERLEAVING_LENGTH, processConvolutionGMatrix(), processFireGMatrix(), and processInterleavingGMatrix().
Referenced by attack_decipherSecretKey(), attack_test(), code_test(), main(), and matrices_generation_exportMatrices().
| void processFullEncodingGSystematicMatrix | ( | byte | G[FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH], |
| byte | L[FIRE_SOURCE_LENGTH][FIRE_SOURCE_LENGTH], | ||
| byte | P[INTERLEAVING_LENGTH][INTERLEAVING_LENGTH] | ||
| ) |
Calculates the encoding matrix corresponding to all encoding steps (Fire code, Convolution and Interleaving) in systematic form.
| [out] | G | Full encoding matrix in systematic form |
| [out] | L | Invertible matrix |
| [out] | P | Permutation matrix |
References CHAR_IDENTITY, FIRE_SOURCE_LENGTH, and INTERLEAVING_LENGTH.
Referenced by processFullEncodingHMatrix().
| void processFullEncodingHMatrix | ( | byte | G[FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH], |
| byte | H[INTERLEAVING_LENGTH-FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH] | ||
| ) |
Calculates the real parity-check matrix H associated to the code matrix G. Thus, H×g=0 iff g is a codeword.
| [in] | G | Full encoding matrix |
| [out] | H | Parity-check matrix |
References BINPRODUCT_MATRIX_MATRIX, FIRE_SOURCE_LENGTH, INTERLEAVING_LENGTH, processFullEncodingGSystematicMatrix(), and processFullEncodingHSystematicMatrix().
Referenced by attack_decipherSecretKey(), and matrices_generation_exportMatrices().
| void processFullEncodingHSystematicMatrix | ( | byte | G[FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH], |
| byte | H[INTERLEAVING_LENGTH-FIRE_SOURCE_LENGTH][INTERLEAVING_LENGTH] | ||
| ) |
Calculates the systematic parity-check matrix H associated to the code matrix G in systematic form.
| [in] | G | Full encoding matrix in systematic form |
| [out] | H | Parity-check matrix in systematic form |
References FIRE_SOURCE_LENGTH.
Referenced by processFullEncodingHMatrix().
1.7.4