java language and programming, Exercises of Computer Science

notes about java, syntaxes, comments, other details

Typology: Exercises

2016/2017

Uploaded on 08/31/2017

abapna
abapna 🇺🇸

1 document

1 / 758

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download java language and programming and more Exercises Computer Science in PDF only on Docsity!

ONLINE ACCESS for Cryptography and Network Security: Principles

and Practice, Sixth Edition

Thank you for purchasing a new copy of Cryptography and Network Security: Principles and Practice, Sixth Edition. Your textbook includes six months of prepaid access to the book’s Premium Web site. This prepaid subscription provides you with full access to the following student support areas:

  • VideoNotes are step-by-step video tutorials specifically designed to enhance the programming concepts presented in this textbook
  • Online Chapters
  • Online Appendices
  • Supplemental homework problems with solutions
  • Supplemental papers for reading

Note that this prepaid subscription does not include access to MyProgrammingLab, which is available at http://www.myprogramminglab.com for purchase.

Use a coin to scratch off the coating and reveal your student access code. Do not use a knife or other sharp object as it may damage the code.

To access the Cryptography and Network Security: Principles and Practice, Sixth Edition, Premium Web site for the first time, you will need to register online using a computer with an Internet connection and a web browser. The process takes just a couple of minutes and only needs to be completed once.

1. Go to http://www.pearsonhighered.com/stallings/ 2. Click on Premium Web site. 3. Click on the Register button. 4. On the registration page, enter your student access code* found beneath the scratch-off panel. Do not type the dashes. You can use lower- or uppercase. 5. Follow the on-screen instructions. If you need help at any time during the online registration process, simply click the Need Help? icon. 6. Once your personal Login Name and Password are confirmed, you can begin using the Cryptography and Network Security: Principles and Practice, Sixth Edition Premium Web site!

To log in after you have registered:

You only need to register for this Premium Web site once. After that, you can log in any time at http://www.pearsonhighered.com/stallings/ by providing your Login Name and Password when prompted.

*Important: The access code can only be used once. This subscription is valid for six months upon activation and is not transferable. If this access code has already been revealed, it may�no longer be valid. If this is the case, you can purchase a subscription by going to http://www.pearsonhighered.com/stallings/ and following the on-screen instructions.

Cryptography and

network S eCurity

PrinciPles and Practice

Sixth edition

William Stallings

Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montréal Toronto Delhi Mexico City São Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo

ISBN 10: 0-13-335469- ISBN 13: 978-0-13-335469-

10 9 8 7 6 5 4 3 2 1

Editorial Director, ECS: Marcia Horton Executive Editor: Tracy Johnson Associate Editor: Carole Snyder Director of Marketing: Christy Lesko Marketing Manager: Yez Alayan Director of Production: Erin Gregg Managing Editor: Scott Disanno Associate Managing Editor: Robert Engelhardt Production Manager: Pat Brown Art Director: Jayne Conte Cover Designer: Bruce Kenselaar

Permissions Supervisor: Michael Joyce Permissions Administrator: Jenell Forschler Director, Image Asset Services: Annie Atherton Manager, Visual Research: Karen Sanatar Cover Photo: © Valery Sibrikov/Fotolia Media Project Manager: Renata Butera Full-Service Project Management: Shiny Rajesh/ Integra Software Services Pvt. Ltd. Composition: Integra Software Services Pvt. Ltd. Printer/Binder: Courier Westford Cover Printer: Lehigh-Phoenix

Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear in the Credits section in the end matter of this text.

Copyright © 2014, 2011, 2006 Pearson Education, Inc., All rights reserved. Printed in the United States of America. This publication is protected by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to 201-236-3290.

Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed in initial caps or all caps.

Library of Congress Cataloging-in-Publication Data on file.

For Tricia never dull never boring

the smartest and bravest

