You are previewing Cryptography in C and C++.
O'Reilly logo
Cryptography in C and C++

Book Description

This book covers everything you need to know to write professional-level cryptographic code. This expanded, improved second edition includes about 100 pages of new material as well as numerous improvements to the original text.

The chapter about random number generation has been completely rewritten, and the latest cryptographic techniques are covered in detail. Furthermore, this book covers the recent improvements in primality testing.

Table of Contents

  1. Copyright
  2. Foreword
  3. About the Author
  4. About the Translator
  5. Preface to the Second American Edition
  6. Preface to the First American Edition
    1. Warning
    2. Disclaimer
  7. Preface to the First German Edition
  8. 1. Arithmetic and Number Theory in C
    1. 1. Introduction
      1. 1.1. About the Software
      2. 1.2. Legal Conditions for Using the Software
      3. 1.3. Contacting the Author
    2. 2. Number Formats: The Representation of Large Numbers in C
    3. 3. Interface Semantics
    4. 4. The Fundamental Operations
      1. 4.1. Addition and Subtraction
      2. 4.2. Multiplication
        1. 4.2.1. The Grade School Method
        2. 4.2.2. Squaring Is Faster
        3. 4.2.3. Do Things Go Better with Karatsuba?
      3. 4.3. Division with Remainder
    5. 5. Modular Arithmetic: Calculating with Residue Classes
    6. 6. Where All Roads Meet: Modular Exponentiation
      1. 6.1. First Approaches
      2. 6.2. M-ary Exponentiation
      3. 6.3. Addition Chains and Windows
      4. 6.4. Montgomery Reduction and Exponentiation
      5. 6.5. Cryptographic Application of Exponentiation
    7. 7. Bitwise and Logical Function
      1. 7.1. Shift Operations
      2. 7.2. All or Nothing: Bitwise Relations
      3. 7.3. Direct Access to Individual Binary Digits
      4. 7.4. Comparison Operators
    8. 8. Input, Output, Assignment, Conversion
    9. 9. Dynamic Registers
    10. 10. Basic Number-Theoretic Functions
      1. 10.1. Greatest Common Divisor
      2. 10.2. Multiplicative Inverse in Residue Class Rings
      3. 10.3. Roots and Logarithms
      4. 10.4. Square Roots in Residue Class Rings
        1. 10.4.1. The Jacobi Symbol
        2. 10.4.2. Square Roots Modulo pk
        3. 10.4.3. Square Roots Modulo n
        4. 10.4.4. Cryptography with Quadratic Residues
          1. 10.4.4.1. Rabin key generation
          2. 10.4.4.2. Rabin encryption
          3. 10.4.4.3. Algorithm for key generation in the Fiat-Shamir procedure
          4. 10.4.4.4. Protocol for authentication à la Fiat-Shamir
      5. 10.5. A Primality Test
    11. 11. Rijndael: A Successor to the Data Encryption Standard
      1. 11.1. Arithmetic with Polynomials
      2. 11.2. The Rijndael Algorithm
      3. 11.3. Calculating the Round Key
      4. 11.4. The S-Box
      5. 11.5. The ShiftRows Transformation
      6. 11.6. The MixColumns Transformation
      7. 11.7. The AddRoundKey Step
      8. 11.8. Encryption as a Complete Process
      9. 11.9. Decryption
      10. 11.10. Performance
      11. 11.11. Modes of Operation
    12. 12. Large Random Numbers
      1. 12.1. A Simple Random Number Generator
      2. 12.2. Cryptographic Random Number Generators
        1. 12.2.1. The Generation of Start Values
        2. 12.2.2. The BBS Random Number Generator
        3. 12.2.3. The AES Generator
        4. 12.2.4. The RMDSHA-1 Generator
      3. 12.3. Quality Testing
        1. 12.3.1. Chi-Squared Test
        2. 12.3.2. Monobit Test
        3. 12.3.3. Poker Test
        4. 12.3.4. Runs Test
        5. 12.3.5. Longruns Test
        6. 12.3.6. Autocorrelation Test
        7. 12.3.7. Quality of the FLINT/C Random Number Generators
      4. 12.4. More Complex Functions
    13. 13. Strategies for Testing LINT
      1. 13.1. Static Analysis
      2. 13.2. Run-Time Tests
  9. 2. Arithmetic in C++ with the Class LINT
    1. 14. Let C++ Simplify Your Life
      1. 14.1. Not a Public Affair: The Representation of Numbers in LINT
      2. 14.2. Constructors
      3. 14.3. Overloaded Operators
    2. 15. The LINT Public Interface: Members and Friends
      1. 15.1. Arithmetic
      2. 15.2. Number Theory
      3. 15.3. Stream I/O of LINT Objects
        1. 15.3.1. Formatted Output of LINT Objects
        2. 15.3.2. Manipulators
        3. 15.3.3. File I/O for LINT Objects
    3. 16. Error Handling
      1. 16.1. (Don't) Panic ...
      2. 16.2. User-Defined Error Handling
      3. 16.3. LINT Exceptions
    4. 17. An Application Example: The RSA Cryptosystem
      1. 17.1. Asymmetric Cryptosystems
      2. 17.2. The RSA Algorithm
      3. 17.3. Digital RSA Signatures
      4. 17.4. RSA Classes in C++
    5. 18. Do It Yourself: Test LINT
    6. 19. Approaches for Further Extensions
  10. 3. Appendices
    1. A. Directory of C Functions
      1. A.1. Input/Output, Assignment, Conversions, Comparisons
      2. A.2. Basic Calculations
      3. A.3. Modular Arithmetic
      4. A.4. Bitwise Operations
      5. A.5. Number-Theoretic Functions
      6. A.6. Generation of Pseudorandom Numbers
      7. A.7. Register Management
    2. B. Directory of C++ Functions
      1. B.1. Input/Output, Conversion, Comparison: Member Functions
      2. B.2. Input/Output, Conversion, Comparison: Friend Functions
      3. B.3. Basic Operations: Member Functions
      4. B.4. Basic Operations: Friend Functions
      5. B.5. Modular Arithmetic: Member Functions
      6. B.6. Modular Arithmetic: Friend Functions
      7. B.7. Bitwise Operations: Member Functions
      8. B.8. Bitwise Operations: Friend Functions
      9. B.9. Number-Theoretic Member Functions
      10. B.10. Number-Theoretic Friend Functions
      11. B.11. Generation of Pseudorandom Numbers
      12. B.12. Miscellaneous Functions
    3. C. Macros
      1. C.1. Error Codes and Status Values
      2. C.2. Additional Constants
      3. C.3. Macros with Parameters
    4. D. Calculation Times
    5. E. Notation
    6. F. Arithmetic and Number-Theoretic Packages
  11. References