class Apullo::Hash

Attributes

data[R]

Public Class Methods

new(data) click to toggle source
# File lib/apullo/hash.rb, line 10
def initialize(data)
  @data = data
end

Public Instance Methods

md5() click to toggle source
# File lib/apullo/hash.rb, line 22
def md5
  Digest::MD5.hexdigest data
end
mmh3() click to toggle source
# File lib/apullo/hash.rb, line 26
def mmh3
  hash = MurmurHash3::V32.str_hash(data)
  if (hash & 0x80000000).zero?
    hash
  else
    -((hash ^ 0xFFFFFFFF) + 1)
  end
end
sha1() click to toggle source
# File lib/apullo/hash.rb, line 14
def sha1
  Digest::SHA1.hexdigest data
end
sha256() click to toggle source
# File lib/apullo/hash.rb, line 18
def sha256
  Digest::SHA256.hexdigest data
end