• Custom User Avatar

    I know it's just a kata, but something like this would make a much better password generator for use in the real world:

    def pwgen(base, sitename, length=12)
      salt = "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33" # must be kept secret
      Digest::SHA1.base64digest(base+sitename+salt)[1..length]
    end
    
    pwgen('secret', 'codewars') #=> "X+zJ2Kz2E6DY"
    pwgen('secret', 'facebook') #=> "6IH/OuqJrHl+"
    
  • Custom User Avatar

    Strange. I opened the page again and resubmitted without changes, and this time it worked! I hadn't seen any error messages...

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution