Sha256: 7bb48ed38f0fc049da36ab058121854654026448f08c4a609f16094e7c6ff12e
Contents?: true
Size: 793 Bytes
Versions: 4
Compression:
Stored size: 793 Bytes
Contents
require "digest/md5" require "digest/sha1" require "digest/sha2" class MonetDB class Hasher def initialize(method, pwd) case method.upcase when "SHA1" @hashfunc = Digest::SHA1.new @hashname = method.upcase when "SHA256" @hashfunc = Digest::SHA256.new @hashname = method.upcase when "SHA384" @hashfunc = Digest::SHA384.new @hashname = method.upcase when "SHA512" @hashfunc = Digest::SHA512.new @hashname = method.upcase else @hashfunc = Digest::MD5.new @hashname = "MD5" end @pwd = pwd end # Returns the hash method def hashname @hashname end # Compute hash code def hashsum @hashfunc.hexdigest(@pwd) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
monetdb-0.1.3 | lib/monetdb/hasher.rb |
monetdb-0.1.2 | lib/monetdb/hasher.rb |
monetdb-0.1.1 | lib/monetdb/hasher.rb |
monetdb-0.1.0 | lib/monetdb/hasher.rb |