Encrypt passwords with the Dynarex-password gem

I have been using the Dynarex-password gem to encrypt my passwords for several years now. Here's how it works:

  1. Basically a lookup file is generated containing 1 or 2 random alphanumerical characters which are mapped to each letter of the alphabet.
  2. Supply a weak password (e.g. secret1) and it will return the associated random character(s) for each character in your password.
  3. To decipher the strong password the script looks up the character associated with the random character(s).

Example

require 'dynarex-password'

file = 'lookup.xml'

dp = DynarexPassword.new
dp.generate_lookup(fixed_size: 2)
dp.save 'lookup.xml'

dp.lookup('secret1', file) #=> "gozyCR1lzyUmKQ"
dp.reverse_lookup("gozyCR1lzyUmKQ", file) #=> secret1

Note: If a lookup file is generated without a fixed size, then a reverse lookup isn't possible.

Resources