person I know

  • Chapter 0 Guide for Readers and Instructors Preface xiii
    • 0.1 Outline of This Book
    • 0.2 A Roadmap for Readers and Instructors
    • 0.3 Internet and Web Resources
    • 0.4 Standards
  • Chapter 1 Overview
    • 1.1 Computer Security Concepts
    • 1.2 The OSI Security Architecture
    • 1.3 Security Attacks
    • 1.4 Security Services
    • 1.5 Security Mechanisms
    • 1.6 A Model for Network Security
    • 1.7 Recommended Reading
    • 1.8 Key Terms, Review Questions, and Problems
  • Part One Symmetric ciPherS
  • Chapter 2 Classical Encryption Techniques
    • 2.1 Symmetric Cipher Model
    • 2.2 Substitution Techniques
    • 2.3 Transposition Techniques
    • 2.4 Rotor Machines
    • 2.5 Steganography
    • 2.6 Recommended Reading
    • 2.7 Key Terms, Review Questions, and Problems
  • Chapter 3 Block Ciphers and the Data Encryption Standard
    • 3.1 Traditional Block Cipher Structure
    • 3.2 The Data Encryption Standard
    • 3.3 A DES Example
    • 3.4 The Strength of DES
    • 3.5 Block Cipher Design Principles
    • 3.6 Recommended Reading
    • 3.7 Key Terms, Review Questions, and Problems
  • Chapter 4 Basic Concepts in Number Theory and Finite Fields
    • 4.1 Divisibility and the Division Algorithm
    • 4.2 The Euclidean Algorithm
    • 4.3 Modular Arithmetic iv Contents
    • 4.4 Groups, Rings, and Fields
    • 4.5 Finite Fields of the Form GF( p )
    • 4.6 Polynomial Arithmetic
    • 4.7 Finite Fields of the Form GF(2 n )
    • 4.8 Recommended Reading
    • 4.9 Key Terms, Review Questions, and Problems
      • Appendix 4A The Meaning of mod
  • Chapter 5 Advanced Encryption Standard
    • 5.1 Finite Field Arithmetic
    • 5.2 AES Structure
    • 5.3 AES Transformation Functions
    • 5.4 AES Key Expansion
    • 5.5 An AES Example
    • 5.6 AES Implementation
    • 5.7 Recommended Reading
    • 5.8 Key Terms, Review Questions, and Problems
      • Appendix 5A Polynomials with Coefficients in GF(2 8 )
      • Appendix 5B Simplified AES
  • Chapter 6 Block Cipher Operation
    • 6.1 Multiple Encryption and Triple DES
    • 6.2 Electronic Code book
    • 6.3 Cipher Block Chaining Mode
    • 6.4 Cipher Feedback Mode
    • 6.5 Output Feedback Mode
    • 6.6 Counter Mode
    • 6.7 XTS-AES Mode for Block-Oriented Storage Devices
    • 6.8 Recommended Reading
    • 6.9 Key Terms, Review Questions, and Problems
  • Chapter 7 Pseudorandom Number Generation and Stream Ciphers
    • 7.1 Principles of Pseudorandom Number Generation
    • 7.2 Pseudorandom Number Generators
    • 7.3 Pseudorandom Number Generation Using a Block Cipher
    • 7.4 Stream Ciphers
    • 7.5 RC4
    • 7.6 True Random Number Generators
    • 7.7 Recommended Reading
    • 7.8 Key Terms, Review Questions, and Problems
  • Part twO aSymmetric ciPherS
  • Chapter 8 More Number Theory
    • 8.1 Prime Numbers
    • 8.2 Fermat’s and Euler’s Theorems
    • 8.3 Testing for Primality
    • 8.4 The Chinese Remainder Theorem
      • 8.5 Discrete Logarithms Contents v
      • 8.6 Recommended Reading
      • 8.7 Key Terms, Review Questions, and Problems
  • Chapter 9 Public-Key Cryptography and RSA - 9.1 Principles of Public-Key Cryptosystems - 9.2 The RSA Algorithm - 9.3 Recommended Reading - 9.4 Key Terms, Review Questions, and Problems - Appendix 9A The Complexity of Algorithms
  • Chapter 10 Other Public-Key Cryptosystems
    • 10.1 Diffie-Hellman Key Exchange
    • 10.2 Elgamal Cryptographic System
    • 10.3 Elliptic Curve Arithmetic
    • 10.4 Elliptic Curve Cryptography
    • 10.5 Pseudorandom Number Generation Based on an Asymmetric Cipher
    • 10.6 Recommended Reading
    • 10.7 Key Terms, Review Questions, and Problems
  • Part three cryPtOgraPhic Data integrity algOrithmS
  • Chapter 11 Cryptographic Hash Functions
    • 11.1 Applications of Cryptographic Hash Functions
    • 11.2 Two Simple Hash Functions
    • 11.3 Requirements and Security
    • 11.4 Hash Functions Based on Cipher Block Chaining
    • 11.5 Secure Hash Algorithm (SHA)
    • 11.6 SHA-3
    • 11.7 Recommended Reading
    • 11.8 Key Terms, Review Questions, and Problems
  • Chapter 12 Message Authentication Codes
    • 12.1 Message Authentication Requirements
    • 12.2 Message Authentication Functions
    • 12.3 Requirements for Message Authentication Codes
    • 12.4 Security of MACs
    • 12.5 MACs Based on Hash Functions: HMAC
    • 12.6 MACs Based on Block Ciphers: DAA and CMAC
    • 12.7 Authenticated Encryption: CCM and GCM
    • 12.8 Key Wrapping
    • 12.9 Pseudorandom Number Generation using Hash Functions and MACs
    • 12.10 Recommended Reading
    • 12.11 Key Terms, Review Questions, and Problems
  • Chapter 13 Digital Signatures
    • 13.1 Digital Signatures
    • 13.2 Elgamal Digital Signature Scheme
    • 13.3 Schnorr Digital Signature Scheme
    • 13.4 NIST Digital Signature Algorithm vi Contents
    • 13.5 Elliptic Curve Digital Signature Algorithm
    • 13.6 RSA-PSS Digital Signature Algorithm
    • 13.7 Recommended Reading
    • 13.8 Key Terms, Review Questions, and Problems
  • Part FOur mutual truSt
  • Chapter 14 Key Management and Distribution
    • 14.1 Symmetric Key Distribution Using Symmetric Encryption
    • 14.2 Symmetric Key Distribution Using Asymmetric Encryption
    • 14.3 Distribution of Public Keys
    • 14.4 X.509 Certificates
    • 14.5 Public-Key Infrastructure
    • 14.6 Recommended Reading
    • 14.7 Key Terms, Review Questions, and Problems
  • Chapter 15 User Authentication
    • 15.1 Remote User-Authentication Principles
    • 15.2 Remote User-Authentication Using Symmetric Encryption
    • 15.3 Kerberos
    • 15.4 Remote User Authentication Using Asymmetric Encryption
    • 15.5 Federated Identity Management
    • 15.6 Personal Identity Verification
    • 15.7 Recommended Reading
    • 15.8 Key Terms, Review Questions, and Problems
  • Part Five netwOrk anD internet Security
  • Chapter 16 Network Access Control and Cloud Security
    • 16.1 Network Access Control
    • 16.2 Extensible Authentication Protocol
    • 16.3 IEEE 802.1X Port-Based Network Access Control
    • 16.4 Cloud Computing
    • 16.5 Cloud Security Risks and Countermeasures
    • 16.6 Data Protection in the Cloud
    • 16.7 Cloud Security as a Service
    • 16.8 Recommended Reading
    • 16.9 Key Terms, Review Questions, and Problems
  • Chapter 17 Transport-Level Security
    • 17.1 Web Security Considerations
    • 17.2 Secure Sockets Layer
    • 17.3 Transport Layer Security
    • 17.4 HTTPS
    • 17.5 Secure Shell (SSH)
    • 17.6 Recommended Reading
    • 17.7 Key Terms, Review Questions, and Problems
  • Chapter 18 Wireless Network Security Contents vii
    • 18.1 Wireless Security
    • 18.2 Mobile Device Security
    • 18.3 IEEE 802.11 Wireless LAN Overview
    • 18.4 IEEE 802.11i Wireless LAN Security
    • 18.5 Recommended Reading
    • 18.6 Key Terms, Review Questions, and Problems
  • Chapter 19 Electronic Mail Security
    • 19.1 Pretty Good Privacy
    • 19.2 S/MIME
    • 19.3 DomainKeys Identified Mail
    • 19.4 Recommended Reading
    • 19.5 Key Terms, Review Questions, and Problems - Appendix 19A Radix-64 Conversion
  • Chapter 20 IP Security
    • 20.1 IP Security Overview
    • 20.2 IP Security Policy
    • 20.3 Encapsulating Security Payload
    • 20.4 Combining Security Associations
    • 20.5 Internet Key Exchange
    • 20.6 Cryptographic Suites
    • 20.7 Recommended Reading
    • 20.8 Key Terms, Review Questions, and Problems
  • aPPenDiceS
  • Appendix A Projects for Teaching Cryptography and Network Security - A.1 Sage Computer Algebra Projects - A.2 Hacking Project - A.3 Block Cipher Projects - A.4 Laboratory Exercises - A.5 Research Projects - A.6 Programming Projects - A.7 Practical Security Assessments - A.8 Firewall Projects - A.9 Case Studies - A.10 Writing Assignments - A.11 Reading/Report Assignments - A.12 Discussion Topics
  • Appendix B Sage Examples - B.1 Linear Algebra and Matrix Functionality - B.2 Chapter 2: Classical Encryption - B.3 Chapter 3: Block Ciphers and the Data Encryption Standard - B.4 Chapter 4: Basic Concepts in Number Theory and Finite Fields - B.5 Chapter 5: Advanced Encryption Standard

