Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Generate shorter tokens
Browse files Browse the repository at this point in the history
Following on from @paulfurley's great change to /dev/urandom in
b4eafed, I've implemented @robyoung's
comment on #262 to shorten the token length to 64 characters.

I've also increased the characters included from a-f0-9 to a-zA-Z0-9.

I don't really want to make big assertions about cryptography, but
this has reduced the key space from 10^154 to 10^114, so I think
we're probably still ok.
  • Loading branch information
alexmuller committed Apr 9, 2014
1 parent 673a177 commit 1fa2396
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/generate-token.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/bash

#
# Generate a random token
# Generate a random token
#

head -c 500 /dev/urandom | shasum -a 512
# LC_CTYPE=C is specified for OS X, as otherwise tr will return
# an illegal byte sequence from assuming /dev/urandom is UTF-8

cat /dev/urandom | LC_CTYPE=C tr -cd 'a-zA-Z0-9' | head -c 64

echo '' # Add a newline

0 comments on commit 1fa2396

Please sign in to comment.