top | item 13089489

Crypto 101 – Introductory course on cryptography

919 points| zerognowl | 9 years ago |crypto101.io

140 comments

order
[+] eponeponepon|9 years ago|reply
This is about to eat my weekend, I think! :)

Quite seriously, this is exactly what the tech world needs - personally, I know that in terms of understanding of crypto I'm streets ahead of the average Joe, but orders of magnitude behind people who actually know the field. I'm certain I'm far from alone in that set, but the way the world's going means that we with the generalised technical know-how have a moral impetus to bring the rest of the world up to speed with the whys and wherefores.

[+] Gruselbauer|9 years ago|reply
Logged in to post pretty much exactly this.

Since the author is reading this: thanks. Read the first few lines and am already hooked. I have been looking for a long time, but most texts on crypto are either way below my level of understanding or miles above. You're a godsend!

[+] tscs37|9 years ago|reply
I'm not sure if it still applies, but there is a saying:

"There are maybe 5 people in the world that may call themselves cryptographers"

[+] milansm|9 years ago|reply
> I'm streets ahead of the average Joe

Has anyone seen "streets ahead" being used by anyone else besides Pierce Hawtorn and the OP? I mean, is it widely used now? (I'm not native speaker, obviously)

[+] marknadal|9 years ago|reply
Same here, however I think it is better for us to talk about what we do know more, so that it increases the discussion and thus awareness and knowledge sharing (as well as getting corrected when wrong).

So we went out on a limb and made these 1 minute layman video explainers on cryptography: http://gun.js.org/explainers/data/security.html , I hope they are useful. Anything incorrect?

[+] PeterisP|9 years ago|reply
The old Cryptopals challenges (http://cryptopals.com/) seem to cover the same material in a pedagogically very different way - they don't feed you the information as this book does, but give you a practical task which can be easily done with e.g. reading the specification of an algorithm from wikipedia, but figuring out the implementation of the attack yourself gives a much better understanding than simply reading about it.

Although this book claims a "Learn by doing" approach, I didn't find any specific assignments or data samples to facilitate that.

[+] lvh|9 years ago|reply
Hi! I'm the author. Also a big fan of Cryptopals; I was one of the reviewers for Set 8, and working with some of the authors. It's interesting to hear that point of view; because I thought C101 took the same approach as Cryptopals in the sense that it focused on teaching crypto by breaking it. When I say "learn by doing", I'm referring to stuff like walking through a bit-flipping attack just like cryptopals does. I recommend (and have organized/will be organizing) study groups where we work through cryptopals using Crypto 101; and I think that's a great idea. I was originally going to add exercises for C101, but honestly, Cryptopals was already that, and there wasn't much point in reinventing the wheel. I guess I should probably link to them?
[+] stcredzero|9 years ago|reply
When I was taking Aikido, there was a day when the sensei was going through all of our techniques and showed how the uke (initiator of the attack, receiver of the technique) could turn things around on the tori. (receiver of the attack, initiator of the technique) It seemed like there were a half dozen ways each that a technique could go seriously wrong, and that many of them didn't require much skill, only determination and the opportunity provided by a mistake. That day made me question the validity of the entire notion of self defense.

I wonder if there shouldn't be a software engineering class where people try to set up a secure web app, with their own homegrown algorithms and protocols, which is then attacked by a tiger team which includes a conspirator on the inside? Perhaps there are such classes now.

[+] derefr|9 years ago|reply
I've always thought it would be neat to have something like the Netflix "Chaos Monkey", but rather than sitting around on your machines taking them down at random, it sits on your network (or as part of the offering of the PaaS you've deployed to) trying to break into your stack using Metasploit et al, and then will immediately shut down/isolate every piece of software it manages to gain access to.

If you deployed vulnerable code, you'd see your stack fall over ~10mins later, along with an accompanying notice from the Penetrator Monkey that you've got work to do.

[+] tptacek|9 years ago|reply
There should be. In industry, we call those things CTFs, and there are both attacker and defender CTFs. My experience has been that they are extremely effective learning tools.
[+] ronjouch|9 years ago|reply
Not exactly what you describe but related: people build intentionally-vulnerable applications for the sake of teaching security by example.

In the sub-domain of web security, django.nV is such a "purposefully vulnerable Django application" that comes as companion to a websec tutorial: https://github.com/nVisium/django.nV

No disclaimer, I have no affiliation with the project, I just enjoy their work.

[+] gmluke|9 years ago|reply
This is slightly tangential since you specified a conspirator on the inside, but how easy is it to break a homegrown encryption algorithm if you don't have the source code? I assume there are tools (what are they?) that will break a simple caesar cipher if you have more than a sentence or so of plain text to work with. But if you strung together 2-3 broken algorithms and your attacker doesn't know which ones, is it still trivial to decrypt?
[+] lfx|9 years ago|reply
There are penetration testing classes, but doubt that they are bundled together with classical CS, thought never know what some uni or courses may add. And there are project like those for practicing, few pointers:

- https://sourceforge.net/projects/metasploitable/

- https://github.com/ethicalhack3r/DVWA

- https://www.vulnhub.com/

If you go this direction you will find much more applications prepared for Capture The Flag competitions. Some people are even posting walk-throughs how to hack and fix them. It is very interesting & hard.

[+] andrewflnr|9 years ago|reply
Aikido in particular seems to be very subtle, both in my experience and the opinion of an aikido black belt I've asked about it. If you restrict yourself to aikido techniques and your attacker has no such reservations, you have to be extremely good. I think it would be a mistake to give up on self-defense in general because of that. In any case, you have to go into it knowing it's not a guarantee, it just increases your odds.
[+] thfuran|9 years ago|reply
What would be the purpose of such a class? If the point is to show that rolling your own security is bad, it seems like having an inside man would just help leave people convinced that they could have succeeded if only it weren't for that other guy.
[+] TrinaryWorksToo|9 years ago|reply
With everything in Crypto I have to wonder: Is the information correct? I really have no way of verifying if I'm learning the correct DHE, and I know that it's easy to get wrong. Perhaps I can do some testing in code, but I may test it incorrectly too, and those small errors can be exploited.
[+] lvh|9 years ago|reply
Hi! I'm the author of Crypto 101.

Firstly, I'm a real, honest-to-God cryptographer. I don't know if there are any particular people you had in mind whose recommendations you'd like to see, but there are a few HN bigwigs who'd probably be willing to generally endorse it :-) Also, it's been posted on HN a few times before, so it's had some scrutiny. That doesn't mean I don't make mistakes, but generally speaking, an active reader should be OK.

