HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
gtank
cryptopasta
Go2016–2017
gtank / cryptopasta

cryptopasta

copy & paste-friendly golang crypto

2Distinct people
6Mentions
0Explicit recommenders
1.8KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

copy & paste-friendly golang crypto

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by week6 dated mentions

Observed mentions: 2016-07-16 06:06:48 UTC to 2017-02-04 14:23:39 UTC. Weeks start Monday, UTC.

012342016-07-11 00:00:00 UTC to 2016-07-18 00:00:00 UTC (exclusive): 4 mentions; 2 submissions, 2 commentsJul 112016-07-18 00:00:00 UTC to 2016-07-25 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-07-25 00:00:00 UTC to 2016-08-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-08-01 00:00:00 UTC to 2016-08-08 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-08-08 00:00:00 UTC to 2016-08-15 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-08-15 00:00:00 UTC to 2016-08-22 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-08-22 00:00:00 UTC to 2016-08-29 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-08-29 00:00:00 UTC to 2016-09-05 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-09-05 00:00:00 UTC to 2016-09-12 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-09-12 00:00:00 UTC to 2016-09-19 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-09-19 00:00:00 UTC to 2016-09-26 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-09-26 00:00:00 UTC to 2016-10-03 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-10-03 00:00:00 UTC to 2016-10-10 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-10-10 00:00:00 UTC to 2016-10-17 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-10-17 00:00:00 UTC to 2016-10-24 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsOct 172016-10-24 00:00:00 UTC to 2016-10-31 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-10-31 00:00:00 UTC to 2016-11-07 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-11-07 00:00:00 UTC to 2016-11-14 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-11-14 00:00:00 UTC to 2016-11-21 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-11-21 00:00:00 UTC to 2016-11-28 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-11-28 00:00:00 UTC to 2016-12-05 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-05 00:00:00 UTC to 2016-12-12 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-12 00:00:00 UTC to 2016-12-19 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-19 00:00:00 UTC to 2016-12-26 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-26 00:00:00 UTC to 2017-01-02 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-02 00:00:00 UTC to 2017-01-09 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-09 00:00:00 UTC to 2017-01-16 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-16 00:00:00 UTC to 2017-01-23 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-23 00:00:00 UTC to 2017-01-30 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-30 00:00:00 UTC to 2017-02-06 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsJan 30

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Jul 112016-07-11 00:00:00 UTC2016-07-18 00:00:00 UTC422
Jul 182016-07-18 00:00:00 UTC2016-07-25 00:00:00 UTC000
Jul 252016-07-25 00:00:00 UTC2016-08-01 00:00:00 UTC000
Aug 12016-08-01 00:00:00 UTC2016-08-08 00:00:00 UTC000
Aug 82016-08-08 00:00:00 UTC2016-08-15 00:00:00 UTC000
Aug 152016-08-15 00:00:00 UTC2016-08-22 00:00:00 UTC101
Aug 222016-08-22 00:00:00 UTC2016-08-29 00:00:00 UTC000
Aug 292016-08-29 00:00:00 UTC2016-09-05 00:00:00 UTC000
Sep 52016-09-05 00:00:00 UTC2016-09-12 00:00:00 UTC000
Sep 122016-09-12 00:00:00 UTC2016-09-19 00:00:00 UTC000
Sep 192016-09-19 00:00:00 UTC2016-09-26 00:00:00 UTC000
Sep 262016-09-26 00:00:00 UTC2016-10-03 00:00:00 UTC000
Oct 32016-10-03 00:00:00 UTC2016-10-10 00:00:00 UTC000
Oct 102016-10-10 00:00:00 UTC2016-10-17 00:00:00 UTC000
Oct 172016-10-17 00:00:00 UTC2016-10-24 00:00:00 UTC000
Oct 242016-10-24 00:00:00 UTC2016-10-31 00:00:00 UTC000
Oct 312016-10-31 00:00:00 UTC2016-11-07 00:00:00 UTC000
Nov 72016-11-07 00:00:00 UTC2016-11-14 00:00:00 UTC000
Nov 142016-11-14 00:00:00 UTC2016-11-21 00:00:00 UTC000
Nov 212016-11-21 00:00:00 UTC2016-11-28 00:00:00 UTC000
Nov 282016-11-28 00:00:00 UTC2016-12-05 00:00:00 UTC000
Dec 52016-12-05 00:00:00 UTC2016-12-12 00:00:00 UTC000
Dec 122016-12-12 00:00:00 UTC2016-12-19 00:00:00 UTC000
Dec 192016-12-19 00:00:00 UTC2016-12-26 00:00:00 UTC000
Dec 262016-12-26 00:00:00 UTC2017-01-02 00:00:00 UTC000
Jan 22017-01-02 00:00:00 UTC2017-01-09 00:00:00 UTC000
Jan 92017-01-09 00:00:00 UTC2017-01-16 00:00:00 UTC000
Jan 162017-01-16 00:00:00 UTC2017-01-23 00:00:00 UTC000
Jan 232017-01-23 00:00:00 UTC2017-01-30 00:00:00 UTC000
Jan 302017-01-30 00:00:00 UTC2017-02-06 00:00:00 UTC101

What Hacker News says

6 sources
I was immediately concerned seeing a "Security" section that includes a "Public key encryption" chapter. And indeed, I was (not) disappointed. 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 low-low-level API that only encrypts the first block worth of data, AND LEAVES THE REST UNENCRYPTED. It's meant to be used by CBC/CTR/GCM block mode implementations, of which there is no mention at all. This is all it says about, you know, encrypting real data: > 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
Read the rest
blanks at the end. This is the kind of advice which guarantees me a job forever. It's way worse than ECB. The "Data integrity" 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 "variation" of a hash, while it's a completely different (and more useful) tool. The public key chapter only mentions RSA, which is completely useless/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. The X.509 chapter makes a CA cert instead of a leaf. The TLS section needlessly sets config.Rand and sets config.Time TO A FIXED VALUE, which off the top of my head might only break connections after a few minutes and not their security. Maybe. (And uses a funny "[0:]" with a needless 0, which I guess is a C-ism.) > Security is a huge area in itself, and in this chapter we have barely touched on it. However, the major concepts have been covered. The whole section should just have been a link to https://github.com/gtank/cryptopasta not to be harmful, but as it is, it is actively toxic. I'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't try to teach the user how to use cryptography. Or how to secure a gun.
In Network programming with Go (2012)
Wait. Stop. You are writing your own crypto. AES keys are 256 (or 128) bit, fixed size, and should be random-looking data. The code here uses [32]byte intentionally so you won't use anything else. If you have a password instead, that is NOT suitable for use as a key directly, whichever the length, because it has low entropy by definition. So you want to stretch it (and whiten it) with something like scrypt. It's a bit of the same argument as password hashing. Also, you don't want to discover what happens if you have strong patterns like padding in your key (it should be fine, but it's the kind of attacks that come before a full break). And you don't want to cut short a password longer than 32 characters. This is the issue, btw: https://github.com/gtank/cryptopasta/issues/7 Don't copy-paste crypto from HN.
In Copy and paste-friendly Go crypto

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.