module Digest::Instance

Public Instance Methods

base64digest(str = nil) click to toggle source

If none is given, returns the resulting hash value of the digest in a base64 encoded form, keeping the digest’s state.

If a string is given, returns the hash value for the given string in a base64 encoded form, resetting the digest to the initial state before and after the process.

In either case, the return value is properly padded with ‘=’ and contains no line feeds.

# File rake/lib/digest.rb, line 62
def base64digest(str = nil)
  [str ? digest(str) : digest].pack('m0')
end
base64digest!() click to toggle source

Returns the resulting hash value and resets the digest to the initial state.

# File rake/lib/digest.rb, line 68
def base64digest!
  [digest!].pack('m0')
end
file(name) click to toggle source

updates the digest with the contents of a given file name and returns self.

# File rake/lib/digest.rb, line 43
def file(name)
  File.open(name, "rb") {|f|
    buf = ""
    while f.read(16384, buf)
      update buf
    end
  }
  self
end