The other thing is in the way the book is structured. I teach you to break crypto; so when I say something is broken, I prove it by showing you how to break it.

Finally, the goal of this book is absolutely not to help you implement DHE. In an ideal world, the primitives we offer people are hard to misuse. Crypto 101 then only exists to satisfy programmer curiosity. It is not a replacement for a traditional academic education that will help you design new primitives; it also doesn't show you how to write secure implementations. However, Crypto 101 is still useful beyond merely satisfying curiosity now, because most cryptographic libraries _do not_ provide that easy-to-use API. Using regular hashes for password storage, various forms of broken AES-CBC (unauthenticated, key=IV, static IV...), et cetera are very real problems for real code, and Crypto 101 teaches you how to avoid that minefield.

I'm also working on the "better, more accessible" crypto part, but I only have so much free time :)

[+] dom0|9 years ago|reply
> I really have no way of verifying if I'm learning the correct DHE, and I know that it's easy to get wrong. Perhaps I can do some testing in code, but I may test it incorrectly too, and those small errors can be exploited.

Well this is step 0 in cryptography engineering: You don't implement primitives. Use reviewed components providing primitives and implement your protocol on top of that. Step -1 is to not design your protocol, but use a reviewed protocol and implement that. Finally, step -2 is to not implement a protocol, but rather use a reviewed implementation of a fitting protocol.

This isn't sarcasm and I don't mean to attack you.

[+] clifanatic|9 years ago|reply
Well, one benefit of wide exposure (like here on HN) is that if it was wrong, somebody would be bound to come along and point it out.

FWIW, I consider myself pretty well-versed on cryptography and although I haven't gone over this book with a fine-toothed comb (yet!), it looks very, very accurate to me.

[+] TheGorramBatman|9 years ago|reply
There is some level of trust when you read books like this (or really any technical book); for that reason I'd probably pass on it for something by an authority in the field (or their recommendations).
[+] baby|9 years ago|reply
You learn about DHE reading this. You implement DHE following specs and standards.
[+] theschwa|9 years ago|reply
There seems to be a lot of comments asking about the quality of this piece. I read through this the last time it was posted to HN, and I just have to say that this is the perfect balance of having enough detail to understand how things work, but not so much that it's overwhelming. That's a really difficult balance when it comes to crypto, so major props to the author. Fantastic work.
[+] lhnz|9 years ago|reply
Whenever I have taken the small amount of cryptography knowledge I already have and tried to use it in a project, I've often been shutdown with "the system already does that" when it doesn't, or "this will be too complicated for the user, instead lets just roll our own [ad-hoc cryptography method]".

