Cryptography in C and C (Cryptography in C and C) Mikhail Velshenbah

Sold 0
Refunds 0
Good feedbacks 0
Bad feedbacks 0

The book contains the cryptographic algorithms realizovanna C

Contents


I Arithmetic and Number Theory in C 1

1 Introduction 3

2 Number Formats: The Representation of Large Numbers in C 13

3 Interface Semantics 19

4 The Fundamental Operations 23

4.1 Addition and Subtraction. . . . . . . . . . . . . . . . . . . . . . 24

4.2 Multiplication. . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

4.2.1 The Grade SchoolMethod. . . . . . . . . . . . . . . . . 34

4.2.2 Squaring Is Faster. . . . . . . . . . . . . . . . . . . . . . 40

4.2.3 Do Things Go Better with Karatsuba? . . . . . . . . . . . 45

4.3 Division with Remainder. . . . . . . . . . . . . . . . . . . . . . 50

5 Modular Arithmetic: Calculating with Residue Classes 67

6 Where All RoadsMeet: Modular Exponentiation 81

6.1 First Approaches. . . . . . . . . . . . . . . . . . . . . . . . . . 81

6.2 M-ary Exponentiation. . . . . . . . . . . . . . . . . . . . . . . 86

6.3 Addition Chains andWindows. . . . . . . . . . . . . . . . . . . 101

6.4 Montgomery Reduction and Exponentiation. . . . . . . . . . . 106

6.5 Cryptographic Application of Exponentiation. . . . . . . . . . . 118

v

Contents

7 Bitwise and Logical Functions 125

7.1 Shift Operations. . . . . . . . . . . . . . . . . . . . . . . . . . 125

7.2 All or Nothing: Bitwise Relations. . . . . . . . . . . . . . . . . . 131

7.3 Direct Access to Individual Binary Digits. . . . . . . . . . . . . . 137

7.4 Comparison Operators. . . . . . . . . . . . . . . . . . . . . . . 140

8 Input, Output, Assignment, Conversion 145

9 Dynamic Registers 157

10 Basic Number-Theoretic Functions 167

10.1 Greatest Common Divisor. . . . . . . . . . . . . . . . . . . . . 168

10.2 Multiplicative Inverse in Residue Class Rings. . . . . . . . . . . 175

10.3 Roots and Logarithms. . . . . . . . . . . . . . . . . . . . . . . 183

10.4 Square Roots in Residue Class Rings. . . . . . . . . . . . . . . . 191

10.4.1 The Jacobi Symbol. . . . . . . . . . . . . . . . . . . . . 192

10.4.2 Square RootsModulo pk. . . . . . . . . . . . . . . . . . 198

10.4.3 Square RootsModulo n. . . . . . . . . . . . . . . . . . . 203

10.4.4 Cryptography with Quadratic Residues. . . . . . . . . . 211

10.5 A Primality Test. . . . . . . . . . . . . . . . . . . . . . . . . . . 214

11 Rijndael: A Successor to the Data Encryption Standard 237

11.1 Arithmetic with Polynomials. . . . . . . . . . . . . . . . . . . . 239

11.2 The Rijndael Algorithm. . . . . . . . . . . . . . . . . . . . . . . 244

11.3 Calculating the Round Key. . . . . . . . . . . . . . . . . . . . . 247

11.4 The S-Box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

11.5 The ShiftRowsTransformation. . . . . . . . . . . . . . . . . . . 249

11.6 The MixColumnsTransformation. . . . . . . . . . . . . . . . . . 250

11.7 The AddRoundKeyStep. . . . . . . . . . . . . . . . . . . . . . . . 252

11.8 Encryption as a Complete Process. . . . . . . . . . . . . . . . . 253

11.9 Decryption. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256

11.10 Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

11.11 Modes of Operation. . . . . . . . . . . . . . . . . . . . . . . . 260

12 Large Random Numbers 261

12.1 A Simple Random Number Generator. . . . . . . . . . . . . . . 265

12.2 Cryptographic Random Number Generators. . . . . . . . . . . 268

12.2.1 The Generation of Start Values. . . . . . . . . . . . . . . 269

12.2.2 The BBS Random Number Generator. . . . . . . . . . . 273

12.2.3 The AES Generator. . . . . . . . . . . . . . . . . . . . . 279

12.2.4 The RMDSHA-1 Generator. . . . . . . . . . . . . . . . . 283


ETC

.......