viii Contents

B.6 Chapter 6: Pseudorandom Number Generation and Stream Ciphers 689 B.7 Chapter 8: Number Theory 691 B.8 Chapter 9: Public-Key Cryptography and RSA 696 B.9 Chapter 10: Other Public-Key Cryptosystems 699 B.10 Chapter 11: Cryptographic Hash Functions 704 B.11 Chapter 13: Digital Signatures 706

References 710

Credits 720

Index 723

Online chaPterS anD aPPenDiceS^1

Part Six SyStem Security

Chapter 21 Malicious Software

21.1 Types of Malicious Software 21.2 Propagation – Infected Content - Viruses 21.3 Propagation – Vulnerability Exploit - Worms 21.4 Propagation – Social Engineering – SPAM, Trojans 21.5 Payload – System Corruption 21.6 Payload – Attack Agent – Zombie, Bots 21.7 Payload – Information Theft – Keyloggers, Phishing, Spyware 21.8 Payload – Stealthing – Backdoors, Rootkits 21.9 Countermeasures 21.10 Distributed Denial of Service Attacks 21.11 Recommended Reading 21.12 Key Terms, Review Questions, and Problems

Chapter 22 Intruders

22.1 Intruders 22.2 Intrusion Detection 22.3 Password Management 22.4 Recommended Reading 22.5 Key Terms, Review Questions, and Problems Appendix 22A The Base-Rate Fallacy

