def digest(algorithm,options={})
      digest_class = begin
                       Digest.const_get(algorithm.to_s.upcase)
                     rescue LoadError
                       raise(ArgumentError,"Unknown Digest algorithm #{algorithm}")
                     end

      hash = digest_class.new

      if options[:prepend_salt]
        hash << options[:prepend_salt].to_s
      end

      hash << self.clear_text

      if options[:append_salt]
        hash << options[:append_salt].to_s
      end

      return hash.hexdigest
    end
def digest(algorithm,options={})
      digest_class = begin
                       Digest.const_get(algorithm.to_s.upcase)
                     rescue LoadError
                       raise(ArgumentError,"Unknown Digest algorithm #{algorithm}")
                     end

      hash = digest_class.new

      if options[:prepend_salt]
        hash << options[:prepend_salt].to_s
      end

      hash << self.clear_text

      if options[:append_salt]
        hash << options[:append_salt].to_s
      end

      return hash.hexdigest
    end
Hashes the password.

 @param [Symbol, String] algorithm
   The digest algorithm to use.

 @param [Hash] options
   Additional options.

 @option options [String] :prepend_salt
   The salt data to prepend to the password.

 @option options [String] :append_salt
   The salt data to append to the password.

 @return [String]
   The hex-digest of the hashed password.

 @raise [ArgumentError]
   Unknown Digest algorithm.

 @example
   pass = Password.new(:clear_text => 'secret')

   pass.digest(:sha1)
   # => "e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4"

   pass.digest(:sha1, :prepend_salt => "A\x90\x00")
   # => "e2817656a48c49f24839ccf9295b389d8f985904"

   pass.digest(:sha1, :append_salt => "BBBB")
   # => "aa6ca21e446d425fc044bbb26e950a788444a5b8"

 @since 1.0.0

 @api public