Network programming with Go (2012)
I was immediately concerned seeing a &quot;Security&quot; section that includes a &quot;Public key encryption&quot; chapter. And indeed, I was (not) disappointed.<p>The symmetric encryption section mentions only Blowfish (!? - not even in the stdlib) and DES (!! - not even 3DES), not AES. There is of course no mention of authentication, or AEADs. But it gets worse. The API presented is Cipher.Encrypt which is CATASTROPHIC. Cipher.Encrypt is a <i>low-low-level</i> API that only encrypts the first block worth of data, AND LEAVES THE REST UNENCRYPTED. It&#x27;s meant to be used by CBC&#x2F;CTR&#x2F;GCM block mode implementations, of which there is no mention at all.<p>This is all it says about, you know, encrypting real data:<p>&gt; The algorithms are block algorithms. That is they work on blocks of data. If your data is not aligned to the block size, then you will have to pad it with extra blanks at the end.<p>This is the kind of advice which guarantees me a job forever. It&#x27;s way worse than ECB.<p>The &quot;Data integrity&quot; section mentions MD4 (for which I can and did create a collision on my laptop in a few hundred lines of code) and recommends the broken MD5, converting the result into 4 uint32 for... some reason? It then calls HMAC a &quot;variation&quot; of a hash, while it&#x27;s a completely different (and more useful) tool.<p>The public key chapter only mentions RSA, which is completely useless&#x2F;dangerous on its own, and probably not what you should use in 2017, and offers a code snippet to generate a 512 bit key. 512. The stuff that academics break for fun.<p>The X.509 chapter makes a CA cert instead of a leaf.<p>The TLS section needlessly sets config.Rand and sets config.Time TO A FIXED VALUE, which off the top of my head <i>might</i> only break connections after a few minutes and not their security. Maybe. (And uses a funny &quot;[0:]&quot; with a needless 0, which I guess is a C-ism.)<p>&gt; Security is a huge area in itself, and in this chapter we have barely touched on it. However, the major concepts have been covered.<p>The whole section should just have been a link to <a href="https:&#x2F;&#x2F;github.com&#x2F;gtank&#x2F;cryptopasta" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gtank&#x2F;cryptopasta</a> not to be harmful, but as it is, it is actively toxic.<p>I&#x27;m not saying anything about the quality of the rest of the book, but if you write a book on X where X != cryptography, please don&#x27;t try to teach the user how to use cryptography. Or how to secure a gun.