For those reading:

How do you convince people that it's worth using best practices?

Is there a good heuristic to measure the value of something, when deciding how much time and money to spend on securing it?

What are good library/SaaS solutions to help build secure applications with less chance of shooting yourself in the foot, better UX and lower cost? (Keybase, etc.)

[+] tptacek|9 years ago|reply
For normal application work, you should use NaCL (or it's repackaged version, libsodium) to the exclusion of all else.
[+] sambe|9 years ago|reply
The video claims that the Python standard library doesn't check certificates by default. In fact, it has done for at least a couple of years ([0] quotes the documentation as saying that it changed two years ago - in 2.7.9 and 3.4.3).

Although the video is marked 2015, the overlay at the start shows it's from PyCon 2013.

[0]: http://stackoverflow.com/a/28325763/2492

[+] Raed667|9 years ago|reply
I'm really disappointed that (9.4) Elliptic curve cryptography is still under TODO.

If anyone is interested in ECC, ars has a pretty good introduction [0].

[0] : http://arstechnica.com/security/2013/10/a-relatively-easy-to...

[+] tptacek|9 years ago|reply
You can also mail Sean Devlin to get Set 8 of the Crypto Challenges, which cover ECC. Finding the right place to mail I'll leave as an exercise for the reader.
[+] gespadas|9 years ago|reply
Suggestion: Add some notification medium for when the book is ready.
[+] midgetjones|9 years ago|reply
Agreed. The one time I actually want to sign up to a mailing list, and there's no way of doing it.
[+] LaurensBER|9 years ago|reply
I checked the PDF and this looks very interesting and comprehensive, any change you could give an eta for the final release and more specific the epub release?

Thanks!

[+] CameronBanga|9 years ago|reply
Quick question, I had apparently Pinboarded this in March 2014. I see the PDF is still pre-release. Has anything changed with this, or is it kinda just coming up again because of recent political climate.

I'm fine either way, just curious if this has changed drastically from what I had looked at previously.

[+] ronjouch|9 years ago|reply
Paragraph "Development" (page 14 in the current version) answers your question:

"The entire Crypto 101 project is publicly developed on GitHub under the crypto101 organization, including this book: https://github.com/crypto101/book "

[...]

"The copy of this book that you are reading right now is based on the git commit with hash 3f89ec3 , also known as 0.4.0-22-g3f89ec3"

Then, looking at the commits, yes the book changed a lot since 2014: https://github.com/crypto101/book/commits/master

[+] lvh|9 years ago|reply
Hi! I'm the author.

I should stop calling it a pre-release. There's no useful "done" marker. It includes most of the material I wanted to talk about, and has for a while. You should update the PDF though; as the other commenter mentioned, it does get updated :)

[+] zappo2938|9 years ago|reply
For idiots like myself, I found this video, Public key cryptography - Diffie-Hellman Key Exchange (full version), to be completely enlightening using mixed colors to explain the most basic features of a cryptography algorithm.[0]

[0] https://www.youtube.com/watch?v=YEBfamv-_do

[+] bogomipz|9 years ago|reply
For anyone interested I found this to be a good book on working through some cryto implementations in Go:

https://leanpub.com/gocrypto

Its free to read online but its also very reasonably priced. Its written by an engineer over at Cloudflare.

[+] bogomipz|9 years ago|reply
This is great! Kudos to the author and thanks Rackspace for sponsoring this as well.

It's really encouraging to see this increased democratization of crypto not necessarily in the engineering of it per se but rather the awareness and understanding of it.

[+] chetanahuja|9 years ago|reply
I put this pdf on my phone and read through interesting sections over a vacation involving long flights. It's a very nicely written text that you can read over a few days with some basic computer-science/mathematical background.
[+] southphillyman|9 years ago|reply
Thanks for this my guy! Maybe I'm telling on myself here, but I get the impression that your average developer doesn't know much about security outside of the basic (sql injection/cross site scripting)
[+] qwertyuiop924|9 years ago|reply
Can any crypto people here on HN verify that this gets it right?
[+] mrcactu5|9 years ago|reply
cryptography textbooks get very difficult. I get lost in a sea of hashes and the prime number theorem