Cracking codes with python an introduction to building and breaking ciphers

Криптография и взлом шифров на Python

Научитесь программировать на Python, создавая и взламывая шифры, с помощью которых пересылаются секретные сообщения!

После знакомства с основами программирования на Python вы узнаете, как создавать, тестировать и взламывать классические шифры, включая перестановочный шифр и шифр Виженера. Постепенно мы перейдем от простых алгоритмов, таких как обратный шифр и шифр Цезаря, к обсуждению криптосистем с открытым ключом, применяемых в наши дни для защиты онлайн-транзакций.

В каждой главе приводится полноценная программа с пошаговым описанием алгоритма ее работы. Прочитав книгу, вы научитесь программировать на Python и сможете создавать собственные криптографические системы!

Основные темы книги:

  • создание криптографических приложений на Python;
  • применение словарей для быстрой проверки того, содержит ли дешифрованное сообщение осмысленный текст на английском языке или случайный набор букв;
  • создание тестов, позволяющих убедиться в том, что код шифрования и дешифрования работает корректно;
  • программирование (и взлом!) аффинного шифра, в котором для шифрования сообщения применяется модульная арифметика;
  • взлом шифров методом грубой силы и с помощью частотного анализа.

Об авторе

Эл Свейгарт — профессиональный разработчик, автор множества книг по программированию, включая бестселлер Автоматизация рутинных задач с помощью Python.

Книга обсуждается в отдельном сообщении в блоге Виктора Штонда.

формат 70×100/16; 18.01.2022; Вильямс.

Понравилась книга? Порекомендуйте её друзьям и коллегам:

Введение. 21
Глава 1. Инструменты “бумажной” криптографии. 31
Глава 2. Программирование в интерактивной оболочке. 41
Глава 3. Строковый тип данных и написание программ. 53
Глава 4. Обратный шифр. 73
Глава 5. Шифр Цезаря. 89
Глава 6. Взлом шифра Цезаря методом грубой силы. 109
Глава 7. Шифрование с помощью перестановочного шифра. 119
Глава 8. Дешифрование перестановочного шифра. 145
Глава 9. Написание тестов. 161
Глава 10. Шифрование и дешифрование файлов. 177
Глава 11. Программное распознавание английских слов. 193
Глава 12. Взлом перестановочного шифра. 217
Глава 13. Аффинное шифрование с помощью модульной арифметики. 229
Глава 14. Программирование аффинного шифра. 245
Глава 15. Взлом аффинного шифра. 261
Глава 16. Программирование простого подстановочного шифра. 271
Глава 17. Взлом простого подстановочного шифра. 287
Глава 18. Программирование шифра Виженера. 319
Глава 19. Частотный анализ. 333
Глава 20. Взлом шифра Виженера. 357
Глава 21. Одноразовый шифроблокнот. 403
Глава 22. Нахождение и генерирование простых чисел. 411
Глава 23. Генерирование ключей для криптосистем
с открытым ключом. 429
Глава 24. Программа шифрования с открытым ключом. 445
Приложение А. Отладка кода Python. 477
Приложение Б. Ответы на контрольные вопросы. 485
Предметный указатель. 503

Читайте также:  Python как поставить пробелы

Источник

Cracking Codes with Python

Cracking Codes with Python

After a crash course in Python programming basics, you’ll learn to make, test, and hack programs that encrypt text with classical ciphers like the transposition cipher and Vigenère cipher. You’ll begin with simple programs for the reverse and Caesar ciphers and then work your way up to public key cryptography, the type of encryption used to secure today’s online transactions, including digital signatures, email, and Bitcoin.

Each program includes the full code and a line-by-line explanation of how things work. By the end of the book, you’ll have learned how to code in Python and you’ll have the clever programs to prove it!

  • Combine loops, variables, and flow control statements into real working programs
  • Use dictionary files to instantly detect whether decrypted messages are valid English or gibberish
  • Create test programs to make sure that your code encrypts and decrypts correctly
  • Code (and hack!) a working example of the affine cipher, which uses modular arithmetic to encrypt a message
  • Break ciphers with techniques such as brute-force and frequency analysis

There’s no better way to learn to code than to play with real programs. Cracking Codes with Python makes the learning fun!

Al Sweigart is a professional software developer who teaches programming to kids and adults. He is the author of Automate the Boring Stuff with Python, Invent Your Own Computer Games with Python, and Scratch Programming Playground, also from No Starch Press. His programming tutorials can be found at https://inventwithpython.com.

