TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Tptacek's Review of "Practical Cryptography With Go"

284 pointsby babawereabout 11 years ago

27 comments

zatkinabout 11 years ago
For those of you who don&#x27;t know what the acronyms stand for, I&#x27;ve compiled a list, in order by their appearance:<p><pre><code> AES - Advanced Encryption Standard CBC - Cipher Block Chaining PKCS - Public Key Cryptography Standards SHA - Secure Hashing Algorithm MAC - Message Authentication Code PBKDF - Password-Based Key Derivation Function NIST - National Institute of Standards and Technology FIPS - Federal Information Processing Standard KDF - Key derivation function CTR - Counter Mode RSA - Rivest Shamir Adleman (last names of each creator of the RSA algorithm) OAEP - Optimal Asymmetric Encryption Padding PSS - Probabilistic Signature Scheme ECDSA - Elliptic Curve Digital Signature Algorithm PS3 - Playstation 3? DH - Diffie-Hellman key exchange ECDH - Elliptic curve Diffie-Hellman key exchange TLS - Transport Layer Security</code></pre>
评论 #7596548 未加载
评论 #7596943 未加载
评论 #7596525 未加载
评论 #7596690 未加载
jgrahamcabout 11 years ago
I happen to know the author of this. This was a really tough thing for him to read, but he&#x27;s taking it as constructive criticism.<p>I would add to the people commentating here on HN: tptacek&#x27;s review is tough; you do not need to lay into the author of this book any more.
评论 #7596905 未加载
评论 #7596909 未加载
评论 #7596913 未加载
评论 #7596914 未加载
评论 #7597028 未加载
评论 #7598979 未加载
评论 #7597493 未加载
tptacekabout 11 years ago
If I had written a book on implementing cryptography in Golang, I assure you that someone else would have reviewed it harshly too. It&#x27;s simply a difficult subject to get right.
评论 #7598004 未加载
评论 #7598260 未加载
评论 #7597992 未加载
评论 #7598295 未加载
GuiAabout 11 years ago
From tptacek&#x27;s comment, it sounds like the author of the book may just be an inexperienced practitioner of cryptography who&#x27;s only crime is to be too eager to spread what they&#x27;ve learned.<p>Someone who picked up the basics from a few Wikipedia articles here, a few papers there, a couple open source projects here and there... they&#x27;re smart, so they&#x27;re not completely clueless about the field, but they just don&#x27;t have the experience to see where they fall short, the industry know-how, and so on.<p>I feel like instances of this in the tech community are not too rare, and it&#x27;s a consequence of the internet: anyone can publish a book and distribute it all over the world now. It&#x27;s worth keeping in mind that while harm is being done through the spread of false information, what&#x27;s most important is to educate them, see this as a teachable moment, so they can become productive experts and modify their message to be fully correct. Of course, it requires them to be open minded of their shortcomings: but it can be done.<p>PS: I have no clue who the author of Practical Cryptography With Go is.
评论 #7596740 未加载
评论 #7596696 未加载
评论 #7597230 未加载
评论 #7596815 未加载
austinzabout 11 years ago
I see the implementation of cryptosystems as an engineering endeavor little different than designing, for example, a commercial airplane, a bridge, or a radiation therapy machine. In all cases you have a system whose failure can result in anything from monetary loss to death (for an example of the latter, faulty cryptographic software used by dissidents in repressive countries). In all cases you use a combination of rigorous testing and analysis from first principles to try and isolate potential weaknesses. In all cases you want to ensure the people who worked on the system knew what they were doing and put the right amount of due diligence into ensuring the system works correctly.<p>Unfortunately, not even widely used, highly trusted implementations work right all the time. A out-of-bounds memory bug introduced by an insufficiently vetted commit opened up a serious flaw in OpenSSL. On a much, much smaller scale, I once had the misfortune of working with an old version of Microchip&#x27;s PIC18 AES library, which had some serious issues that made it nonfunctional for anything more complex than the toy sample app it shipped with. But with enough exposure these problems are eventually exposed and fixed. Would a world where everyone rolled their own bespoke, ad-hoc SSL implementations be more secure? I doubt it.<p>In the end, I think there needs to be a cultural shift. People shouldn&#x27;t be discouraged from building their own crypto for fun and learning, but they should be discouraged from deploying it for any application where real security is required - at least not before undergoing rigorous analysis. One of the first things Dan Boneh teaches in his Crypto I class is that you should think very long and hard before implementing your own cryptosystems (i.e. don&#x27;t do it), because getting it right is hard, and getting it even the slightest bit wrong tends to make it useless. And when you consider that people&#x27;s livelihoods (their personal information, their money) and even lives might be jeopardized, taking responsibility as an engineer becomes of paramount importance. Crypto just doesn&#x27;t lend itself to a &quot;build an MVP, get it working, move fast and break things&quot; mindset.
评论 #7596600 未加载
评论 #7596896 未加载
评论 #7596865 未加载
评论 #7596915 未加载
mtiabout 11 years ago
tptacek makes a number of good points but I find it hard to agree with this one:<p>&gt; there is concern that the NIST curves are backdoored and should be disfavored and replaced with Curve25519 and curves of similar construction.<p>Of course, &quot;there is concern&quot; is pretty vague, but it should be made clear that such concerns are in the realm of pure speculation at this point. There is simply no known way of constructing a &quot;backdoored&quot; elliptic curve of prime order over a prime field (in particular, the closest thing resembling such a backdoor, namely Teske&#x27;s key escrow technique based on isogenies from GHS-weak curves, cannot work over a prime field). Scientifically speaking, I don&#x27;t see more reasons to believe the assertion that &quot;NIST parameters are backdoored because they aren&#x27;t rigid&quot; than the (equally unfounded) speculation that &quot;Curve25519 may be weak because it has small parameters&#x2F;a special base field&#x2F;composite order&#x2F;etc.&quot;.<p>Moreover, to say that the NSA has backdoored the NIST curve parameters is to assume that they have known, for quite a long time now, a serious weakness affecting a significant fraction of all elliptic curves of prime order over a given base field that has so far escaped the scrutiny of all mathematicians and cryptographers not working for a TLA. Being leaps and bounds ahead of the academic community in an advanced, pure mathematical subject doesn&#x27;t quite align with what we know about NSA capabilities.<p>Don&#x27;t take this the wrong way: there <i>are</i> good reasons to favor Curve25519 and other implementation-friendly elliptic curves (namely, they are faster, and they are fewer ways of shooting yourself in the foot if you implement them), but &quot;NIST curves are backdoored&quot; is not a very serious one.
评论 #7597900 未加载
gojomoabout 11 years ago
Brutal but also in some ways a gift to the author&#x2F;publisher. Paired with the 1st edition, it cures the major defects.<p>And, if the criticisms can be addressed, in both specifics and perspective, for a future edition, they&#x27;ll have a hardened book... almost sure to earn another updated expert review (&quot;is it fixed?&quot;) at that time.
评论 #7597160 未加载
berdarioabout 11 years ago
Can someone explain me this?<p>&gt; In considering RSA, the book recommends &#x2F;dev&#x2F;random, despite having previously advised readers to avoid &#x2F;dev&#x2F;random in favor of &#x2F;dev&#x2F;urandom. The book was right the first time.<p>From &quot;man 4 urandom&quot;:<p>&gt; A read from the &#x2F;dev&#x2F;urandom device will not block waiting for more entropy. As a result, if there is not sufficient entropy in the entropy pool, the returned values are theoretically vulnerable to a cryptographic attack on the algorithms used by the driver.<p>In fact, using &#x2F;dev&#x2F;urandom is one of the causes of the creation of weak ssh key, found in this research: <a href="https://factorable.net/" rel="nofollow">https:&#x2F;&#x2F;factorable.net&#x2F;</a><p>So: Why is &#x2F;dev&#x2F;urandom the correct choice over &#x2F;dev&#x2F;random ?
评论 #7597548 未加载
mikeashabout 11 years ago
After I finished reading this review, I came to check out the HN comments knowing that the tone would be the subject of the top comments.<p>When did this community become more concerned with tone than correctness? The top of this thread is <i>filled</i> with people saying that the tone is bad, it&#x27;s unproductive, it&#x27;s unnecessary, etc. Yet nobody seems concerned about the published book filled with bad information that a lot of people are going to &quot;learn&quot; from. What gives?
评论 #7600890 未加载
评论 #7598922 未加载
评论 #7598805 未加载
jacquesmabout 11 years ago
I&#x27;ll take it on faith that Thomas really wrote this (it&#x27;s his style), but would the real Thomas &#x27;H&#x27; Ptacek please acknowledge that he indeed wrote this (it is labeled &#x27;anonymous&#x27;).
评论 #7596490 未加载
评论 #7596491 未加载
评论 #7596807 未加载
zurnabout 11 years ago
This is a good illustration of how, 1) crypto is hard 2) real-world cryptosystem design &amp; implementation is hard and 3) teaching the aforementioned is hard.<p>I read Schneier&#x27;s &amp; Ferguson&#x27;s Practical Cryptography years ago, the only thing I remember about it is the &quot;don&#x27;t try this at home&quot; message.
评论 #7596477 未加载
评论 #7596431 未加载
评论 #7596686 未加载
评论 #7600280 未加载
runn1ngabout 11 years ago
&gt; The book <i>actively recommends</i> public key cryptography, because of concerns about key distribution. Again: bad strategy. Cryptographers use public key crypto only when absolutely required. Most settings for cryptography don&#x27;t need it! Public key cryptography multiplies the number of things that can go wrong with your cryptosystem.<p>Can I ask why? What is so dangerous with asymmetric crypto compared to symmetric crypto?
评论 #7598161 未加载
评论 #7596796 未加载
评论 #7597137 未加载
评论 #7596942 未加载
laichzeit0about 11 years ago
Does Tptacek have a list of books&#x2F;articles he would recommend to the Crypto neophyte? I&#x27;m talking about books which could be considered de facto standards like Knuth&#x27;s TAOCP or Steven&#x27;s TCP&#x2F;IP books.
评论 #7596593 未加载
评论 #7597294 未加载
评论 #7596700 未加载
riffraffabout 11 years ago
can someone explain this?<p><pre><code> * This book, I am not making this up, contains the string: &quot;“We can use ASN.1 to make the format easier to parse&quot;. </code></pre> Last time I had something to do with ASN.1 was years ago but it seemed to work well, libraries were full featured and cross-language interop was ok. What am I missing that makes ASN.1 bad ?<p>Or is the critique to an attempt to write a custom ASN.1 serializer&#x2F;parser?
评论 #7596783 未加载
评论 #7596777 未加载
ff_about 11 years ago
This is the best feedback the author could receive: a violent but objective review of every weak spot. Well done.
VMGabout 11 years ago
Coursera&#x27;s &quot;Cryptography I&quot; pays off again -- I know most of the words!
评论 #7597161 未加载
oinksoftabout 11 years ago
The last paragraph of this review is in poor taste. The most cursory research into the author&#x27;s &quot;CryptoBox&quot; shows that indeed this project is <i>inspired</i> by NaCL.
评论 #7597029 未加载
feralchimpabout 11 years ago
This is a great review for two reasons:<p>a) it provides readers with a laundry list of things to go study independently<p>b) the book author can, given time and inclination, do the same study and improve the book
nkozyraabout 11 years ago
As someone finishing the final edits of a technical book (on Golang, at that) this is the kind of thing that horrifies me.<p>I want to go through every single chapter and rewrite it to stave off the imaginary critics in my head who will undoubtedly tear it apart.
评论 #7598060 未加载
raverbashingabout 11 years ago
Those with glass ceilings shouldn&#x27;t throw stones<p>While criticism is good, the condescending way it is presented, as well as being overly critical are bad. Example:<p>&quot;Total undue reverence for NIST and FIPS standards; for instance, the book recommends PBKDF2 over bcrypt and scrypt (amusingly: the book actually recommends <i>against</i> scrypt, which is too new for it) because it&#x27;s standardized.&quot;<p>I know people love scrypt and bcrypt, and have been proven safe <i>so far</i>, but there are advantages to use standardized methods. An implementation can make something less safe than the standard.
评论 #7597957 未加载
pronoiacabout 11 years ago
Reading this makes me think that the Go crypto primitives could use a lot more plumbing; it would make them more useful, and avoid some pitfalls by making it easier to do the right thing.
评论 #7600966 未加载
mac1175about 11 years ago
After reading this, could anyone recommend a good intro to crypto book? I see a lot of good reviews of Bruce Schneier&#x27;s Applied Cryptography.
评论 #7605990 未加载
obilgicabout 11 years ago
How do we know that this is written by tptacek?
评论 #7596557 未加载
uuid_to_stringabout 11 years ago
The author is a systems engineer at Cloudflare.
nichocharabout 11 years ago
I don&#x27;t think he liked the book
floatbothabout 11 years ago
&quot;S-&gt;C nonce, C-&gt;S HASH(pw, nonce), HEAD-&gt;DESK smash&quot; :D
solipsismabout 11 years ago
I wonder who the intended audience of this review is. The book is clearly geared toward beginners. It would seem a review of such a book should be geared toward those who might read it to learn about cryptography. This review is obviously geared toward some other audience, however. Otherwise a criticism like <i>The book writes its own Diffie-Hellman implementation and recommends it to readers</i> would be backed up and explained, instead of being expected to stand on its own.<p>Is the audience for this review intended to be cryptography experts, who would not read such a book except to praise or trash it? If that&#x27;s the case, it seems rather mean spirited. More &quot;wow check this loser out&quot; than &quot;I don&#x27;t recommend this book to beginners or anyone and here&#x27;s why.&quot;