Generate a strong secret from the shell

Updated . Posted . Visible to the public.

A good tool to generate strong passwords and secrets is "apg". You can get it with

sudo apt-get install apg

To create a strong secret for sessions, hashed Paperclip paths, etc. say

apg -m128 -a1 -E\'\"

Arguments explained:

  • The -m parameter defines the secret length
  • -a1 makes apg choose from all 7-bit ASCII characters instead of just the alphabet
  • -E\'\" excludes quote characters so you can easily paste the secret into a Ruby string
Profile picture of Henning Koch
Henning Koch
Last edit
Keywords
console, passphrase, generator
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2010-09-30 12:28)