Python Cryptography Programming (2nd Edition) cover

Python Cryptography Programming (2nd Edition)

No rating yet
Word count
475 words
Chapters
25
Series
Turing Programming Series
ISBN
9787115529992

Tags

Summary

Python Cryptography Programming (2nd Edition) is Al Sweigart's hands-on introduction to cryptography for beginning programmers; the Chinese edition is translated from the second edition of the original, whose English title is Cracking Codes with Python. Using Python as its tool, the book starts from a point that requires no programming background: it first has readers make paper cryptography tools and become familiar with the interactive environment and string operations, then step by step implements classical ciphers such as the reverse cipher, Caesar cipher, transposition cipher, affine cipher, simple substitution cipher, and Vigenère cipher. Each algorithm unfolds in three stages—principle, implementation, cracking: first the encryption idea is explained, then annotated Python code is given, and finally a program is written to break the ciphertext, with practical techniques such as brute-force enumeration, frequency analysis, and automatic detection of English text woven in. The latter half advances to the one-time pad, finding and generating primes, public-key key generation, and a programmed implementation of the RSA public-key algorithm, and an appendix on debugging Python code closes the book. About 330 pages and 475,000 characters, with sample source code and exercises at the end of each chapter, it suits a learn-by-typing approach.

Editor's review

很多密码学入门书一上来就是数论证明和符号公式,把只想“动手做个加密程序”的读者挡在门外。斯维加特这本书走的是另一条路:不讲抽象定理,直接给你能跑起来的代码。每个古典密码都拆成原理、实现、破解三段,写完加密程序紧接着写破解程序,读者在“攻与防”的一来一回中自然理解了密钥空间、频率特征、暴力枚举这些概念是怎么落到代码里的。更难得的是它对零基础读者友好——第一章甚至用纸和笔做密码工具,交互式环境、字符串操作、文件读写都从头交代,不需要先啃完一本Python教材。第2版把内容延伸到一次一密、素数生成和RSA公钥算法,读完能对现代密码的骨架有直观认识。题量适中、代码注释清楚、配套源码齐全,很适合作为“第一个密码学项目”的练手读物。需要说明的是,全书重在教学演示,而非可直接用于生产环境的加密库。

Who it's for

A good fit for

  • 已经会用Python基本语法,想找个项目练手巩固的编程初学者
  • 对密码学好奇但被数学公式劝退、希望先动手实现再补理论的读者
  • 信息安全从业者,想从代码层面重温古典密码与RSA的基本构造
  • 计算机、信息安全相关专业学生,需要课程实践或课设参考资料
  • 中学信息技术教师或编程兴趣班老师,寻找可拆解复用的教学案例

Not a good fit for

  • 希望直接获得可上生产环境的加密方案与安全库用法的人
  • 数学基础扎实、想要严格证明与算法复杂度分析的高阶密码学读者
  • 完全零编程经验、连变量与循环都未接触的读者,会感到节奏偏快
  • 关注现代密码协议、TLS、密钥管理等工程实践方向的从业者

Reading tips

  1. 务必边读边敲:每章的加密与破解代码都手动输入并运行一遍,效果远胜只看书。
  2. 先读第2、3章确认Python环境与字符串基础,若已熟练可跳过,直接进入第4章。
  3. 读完古典密码部分后,尝试把频率分析程序改成处理中文或英文以外的文本,检验理解程度。
  4. 把它当项目书而不是理论书,遇到原理疑问再配合一本密码学教材补齐数学背景。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Chapter 1 Making Paper Cryptography Tools
  2. Chapter 2 Programming in the Interactive Environment
  3. Chapter 3 Strings and Writing Programs
  4. Chapter 4 The Reverse Cipher
  5. Chapter 5 The Caesar Cipher
  6. Chapter 6 Cracking the Caesar Cipher with the Brute-Force Algorithm
  7. Chapter 7 Encrypting with the Transposition Cipher
  8. Chapter 8 Decrypting the Transposition Cipher
  9. Chapter 9 Writing Test Programs
  10. Chapter 10 Encrypting and Decrypting Files
  11. Chapter 11 Programming to Detect English Text
  12. Chapter 12 Cracking the Transposition Cipher
  13. Chapter 13 Modular Arithmetic Module for the Affine Cipher
  14. Chapter 14 Writing the Affine Cipher
  15. Chapter 15 Cracking the Affine Cipher
  16. Chapter 16 Writing the Simple Substitution Cipher
  17. Chapter 17 Cracking the Simple Substitution Cipher
  18. Chapter 18 Writing the Vigenère Cipher
  19. Chapter 19 Frequency Analysis
  20. Chapter 20 Cracking the Vigenère Cipher
  21. Chapter 21 The One-Time Pad
  22. Chapter 22 Finding and Generating Prime Numbers
  23. Chapter 23 Generating Keys for Public-Key Ciphers
  24. Chapter 24 Writing the Public-Key Cipher Algorithm
  25. Appendix Debugging Python Code

FAQ

这本书需要什么Python基础才能读?
只需要变量、循环、函数这一层的基本语法。前三章会把交互式环境、字符串、文件读写补一遍,对Python要求不高,但完全没写过代码的读者建议先学完一门Python入门课再读。
第1版和第2版有什么区别?
第1版2016年出版,译者李永伦,ISBN 9787115424297,约324页;第2版2020年出版,译者郑新芳、赵怡翾,ISBN 9787115529992,330页、475千字,内容依据原书第2版更新,并延伸到一次一密与RSA公钥算法的实现。
书里的算法能直接用在真实项目里吗?
不建议。书中代码是为教学演示写的,注重可读性,缺少真实系统需要的密钥管理、随机数质量与抗侧信道等考虑。真实项目应使用经过审计的成熟密码库。
包含配套源码吗?
是的,本书提供示例源代码下载,涵盖书中各章的加密、破解程序。建议下载后对照书本运行,便于排查自己在录入代码时的错误。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

More by the same author

Top rated in the same category