Chapter 23 Firewalls

23.1 The Need for Firewalls 23.2 Firewall Characteristics 23.3 Types of Firewalls 23.4 Firewall Basing 23.5 Firewall Location and Configurations 23.6 Recommended Reading 23.7 Key Terms, Review Questions, and Problems

(^1) Online chapters, appendices, and other documents are Premium Content, available via the access card at the front of this book.

This page intentionally left blank

notation

Even the natives have difficulty mastering this peculiar vocabulary. —The Golden Bough , Sir James George Frazer

Symbol Expression Meaning D , K D( K, Y ) Symmetric decryption of ciphertext Y using secret key K D , PRa D( PRa , Y ) Asymmetric decryption of ciphertext Y using A’s private key PRa D, PUa D( PUa , Y ) Asymmetric decryption of ciphertext Y using A’s public key PUa E, K E( K , X ) Symmetric encryption of plaintext X using secret key K E, PRa E( PRa , X ) Asymmetric encryption of plaintext X using A’s private key PRa E, PUa E( PUa , X ) Asymmetric encryption of plaintext X using A’s public key PUa K Secret key PRa Private key of user A PUa Public key of user A MAC, K MAC( K, X ) Message authentication code of message X using secret key K GF( p ) The finite field of order p , where p is prime.The field is defined as the set Z p together with the arithmetic operations modulo p. GF(2 n ) The finite field of order 2 n Zn Set of nonnegative integers less than n

gcd gcd( i , j ) Greatest common divisor; the largest positive integer that dividesboth i and j with no remainder on division.

