You are on page 1of 7

DISCRETE MATHEMATICS AND ITS APPLICATIONS

Series Editor KENNETH H. ROSEN

INTRODUCTION TO
CRYPTOGRAPHY
WITH MATHEMATICAL FOUNDATIONS AND COMPUTER IMPLEMENTATIONS

Alexander

Stanoyevitch

California State University Carson, California, U.S.A.

CRC Press
Taylor & Francis Group
Boca Raton CRC Press is an London New York

Taylor

& Francis

imprint of the Croup, an informa business


& HALL BOOK

A CHAPMAN

Contents

Preface About the Author.

XIII XV XVII XIX

Dependency Acknowledgments
1

Chart

An Overview of the Subject


Basic

Concepts
4

Functions

One-to-One and Onto Inverse Functions Substitution


Attacks
on

Functions, Bijections

7 12

Ciphers 8 Cryptosystems The Vigenere Cipher 15 18 The Playfair Cipher

The One-Time Pad, Perfect Secrecy Chapter 1 Exercises 28

25

Chapter 1 Computer Implementations and Exercises 35 Vector/String Conversions 35 Integer/Text Conversions 36 Programming Basic Ciphers with Integer Arithmetic 38 Computer-Generated Random Numbers 39 2

Divisibility and Modular Arithmetic


Divisibility
Primes
44

43

43 46

Greatest Common Divisors and The Division

Relatively Prime Integers Algorithm 47 The Euclidean Algorithm 48 Modular Arithmetic and Congruences 52
Modular Integer Systems Modular Inverses 60 58

Extended Euclidean Algorithm 61 Solving Linear Congruences 64 Summary of Procedure for Solving the Single 66 Linear Congruence (Equation 2.2)
The Chinese Remainder Theorem

67
and Exercises

Chapter Chapter

2 Exercises 2

71 85

Computer Implementations

viii

Contents

The Evolution of
Ancient Codes Affine Nulls 91 Formal Definition of

Codemaking
a

until the
94

Computer Era

91

Cryptosystem

Ciphers Steganography
102

96 100

Homophones 105 Composition of Functions


The Machines 111

109 110

Tabular Form Notation for Permutations

Enigma Cycles (Cyclic Permutations) 114 Dissection of the Enigma Machine into Permutations Special Properties of All Enigma Machines 126 Chapter 3 Exercises 127 Chapter 3 Computer Implementations and Exercises Computer Representations of Permutations 140
Matrices and the Hill
The of Matrix Matrix

119

136

Cryptosystem
146 149

145

a 145 Anatomy Addition, Subtraction, and Scalar Multiplication Matrix Multiplication 147

Preview of the Fact That Matrix Matrix Arithmetic Definition of


an

Multiplication Is Associative
151

149

Invertible
a

(Square) Matrix
153 155

The Determinant of Inverses of 2 The


x

Square Matrix

2 Matrices

Transpose of a Matrix 156 Modular Integer Matrices 156 The Classical Adjoint (for Matrix Inversions)
The Hill

159

Cryptosystem

162 174

Chapter 4 Exercises 166 Chapter 4 Computer Implementations and Exercises 5 The Evolution of

Codebreaking until
181

the

Computer

Era

181

Frequency Analysis Attacks

The Demise of the Vigenere Cipher 187 The Babbage/Kasiski Attack 188 The Friedman Attack The Index of Coincidence 192 193 193

Expected Values of the Index of Coincidence How Enigmas Were Attacked 201
German Usage Protocols for Enigmas The Polish Codebreakers 203 205 202

Rejewski's Attack

203

Invariance of Cycle Decomposition Form Alan Turing and Bletchley Park 206

Chapter Chapter

5 5

Exercises

208
and Exercises 214

Computer Implementations

Contents

ix

Programs to Aid in Frequency Analysis 214 Programs to Aid in the Babbage/Kasiski Attack 215 Programs Related to the Friedman Attack 218 6

Representation and Arithmetic of Integers in Different Bases


Representation
Addition of

....

221

Integers

in Different Bases

221 229 231 234

Hex(adecimal) and Binary Expansions

224

Algorithm

with Base b

Expansions

Subtraction Algorithm with Base b

Multiplication

Algorithm in Base b
239

Expansions Expansions

Arithmetic with Large Integers Fast Modular Exponentiation

237

Chapter 6 Exercises 241 Chapter 6 Computer Implementations and Exercises


7 Block
DES Is

248

Cryptosystems and the Data Encryption Standard (DES)

251

The Evolution of

Computers into Cryptosystems 251 Adopted to Fulfill an Important Need 252 The XOR Operation 254 Feistel Cryptosystems 255
A Scaled-Down Version of DES DES 265
272

258

The Fall of DES

Triple DES 273 Modes of Operation for Block Cryptosystems


Electronic Codebook (ECB) Mode
274

274

Cipherblock Chaining (CBC) Mode 275 Cipher Feedback (CFB) Mode 276 Output Feedback (OFB) Mode 278 Chapter 7 Exercises 279 Chapter 7 Computer Implementations and Exercises
8

286

Some Number Theory and Algorithms