Chapter 1: Making Paper Cryptography Tools
Chapter 2: Programming in the Interactive Shell
Chapter 3: Strings and Writing Programs
Chapter 4: The Reverse Cipher
Chapter 5: The Caesar Cipher
Chapter 6: Hacking the Caesar Cipher with Brute Force
Chapter 7: Encrypting with the Transposition Cipher
Chapter 8: Decrypting with the Transposition Cipher
Chapter 9: Programming a Program to Test Your Program
Chapter 10: Encrypting and Decrypting Files
Chapter 11: Detecting English Programmatically
Chapter 12: Hacking the Transposition Cipher
Chapter 13: A Modular Arithmetic Module for the Affine Cipher
Chapter 14: Programming the Affine Cipher
Chapter 15: Hacking the Affine Cipher
Chapter 16: Programming the Simple Substitution Cipher
Chapter 17: Hacking the Simple Substitution Cipher
Chapter 18: Programming the Vigenère Cipher
Chapter 19: Frequency Analysis
Chapter 20: Hacking the Vigenère Cipher
Chapter 21: The One-Time Pad Cipher
Chapter 22: Finding and Generating Prime Numbers
Chapter 23: Generating Keys for the RSA Cipher
Chapter 24: Programming the RSA Cipher

Читайте также:  Html background gradient with image

Appendix: Debugging Python Code

View the detailed Table of Contents
View the Index

“Definitely worth the read even as an experienced Python developer. I learned more about cryptography and even a few new Python tricks.”
—Ray Doyle, The Ethical Hacker Network

“I recommend this book for anyone who wants to learn Python/programming and is interested in security or puzzles.”
—Jeanne Boyarsky, Code Ranch

“A fantastic programming and cryptography course for any high school-aged child.”
The Old Schoolhouse Magazine

Источник

Cracking Codes with Python

Cracking Codes with Python teaches complete beginners how to program in the Python programming language. The book features the source code to several ciphers and hacking programs for these ciphers. The programs include the Caesar cipher, transposition cipher, simple substitution cipher, multiplicative & affine ciphers, Vigenere cipher, and hacking programs for each of these ciphers. The final chapters cover the modern RSA cipher and public key cryptography.

Cracking Codes with Python is the 2nd edition of the previously-titled book, Hacking Secret Ciphers with Python.

Downloads & Online Tools

Read the Book Online

  • Introduction
  • Chapter 1 — Making Paper Cryptography Tools
  • Chapter 2 -Programming in the Interactive Shell
  • Chapter 3 — Strings and Writing Programs
  • Chapter 4 — The Reverse Cipher
  • Chapter 5 — The Caesar Cipher
  • Chapter 6 — Hacking the Caesar Cipher with Brute-Force
  • Chapter 7 — Encrypting with the Transposition Cipher
  • Chapter 8 — Decrypting with the Transposition Cipher
  • Chapter 9 — Programming a Program to Test Your Program
  • Chapter 10 — Encrypting and Decrypting Files
  • Chapter 11 — Detecting English Programmatically
  • Chapter 12 — Hacking the Transposition Cipher
  • Chapter 13 — A Modular Arithmetic Module for the Affine Cipher
  • Chapter 14 — Programming the Affine Cipher
  • Chapter 15 — Hacking the Affine Cipher
  • Chapter 16 — Programming the Simple Substitution Cipher
  • Chapter 17 — Hacking the Simple Substitution Cipher
  • Chapter 18 — Programming the Vigenere Cipher
  • Chapter 19 — Frequency Analysis
  • Chapter 20 — Hacking the Vigenere Cipher
  • Chapter 21 — The One-Time Pad Cipher
  • Chapter 22 — Finding and Generating Prime Numbers
  • Chapter 23 — Generating Keys for the Public Key Cipher
  • Chapter 24 — Programming the Public Key Cipher
  • Appendix A — Debugging Python Code
Читайте также:  Php относительный путь до файла

Receive a Free Review Copy

If you’d like to receive a free print copy of Cracking Codes with Python, please fill out the form at https://goo.gl/forms/vylfjeQLRdioOQ3C2. Please specify you want «Cracking Codes with Python». You’ll receive a free ebook to read, and upon posting a review to Amazon, you will receive a complementary print review copy of the book. (UPDATE: There’s been a large amount of interest, and I can’t guarantee you’ll get a print book. However, I can definitely send you an ebook to review.)

To demonstrate that you will be able to write a review, please send me a link to an Amazon, Goodreads, or Powells review you have written before. If you haven’t written an Amazon review before, please explicitly tell me in your email you have an Amazon account and can post reviews. Also, please include the word «walrus» in the subject of your email so I know you read this. I’m happy to send out books to reviewers, but I can only respond to serious inquiries from folks who have read these instructions.

Please post an honest review. Posting a negative review will not impact whether or not you get a free print book. The only requirements are that the review be a minimum of 100 words, you must live within the United States (due to shipping costs), you must have purchased $50 off Amazon in the last year (Amazon has this requirement before you can write a review), and that you email me first before writing the review.

Black Lives Matter Trans Rights Are Human RightsTax the Rich

BLACK LIVES MATTER | TRANS RIGHTS ARE HUMAN RIGHTS | TAX THE RICH

Источник

Оцените статью