mod a mod m Remainder after division of a by m mod, K a K b (mod m ) a mod m = b mod m mod, [ a [ b (mod m ) a mod m  b mod m dlog dlog a , p ( b ) Discrete logarithm of the number b for the base a (mod p )

w f( n ) The number of positive integers less thanThis is Euler’s totient function.^ n^ and relatively prime to^ n.

Σ (^) a

n i = 1

ai a 1 + a 2 + c^ + an

Π Π

n i = 1 ai^ a^1 *^ a^2 *^

c (^) * an

xi

prefaCe

“There is the book, Inspector. I leave it with you, and you cannot doubt that it contains a full explanation.” —The Adventure of the Lion’s Mane , Sir Arthur Conan Doyle

what’S new in the Sixth eDitiOn

In the four years since the fifth edition of this book was published, the field has seen contin- ued innovations and improvements. In this new edition, I try to capture these changes while maintaining a broad and comprehensive coverage of the entire field. To begin this process of revision, the fifth edition of this book was extensively reviewed by a number of professors who teach the subject and by professionals working in the field. The result is that, in many places, the narrative has been clarified and tightened, and illustrations have been improved. Beyond these refinements to improve pedagogy and user-friendliness, there have been substantive changes throughout the book. Roughly the same chapter organization has been retained, but much of the material has been revised and new material has been added. The most noteworthy changes are as follows:

  • Network access control: A new chapter provides coverage of network access control, including a general overview plus discussions of the Extensible Authentication Proto- col and IEEE 802.1X.
  • Cloud security: A new section covers the security issues relating to the exciting new area of cloud computing.
  • SHA-3: A new section covers the new cryptographic hash standard, SHA-3, which was adopted in 2012.
  • Key wrapping: The use of key wrapping to protect symmetric keys has been adopted in a number of applications. A new section covers this topic.
  • Elliptic Curve Digital Signature Algorithm (ECDSA): Because ECDSA is more effi- cient than other digital signature schemes, it is increasingly being adopted for digital signature applications. A new section covers ECDSA.
  • RSA Probabilistic Signature Scheme (RSA-PSS): RSA-based digital signature schemes are perhaps the most widely used. A new section covers the recently standard- ized RSA-PSS, which is in the process of replacing older RSA-based schemes.
  • True random number generator: True random number generators have traditionally had a limited role because of their low bit rate, but a new generation of hardware true random number generators is now available that is comparable in performance to soft- ware pseudorandom number generators. A new section covers this topic and discusses the Intel Digital Random Number Generator (DRNG).
  • Personal identity verification (PIV) : The NIST has issued a comprehensive set of standards for smartcard-based user authentication that is being widely adopted. A new section covers PIV.

xiii

xiv PrefaCe

  • Mobile device security : Mobile device security has become an essential aspect of enter- prise network security. A new section covers this important topic.
  • Malicious software: This chapter provides a different focus than the chapter on mali- cious software in the previous edition. Increasingly we see backdoor/rootkit type mal- ware installed by social engineering attacks, rather than more classic virus/worm direct infection. And phishing is even more prominent than ever. These trends are reflected in the coverage.
  • Sample syllabus: The text contains more material than can be conveniently covered in one semester. Accordingly, instructors are provided with several sample syllabi that guide the use of the text within limited time (e.g., 16 weeks or 12 weeks). These samples are based on real-world experience by professors with the fifth edition.
  • VideoNotes on Sage examples: The new edition is accompanied by a number of VideoNotes lectures that amplify and clarify the cryptographic examples presented in Appendix B, which introduces Sage.
  • Learning objectives: Each chapter now begins with a list of learning objectives.

ObjectiveS

It is the purpose of this book to provide a practical survey of both the principles and practice of cryptography and network security. In the first part of the book, the basic issues to be addressed by a network security capability are explored by providing a tutorial and survey of cryptography and network security technology. The latter part of the book deals with the practice of network security: practical applications that have been implemented and are in use to provide network security. The subject, and therefore this book, draws on a variety of disciplines. In particular, it is impossible to appreciate the significance of some of the techniques discussed in this book without a basic understanding of number theory and some results from probability theory. Nevertheless, an attempt has been made to make the book self-contained. The book not only presents the basic mathematical results that are needed but provides the reader with an intuitive understanding of those results. Such background material is introduced as needed. This approach helps to motivate the material that is introduced, and the author considers this preferable to simply presenting all of the mathematical material in a lump at the begin- ning of the book.

SuPPOrt OF acm/ieee cOmPuter Science curricula 2013

The book is intended for both academic and professional audiences. As a textbook, it is intended as a one-semester undergraduate course in cryptography and network security for computer science, computer engineering, and electrical engineering majors. The changes to this edition are intended to provide support of the current draft version of the ACM/ IEEE Computer Science Curricula 2013 (CS2013). CS2013 adds Information Assurance and Security (IAS) to the curriculum recommendation as one of the Knowledge Areas in the Computer Science Body of Knowledge. The document states that IAS is now part of the curriculum recommendation because of the critical role of IAS in computer science educa- tion. CS2013 divides all course work into three categories: Core-Tier 1 (all topics should be included in the curriculum), Core-Tier-2 (all or almost all topics should be included), and

xvi PrefaCe

Companion Web site at WilliamStallings.com/Cryptography. To gain access to the IRC, please contact your local Pearson sales representative via pearsonhighered.com/educator/replocator/ requestSalesRep.page or call Pearson Faculty Services at 1-800-526-0485. The Companion Web site , at WilliamStallings.com/Cryptography (click on Instructor Resources link), includes the following:

  • Links to Web sites for other courses being taught using this book
  • Sign-up information for an Internet mailing list for instructors using this book to exchange information, suggestions, and questions with each other and with the author

PrOjectS anD Other StuDent exerciSeS

For many instructors, an important component of a cryptography or network security course is a project or set of projects by which the student gets hands-on experience to reinforce concepts from the text. This book provides an unparalleled degree of support, including a projects component in the course. The IRC not only includes guidance on how to assign and structure the projects, but also includes a set of project assignments that covers a broad range of topics from the text:

  • Sage projects: Described in the next section.
  • Hacking project: Exercise designed to illuminate the key issues in intrusion detection and prevention.
  • Block cipher projects: A lab that explores the operation of the AES encryption algo- rithm by tracing its execution, computing one round by hand, and then exploring the various block cipher modes of use. The lab also covers DES. In both cases, an online Java applet is used (or can be downloaded) to execute AES or DES.
  • Lab exercises: A series of projects that involve programming and experimenting with concepts from the book.
  • Research projects: A series of research assignments that instruct the student to research a particular topic on the Internet and write a report.
  • Programming projects: A series of programming projects that cover a broad range of topics and that can be implemented in any suitable language on any platform.
  • Practical security assessments: A set of exercises to examine current infrastructure and practices of an existing organization.
  • Firewall projects: A portable network firewall visualization simulator, together with exercises for teaching the fundamentals of firewalls.
  • Case studies: A set of real-world case studies, including learning objectives, case description, and a series of case discussion questions.
  • Writing assignments: A set of suggested writing assignments, organized by chapter.
  • Reading/report assignments: A list of papers in the literature—one for each chapter— that can be assigned for the student to read and then write a short report. This diverse set of projects and other student exercises enables the instructor to use the book as one component in a rich and varied learning experience and to tailor a course plan to meet the specific needs of the instructor and students. See Appendix A in this book for details.

PrefaCe xvii

the Sage cOmPuter algebra SyStem

One of the most important features of this book is the use of Sage for cryptographic exam- ples and homework assignments. Sage is an open-source, multiplatform, freeware package that implements a very powerful, flexible, and easily learned mathematics and computer algebra system. Unlike competing systems (such as Mathematica, Maple, and MATLAB), there are no licensing agreements or fees involved. Thus, Sage can be made available on computers and networks at school, and students can individually download the software to their own personal computers for use at home. Another advantage of using Sage is that students learn a powerful, flexible tool that can be used for virtually any mathematical application, not just cryptography. The use of Sage can make a significant difference to the teaching of the mathematics of cryptographic algorithms. This book provides a large number of examples of the use of Sage covering many cryptographic concepts in Appendix B, which is included in this book. Appendix C lists exercises in each of these topic areas to enable the student to gain hands-on experience with cryptographic algorithms. This appendix is available to instruc- tors at the IRC for this book. Appendix C includes a section on how to download and get started with Sage, a section on programming with Sage, and exercises that can be assigned to students in the following categories:

  • Chapter 2—Classical Encryption: Affine ciphers and the Hill cipher.
  • Chapter 3—Block Ciphers and the Data Encryption Standard: Exercises based on SDES.
  • Chapter 4—Basic Concepts in Number Theory and Finite Fields: Euclidean and extended Euclidean algorithms, polynomial arithmetic, and GF(24).
  • Chapter 5—Advanced Encryption Standard: Exercises based on SAES.
  • Chapter 6—Pseudorandom Number Generation and Stream Ciphers: Blum Blum Shub, linear congruential generator, and ANSI X9.17 PRNG.
  • Chapter 8—Number Theory: Euler’s Totient function, Miller Rabin, factoring, modu- lar exponentiation, discrete logarithm, and Chinese remainder theorem.
  • Chapter 9—Public-Key Cryptography and RSA: RSA encrypt/decrypt and signing.
  • Chapter 10—Other Public-Key Cryptosystems: Diffie-Hellman, elliptic curve.
  • Chapter 11—Cryptographic Hash Functions: Number-theoretic hash function.
  • Chapter 13—Digital Signatures: DSA.

Online DOcumentS FOr StuDentS

For this new edition, a tremendous amount of original supporting material for students has been made available online, at two Web locations. The Companion Web site , at WilliamStallings.com/Cryptography (click on Student Resources link), includes a list of rel- evant links organized by chapter and an errata sheet for the book. Purchasing this textbook new also grants the reader six months of access to the Premium Content site , which includes the following materials:

  • Online chapters: To limit the size and cost of the book, four chapters of the book are provided in PDF format. This includes three chapters on computer security