You are previewing Practical Cryptography.
O'Reilly logo
Practical Cryptography

Book Description

Cryptography, the science of encoding and decoding information, allows people to do online banking, online trading, and make online purchases, without worrying that their personal information is being compromised. The dramatic increase of information transmitted electronically has led to an increased reliance on cryptography. This book discusses the theories and concepts behind modern cryptography and demonstrates how to develop and implement cryptographic algorithms using C++ programming language.

Written for programmers and engineers, Practical Cryptography explains how you can use cryptography to maintain the privacy of computer data. It describes dozens of cryptography algorithms, gives practical advice on how to implement them into cryptographic software, and shows how they can be used to solve security problems.

Covering the latest developments in practical cryptographic techniques, this book shows you how to build security into your computer applications, networks, and storage. Suitable for undergraduate and postgraduate students in cryptography, network security, and other security-related courses, this book will also help anyone involved in computer and network security who wants to learn the nuts and bolts of practical cryptography.

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Preface
  5. Acknowledgments
  6. About the Editors
  7. Contributors
  8. Chapter 1: Basics of Security and Cryptography
    1. 1.1 The Perimeter of Cryptography in Practice
    2. 1.2 Things That Cryptographic Technologies Cannot Do
  9. Chapter 2: Classical Cryptographic Algorithms
    1. 2.1 Caesar Cipher
      1. 2.1.1 Algorithm
      2. 2.1.2 Implementation
      3. 2.1.3 Limitations
    2. 2.2 Monoalphabetic Cipher
      1. 2.2.1 Algorithm
      2. 2.2.2 Implementation
      3. 2.2.3 Limitations
    3. 2.3 Playfair Cipher
      1. 2.3.1 Algorithm
      2. 2.3.2 Implementation
      3. 2.3.3 Limitations
    4. 2.4 Polyalphabetic Cipher
      1. 2.4.1 Algorithm
      2. 2.4.2 Implementation
      3. 2.4.3 Limitations
  10. Chapter 3: Rotor Machine
    1. 3.1 Background
    2. 3.2 Basic Concept
    3. 3.3 Systematization
    4. 3.4 Algorithm
    5. 3.5 Implementation
    6. 3.6 Limitations
    7. Reference
  11. Chapter 4: Block Cipher
    1. 4.1 Block Cipher Principles
    2. 4.2 The Feistel Block Structure
    3. 4.3 Block Cipher Modes
      1. 4.3.1 Electronic Codebook (ECB) Mode
      2. 4.3.2 Cipher Block Chaining (CBC)
      3. 4.3.3 Cipher Feedback (CFB) Mode
      4. 4.3.4 Output Feedback (OFB) Mode
      5. 4.3.5 Counter (CTR) Mode
    4. References
  12. Chapter 5: Data Encryption Standard
    1. 5.1 Primitive Operations
      1. 5.1.1 Operations for Encryption/Decryption
      2. 5.1.2 Operations for Subkey Generation
    2. 5.2 Basic Structure
    3. 5.3 DES Encryption Algorithm
    4. 5.4 DES Decryption Algorithm
    5. 5.5 Implementation
      1. 5.5.1 C++ Library Headers
      2. 5.5.2 The DES Class
      3. 5.5.3 Introducing the Member Variables of DES Class
      4. 5.5.4 Introducing the Member Functions of DES Class
      5. 5.5.5 The Keygen() Function
      6. 5.5.6 The PermChoice1() Function
      7. 5.5.7 The Split_Key() Function
      8. 5.5.8 The PermChoice2() Function
      9. 5.5.9 The Encrypt(char *) Function
      10. 5.5.10 The IP() Function
      11. 5.5.11 The Expansion() Function
      12. 5.5.12 The xor_oneE(int round) Function
      13. 5.5.13 The Substitution() Function
      14. 5.5.14 The Permutation() Function
      15. 5.5.15 The xor_two() Function
      16. 5.5.16 The Decrypt(char *) Function
      17. 5.5.17 The Main() Function
  13. Chapter 6: Advanced Encryption Standard
    1. 6.1 Overview
    2. 6.2 History
    3. 6.3 Design Consideration
    4. 6.4 Primitive Operations of AES
    5. 6.5 Structure of AES
    6. 6.6 Overview of Key Expansion
    7. 6.7 Key Expansion Example
    8. 6.8 Encryption
    9. 6.9 An Encryption Example
    10. 6.10 Decryption
    11. 6.11 Limitations
    12. 6.12 Pros and Cons of AES
    13. 6.13 Implementation
    14. 6.14 Conclusion
  14. Chapter 7: Asymmetric Key Algorithms
    1. 7.1 Basic Concept
    2. 7.2 Applications of Asymmetric Key Algorithms
      1. 7.2.1 Encryption/Decryption
      2. 7.2.2 Digital Signature
      3. 7.2.3 Encryption and Digital Signature
  15. Chapter 8: The RSA Algorithm
    1. 8.1 The Concept
    2. 8.2 Operations
      1. 8.2.1 Key Generation
      2. 8.2.2 Encryption
      3. 8.2.3 Decryption
    3. 8.3 Applications of the RSA Algorithm
    4. 8.4 Implementation Code
  16. Chapter 9: Elliptic Curve Cryptography
    1. 9.1 Introduction
    2. 9.2 Elliptic Curves over R
    3. 9.3 Elliptic Curves over ZP
      1. 9.3.1 Adding Points in Elliptic Curves over ZP
      2. 9.3.2 Scalar Multiplication
    4. 9.4 Discrete Logarithm Problem
    5. 9.5 Elliptic Curve Cryptography
      1. 9.5.1 Elliptic Curve Diffie–Hellman Key Exchange
      2. 9.5.2 Key Exchange Example
      3. 9.5.3 Elliptic Curve Encryption/Decryption
      4. 9.5.4 Encryption/Decryption Example
    6. 9.6 Implementation 1
    7. 9.7 Implementation 2
    8. References
  17. Chapter 10: Message Digest Algorithm 5
    1. 10.1 General Properties and Vulnerabilities
    2. 10.2 Design Principle
    3. 10.3 Algorithm Description
      1. 10.3.1 Add Padding Bits behind the Input Message
      2. 10.3.2 Add a 64-Bit Binary String That Is the Representation of the Message’s Length
      3. 10.3.3 Initialize Four 32-Bit Values
      4. 10.3.4 Compress Every 512-Bit Block
      5. 10.3.5 Generate the 128-Bit Output
    4. 10.4 An Example
    5. 10.5 Implementation 1
    6. 10.6 Implementation 2
    7. 10.7 Conclusion
    8. References
  18. Chapter 11: Secure Hash Algorithm
    1. 11.1 Basic Hash Function Concept
    2. 11.2 Applications
    3. 11.3 Steps of SHA-1
      1. 11.3.1 Appending Original Message Lengths and Padding
      2. 11.3.2 Initialization
      3. 11.3.3 Message Processing
      4. 11.3.4 Output
    4. 11.4 An Example
    5. 11.5 Implementation
    6. 11.6 Conclusion
  19. Chapter 12: Fundamentals of Identity Based Cryptography
    1. 12.1 Introduction to Cryptography
      1. 12.1.1 Symmetric Cryptography
      2. 12.1.2 Asymmetric Cryptography
      3. 12.1.3 Diffie–Hellman (DH) Algorithms
      4. 12.1.4 Rivest, Shamir, and Adleman (RSA) Algorithms
      5. 12.1.5 Elliptic Curve Cryptography (ECC)
        1. 12.1.5.1 ECC Key Generation
        2. 12.1.5.2 Elliptic Curve Digital Signature Algorithm
    2. 12.2 ID-Based Cryptography
      1. 12.2.1 ID-Based Key Construction
      2. 12.2.2 Pairing Functions
      3. 12.2.3 Examples of ID-Based Encryption Schemes
        1. 12.2.3.1 Boneh and Franklin Encryption Scheme
        2. 12.2.3.2 Boneh and Boyen Encryption Schemes
        3. 12.2.3.3 Chen et al. Encryption Scheme
      4. 12.2.4 Examples of ID-Based Signature Algorithms
        1. 12.2.4.1 Paterson Signature Scheme
        2. 12.2.4.2 Hess Signature Scheme
        3. 12.2.4.3 Barreto et al. Signature Scheme
      5. 12.2.5 Arguments in Favor of IBC
      6. 12.2.6 Use of IBC in Network Security
    3. 12.3 Conclusion
    4. References
  20. Chapter 13: Symmetric Key Encryption Acceleration on Heterogeneous Many Core Architectures
    1. 13.1 Introduction
    2. 13.2 Modern Heterogeneous Many-Core Architectures
    3. 13.3 The OpenCL Programming Model
      1. 13.3.1 OpenCL Parallel Execution Model
      2. 13.3.2 OpenCL Memory Model
      3. 13.3.3 First OpenCL Example
    4. 13.4 Implementing AES in OpenCL
      1. 13.4.1 The AES Block Cipher
      2. 13.4.2 Modes of Operation
      3. 13.4.3 AES Kernels
      4. 13.4.4 AES Host Library
      5. 13.4.5 Putting It All Together
    5. 13.5 Implementation
    6. 13.6 Concluding Remarks
    7. References
  21. Chapter 14: Methods and Algorithms for Fast Hashing in Data Streaming
    1. 14.1 Introduction and Practical Situations
    2. 14.2 Terminology
    3. 14.3 The Data Streaming Problem
      1. 14.3.1 Related Information Theory and Formulations
      2. 14.3.2 Practical Applications and Designs
      3. 14.3.3 Current Research Topics
    4. 14.4 Simple 32-Bit Fast Hashing
      1. 14.4.1 Hashing and Blooming Basics
      2. 14.4.2 Traditional Hashing Methods
      3. 14.4.3 Hashing by Bit Manipulation
      4. 14.4.4 Quality Evaluation of Hash Functions
      5. 14.4.5 Example Designs for Fast Hashing
    5. 14.5 Practical Data Streaming
      1. 14.5.1 Distributions in Practice
      2. 14.5.2 Bloom Filters: Store, Lookup, and Efficiency
      3. 14.5.3 Unconventional Bloom Filter Designs for Data Streams
      4. 14.5.4 Practical Data Streaming Targets
      5. 14.5.5 Higher-Complexity Data Streaming Targets
    6. 14.6 Practical Fast Hashing and Blooming
      1. 14.6.1 Arbitrary Bit Length Hashing
      2. 14.6.2 Arbitrary Length Bloom Filters
      3. 14.6.3 Hardware Implementation
    7. 14.7 Practical Example: High-Speed Packet Traffic Processor
      1. 14.7.1 Example Data Streaming Target
      2. 14.7.2 Design for Hashing and Data Structures
    8. 14.8 Summary
    9. References
  22. Footnotes
    1. Chapter 8: The RSA Algorithm
    2. Chapter 13: Symmetric Key Encryption Acceleration on Heterogeneous Many-Core Architectures
    3. Cryptography / Information Security