The Prime Number Theorem Fermat's Little Theorem The Euler Phi Function Euler's Theorem Primitive Roots 300 295 298 293

293

Modular Orders of Invertible Modular 302 304 Existence of Primitive Roots Order of Powers Formula Prime Number Generation Fermat's 305 308 309 311 312
a

Integers

301

Determination of Primitive Roots

304

Primality

Test

Carmichael Numbers The Miller-Rabin Test

The Miller-Rabin Test with

Factoring Enhancement

315

Contents

The Pollard p 1 Factoring Algorithm Chapter 8 Exercises 319


-

316 325

Chapter 8 Computer Implementations and Exercises


9 Public

Key Cryptography
Analogy
for
a

331 Key Cryptosystem Key Exchange 332


331

An Informal

Public

The Quest for Secure Electronic

One-Way Functions
The Diffie-Hellman

333

Logarithm Problem 334 Key Exchange 336 The Quest for a Complete Public Key Cryptosystem The RSA Cryptosystem 338 Digital Signatures and Authentication 343
The EIGamal Cryptosystem 345 Digital Signatures with EIGamal 347

Review of the Discrete

337

Knapsack Problems

349 352

The Merkle-Hellman Knapsack Cryptosystem Government Controls on Cryptography 356 A

Security Guarantee for RSA 357 Chapter 9 Exercises 360 Chapter 9 Computer Implementations and Exercises
10 Finite Fields in

369

General,
377

and GF(28) in Particular

377

Binary Operations Rings 378


Fields 381
=

ZplX]
Vector

Addition and Multiplication of

Polynomials with Coefficients in Zp 385 Polynomials in ZP[X] 386 Representation of Polynomials 387
a

the

ZP[X)

Is

Ring

388

Divisibility in 1P[X] 389 The Division Algorithm for ZP[X] 391 Congruences in ZP[X] Modulo a Fixed Polynomial Building Finite Fields from ZP[X] 396
The Fields GF(24) and GF(28)
10 Exercises

395

399

The Euclidean Algorithm for

Polynomials

404 411

Chapter

406
and Exercises

Chapter 10 Computer Implementations 11

The Advanced Encryption Standard (AES) Protocol


An

417

Open Call for


419

Replacement

to DES

417

Nibbles

A Scaled-Down Version of AES AES 432

421

Decryption in the Scaled-Down Version of AES Byte Representation and Arithmetic 432 Encryption Algorithm 435

429

The AES

Contents

xi

The AES

Decryption Algorithm
of the AES 11 440 441

439

Security Chapter 12

Chapter 11 Exercises

Computer Implementations

and Exercises

445

Elliptic
Elliptic

Curve

Cryptography
the Real Numbers 452 454

451

Curves 458

over

The Addition

Operation for Elliptic Curves

Groups Elliptic Curves over Zp 460 The Variety of Sizes of Modular Elliptic Curves 462 The Addition Operation for Elliptic Curves over %p 463 The Discrete Logarithm Problem on Modular Elliptic Curves 466 467 An Elliptic Curve Version of the Diffie-Hellman Key Exchange Fast Integer Multiplication of Points on Modular Elliptic Curves 470 Representing Plaintexts on Modular Elliptic Curves 471 473 An Elliptic Curve Version of the EIGamal Cryptosystem A Factoring Algorithm Based on Elliptic Curves 475 Chapter 12 Exercises 477 Chapter 12 Computer Implementations and Exercises 483

Appendices Appendix A:
Sets and Basic

489

Counting Principles

491

Concepts and Notations for Sets 491 Two Basic Counting Principles 495

Appendix

B:

Randomness and Probability


501

501

Probability Terminology and Axioms


Conditional Probability Random Variables 511 507

Conditioning and Bayes' Formula


*

509

Appendix C: Solutions
Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter
Chapter
2: 3:
4:

to All

Exercises for the Reader

515

1: An Overview of the

5: 6:
8: 9:

Chapter 7:

Subject 515 Divisibility and Modular Arithmetic 517 The Evolution of Codemaking until the Computer Era 522 Matrices and the Hill Cryptosystem 526 The Evolution of Codebreaking until the Computer Era 530 Representation and Arithmetic of Integers in Different Bases 536 Block Cryptosystems and the Data Encryption Standard (DES) 540 545 Some Number Theory and Algorithms Public Key Cryptography 550
General, and GF(28) in Particular
554 560

10: Finite Fields in 11: The Advanced 12:

Chapter Chapter

Encryption Standard (AES) Protocol Elliptic Curve Cryptography 563

xii

Contents

Appendix

D: Answers and Brief Solutions to Selected Odd-Numbered

Exercises.

Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter

1
2

569 572 581


587

3 4
5 6

592 595 599 601 604


608

7
8

9 10 11 12

609

611

Appendix E: Suggestions
Synopsis
615

for Further
615 615

Reading

615

History of Cryptography

Mathematical Foundations

Computer Implementations 616 Elliptic Curves 616 Additional Topics in Cryptography


References

616

619

Index of Corollaries, Lemmas, Propositions, and Theories


Index of

623

Algorithms

625

Subject Index

627

You might also like