Sunday, October 19, 2014

Generating a token

I found a couple of ways to quickly generate a token for use with APIs. I needed a unique token for my Jenkins jobs and found these two useful.

r="";for e in $(seq 1 5); do r="${r}$(od -vAn -N4 -tu4 < /dev/urandom|sed 's| ||g')"; done;echo $r|openssl sha1 -sha256

d81697b6322a81a7fb19e0ef1141f534da0634244e76b5590332a1a186c7c4a9

r="";for e in $(seq 1 10); do r="$r${RANDOM}"; done; echo $r|openssl sha1 -sha256

No comments: