def salted_hash(password)
      salt   = SecureRandom.random_bytes(SALT_BYTE_SIZE)
      pbkdf2 = OpenSSL::PKCS5::pbkdf2_hmac_sha1(
                 password, salt, CRYPTERATIONS, HASH_BYTE_SIZE
               )

      { salt: salt, pbkdf2: Base64.encode64(pbkdf2) }
    end
def salted_hash(password)
      salt   = SecureRandom.random_bytes(SALT_BYTE_SIZE)
      pbkdf2 = OpenSSL::PKCS5::pbkdf2_hmac_sha1(
                 password, salt, CRYPTERATIONS, HASH_BYTE_SIZE
               )

      { salt: salt, pbkdf2: Base64.encode64(pbkdf2) }
    end
Generates a special hash known as a SPASH, a PBKDF2-HMAC-SHA1 Salted
 Password Hash for safekeeping.

 @param [String] password
   A password to generating the SPASH, salted password hash.

 @return [Hash]
   `:salt` contains the unique salt used, `:pbkdf2` contains the password
   hash. Save both the salt and the hash together.

 @see Garcon::Crypto#validate_salt

 @api public