A52HackTool 1.3.0
Turnkey & easy to use tool for cracking the GSM A5/2 cipher
const_code.h
Go to the documentation of this file.
00001 /*============================================================================*
00002  *                                                                            *
00003  *                                const_code.h                                *
00004  *                                                                            *
00005  *============================================================================*
00006  *                                                                            *
00007  * Part of A52HackTool                                                        *
00008  *                                                                            *
00009  * Copyright © 2011   -   Nicolas Paglieri   &   Olivier Benjamin             *
00010  * All rights reserved.                                                       *
00011  *                                                                            *
00012  * Contact Information:  nicolas.paglieri [at] ensimag.fr                     *
00013  *                       olivier.benjamin [at] ensimag.fr                     *
00014  *                                                                            *
00015  *============================================================================*
00016  *                                                                            *
00017  * This file may be used under the terms of the GNU General Public License    *
00018  * version 3 as published by the Free Software Foundation.                    *
00019  * See <http://www.gnu.org/licenses/> or GPL.txt included in the packaging of *
00020  * this file.                                                                 *
00021  *                                                                            *
00022  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE    *
00023  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  *
00024  *                                                                            *
00025  *============================================================================*/
00026 
00037 #ifndef _CONST_CODE_H_
00038 #define _CONST_CODE_H_
00039 
00040 
00041 
00042 
00043 // ========================= Data length relative to full code, input size =========================
00044 
00046 #define SOURCEWORD_LENGTH 184
00047 
00048 
00049 
00050 
00051 // ======================= Constants relative to specific encoders/decoders ========================
00052 
00053 // Fire Encoding - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00054 // We consider here the following polynomial for GSM Fire code (SACCH):
00055 //                (D^23 + 1)*(D^17 + D^3 + 1)
00056 // which can be developped into:
00057 //             D^40 + D^26 + D^23 + D^17 + D^3 + D^0
00058 // The polynomial is divided into two parts which can be recombined using the following formula:
00059 // (UPPER_POLYNOMIAL << 9) | (LOWER_POLYNOMIAL >> 23)
00060 // Note that the polynomial representation is mirrored compared to 0x80024100 || 0x04800000 !
00061 #define UPPER_POLYNOMIAL  ((unsigned int)0x90004120);        //!< Upper polynomial representation
00062 #define LOWER_POLYNOMIAL  ((unsigned int)0x800000);          //!< Lower polynomial representation
00063 
00064 #define FIRE_POLYNOMIAL_LENGTH 41                            //!< Meaningful length (in bits)
00065 #define LOWER_PADDINGBITS   (32*2 - FIRE_POLYNOMIAL_LENGTH)  //!< Number of padding bits
00066 
00068 #define FIRE_SOURCE_LENGTH  SOURCEWORD_LENGTH                                 // 184
00069 
00070 #define FIRE_CODE_LENGTH    (FIRE_SOURCE_LENGTH + FIRE_POLYNOMIAL_LENGTH - 1) // 224
00071 
00072 #define FIRE_CRC_LENGTH     (FIRE_CODE_LENGTH - FIRE_SOURCE_LENGTH)           // 40
00073 
00074 
00075 // Convolution - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00076 // Before convolution is applied to a fired message, 4bits are appended to the input (all 0s)
00077 
00079 #define CONVOLUTION_SOURCE_LENGTH (FIRE_CODE_LENGTH + 4)                      // 228
00080 
00081 #define CONVOLUTION_CODE_LENGTH   (CONVOLUTION_SOURCE_LENGTH * 2)             // 456
00082 
00083 
00084 // Interleaving  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00085 
00087 #define INTERLEAVING_LENGTH CONVOLUTION_CODE_LENGTH                           // 456
00088 
00089 
00090 
00091 
00092 // ========================= Data length relative to full code, output size ========================
00093 
00095 #define CODEWORD_LENGTH INTERLEAVING_LENGTH                                   // 456
00096 
00098 #define SYNDROME_LENGTH (CODEWORD_LENGTH - SOURCEWORD_LENGTH)                 // 272
00099 
00100 
00101 
00102 
00103 #endif