A52HackTool 1.3.0
Turnkey & easy to use tool for cracking the GSM A5/2 cipher
Functions
code.h File Reference

Specification of full coding & decoding process. More...

#include "utils.h"
#include "firecode.h"
#include "const_code.h"
#include "convolution.h"
#include "interleaving.h"

Go to the source code of this file.

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.

Detailed Description

Specification of full coding & decoding process.

Author:
Nicolas Paglieri & Olivier Benjamin
Version:
File Revision #13
Date:
01/12/2011

Function Documentation

int code_test ( )

Autotests the encoding and decoding on a random set of problem/solution.

Returns:
0 if the test is successfull, non-zero otherwise

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)

Parameters:
[in,out]LInvertible matrix, modified by the function to become Identity Matrix
[out]L_Iinverse of the initial L matrix

References CHAR_IDENTITY, and FIRE_SOURCE_LENGTH.

void processFullDecoding ( byte  codeword[CODEWORD_LENGTH],
byte  sourceword[SOURCEWORD_LENGTH] 
)

Decodes a previously encoded message.

Parameters:
[in]codewordData to decode
[out]sourcewordDecoded 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)

Parameters:
[out]GFull 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.

Parameters:
[out]GFull encoding matrix in systematic form
[out]LInvertible matrix
[out]PPermutation 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.

Parameters:
[in]GFull encoding matrix
[out]HParity-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.

Parameters:
[in]GFull encoding matrix in systematic form
[out]HParity-check matrix in systematic form

References FIRE_SOURCE_LENGTH.

Referenced by processFullEncodingHMatrix().