Alex Rivera | Logout

How to base64 encode /dev/random or /dev/urandom?

Asked 2009-08-08T23:33:32.193
48

cat /dev/urandom is always a fun way to create scrolling characters on your display, but produces too many non-printable characters.

Is there an easy way to encode it on the command-line in such a way that all of its output are readable characters, base64 or uuencode for example.

Note that I prefer solutions that require no additional files to be created.

Edit
Report

2 Answers

1

You can do more interesting stuff with BASH's FIFO pipes:

uuencode <(head -c 200 /dev/urandom | base64 | gzip)
answered 2009-08-09T22:08:22.730
-2

Try

xxd -ps /dev/urandom

xxd(1)

answered 2009-08-13T03:42:52.530

Your Answer