Can you keep a secret? I hope so, because much of the modern world is built on cryptography: the art of secret messages. This book will show you what it’s all about and how it really works, with dozens of example programs in Go.
About the book
Have you ever wondered how passwords are stored securely? What makes a good password? How codes and ciphers are designed—and broken? Where random numbers come from, and what makes them random? What are the connections between lava lamps, space games, digital signatures, black holes, and Bitcoin? Let's find out. Join Alice, Bob, Eve, and Mallory as we learn about the fundamental principles of cryptography and digital security, from brute force and blockchains to keyspaces and hashing. We'll build a cipher system in Go from scratch, with step-by-step instructions and code examples at each stage (also available on GitHub).
Starting with the simplest cipher imaginable, we'll gradually improve the system by attacking it, adding sophisticated features like block chaining, padding, digests, and authentication. Along the way, you'll develop a powerful intuitive understanding of ciphers and keys, what makes them strong (or weak), and how to use them securely. We'll see how state-of-the-art modern algorithms like AES, SHA-256, Diffie-Hellman, and RSA work under the hood, and how to integrate them into real-world Go tools. This book is essential reading for all Go programmers who have to deal with encryption, authentication, and security... in other words, all of us!
What you’ll learn:
By reading through this book and completing the challenges, you’ll learn about:
The fundamental principles of codes and ciphers
Building software test-first in Go
How to write useful command-line tools
Password security, keyspaces, and cracking
Blocks, streams, chains, and cipher modes
Padding, number bases, and endianness
Pseudo-random and true random number generators
Entropy, complexity, and quantum
…
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A hands-on, test-driven tour of cryptography for Go programmers, this book builds a cipher system from scratch—then attacks, breaks, and hardens it—while demystifying real-world algorithms like AES, SHA-256, and RSA. Read it if you want to understand *why* crypto works (and fails) through code, not just theory.
【Book Arc】
- **Opening (~0%–12%)**: Introduces the cast (Alice, Bob, Eve, Mallory) and the core problem—secret messages. Starts with the simplest shift cipher, then immediately shifts to test-first Go development: writing failing tests, building an `Encipher` function, and turning it into a command-line tool with flags.
- **Early (~12%–28%)**: The attack phase. You learn brute-force cracking, statistical vulnerabilities, and "cribs" (known plaintext) to break weak ciphers. This leads to a deeper look at keys: keyspace size, multi-byte keys, and the modulus operator—culminating in a working cracker tool and a discussion of password security, keyspaces, and passphrases.
- **Early–Middle (~28%–36%)**: Moves from toy ciphers to block ciphers. You implement a `cipher.BlockMode` interface, handle block alignment, and add padding schemes. The section ends with key enumeration, endianness, and benchmarking—showing why strong keys are practically uncrackable, even with parallel computing.
- **Middle (~36%–48%)**: Shifts to information theory and entropy. You explore Kolmogorov complexity, random number generation (including quantum sources), and then visualize cipher weaknesses by encrypting images. This motivates the move from ECB to more secure modes like CTR and CBC, with a full implementation of CBC.
- **Late (~48%–52%)**: Covers hashing for message integrity. You build naive hash functions (LenHash, SumHash), attack them with preimage attacks, and learn the avalanche effect. This leads to real algorithms (MD5, SHA-1, SHA-256) and password hashing with salting and slow hashes.
- **Ending (~52%+)**: Applies everything to cryptocurrency. You design "Bobcoin," a toy blockchain, tackling trust, double-spending, and proof-of-work—showing how the cryptographic primitives you've built underpin modern distributed systems.
【Key Takeaways】
- **Test-first development is the pedagogical engine** (Early): Every cipher component—from `Encipher` to `Crack`—is built by writing a failing test first. This isn't just about correctness; it forces you to clarify behavior and edge cases before coding. (Early)
- **Keyspace size is the ultimate security metric** (Early): The book quantifies why longer keys are exponentially safer, using the "keyspace the size of the universe" thought experiment. You'll learn to estimate crack times and understand why brute force is futile against strong keys. (Early)
- **Cribs and statistical attacks break weak ciphers** (Early): Using known plaintext ("cribs") and frequency analysis, you'll build a working cracker. This demonstrates that security through obscurity is useless—the structure of the cipher itself must be sound. (Early)
- **Block modes are where real-world crypto lives** (Middle): ECB mode leaks patterns (shown vividly with image encryption), so you implement CBC with an IV and learn about CTR mode and nonces. This is the difference between a toy cipher and a secure one. (Middle)
- **Entropy is a measure of ignorance, not just randomness** (Middle): The book connects information theory to crypto, explaining why compressed or enciphered data has high entropy and how to identify ciphertexts. This is crucial for understanding random number generation. (Middle)
- **Hashing is about integrity, not secrecy** (Late): You'll build and break naive hashes, then learn why SHA-256 and salting matter for password storage. The key insight: a good hash has the avalanche effect—a single bit change flips half the output bits. (Late)
- **Blockchains are a consensus problem, not a crypto problem** (Ending): The "Bobcoin" chapter shows how hashing and proof-of-work solve double-spending and ordering, not encryption. This ties all the primitives together into a real-world system. (Ending)
【Reading Tips】
- **Skim the "Key points" summaries** at the end of each chapter if you're short on time—they distill the essential concepts without the code walkthroughs.
- **Deep-read Chapters 1–4** (Ciphers, Deciphering, Cracking) if you're new to Go testing or crypto basics. The test-first rhythm is established here and carries through the whole book.
- **Don't skip the image encryption example in Chapter 14** (Chains)—it's the most intuitive demonstration of why ECB mode is broken. Visualizing the pattern leak makes the theory stick.
- **Treat the code as a companion, not a reference**: The GitHub repo has the full examples, but the value is in the step-by-step reasoning. Try to write the tests yourself before peeking at the solutions.
- **Watch for the "devil in the details" sections**—they highlight subtle bugs (like endianness or padding edge cases) that are easy to miss but critical in real crypto implementations.
【Coverage Limits】
The excerpts cover roughly the first half of the book (through hashing and the start of cryptocurrency). Later chapters on RSA, Diffie-Hellman, and digital signatures are mentioned in the blurb but not detailed in the provided material.
Excerpt 1
ndianness Pseudo-random and true random number generators Entropy, complexity, and quantum … Contents Praise for Explore Go: Cryptography 12 Introduction 13...
ed to know something about what makes things secure, or not. We can probably recognise a weak password when we see one (especially if it’s “password”), but w...
rse code. Codes can be used to send secret messages, though. For example, if we want to have a conversation that may be overheard, we might agree beforehand...
r the orig‐ inal problem, as well as our simplified version. We’re not the only ones who like to do this; scientists call it the “spherical cow” tech‐ nique,...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Explore Go Cryptography (John Arundel) (Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Explore Go Cryptography (John Arundel) (Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment