Module: Cryptos::Utils::Hashes

Included in:
Address, Address, Der, Input, Script, Transaction
Defined in:
lib/cryptos/utils/hashes.rb

Instance Method Summary collapse

Instance Method Details

#hash160(data) ⇒ Object



14
15
16
17
# File 'lib/cryptos/utils/hashes.rb', line 14

def hash160(data)
  sha256 = Digest::SHA256.digest([data].pack('H*'))
  Digest::RMD160.hexdigest sha256
end

#hash256(data) ⇒ Object



19
20
21
22
# File 'lib/cryptos/utils/hashes.rb', line 19

def hash256(data)
  sha256 = Digest::SHA256.digest([data].pack('H*'))
  Digest::SHA256.hexdigest sha256
end

#ripemd160(data) ⇒ Object



10
11
12
# File 'lib/cryptos/utils/hashes.rb', line 10

def ripemd160(data)
  Digest::RMD160.hexdigest([data].pack('H*'))
end

#sha256(data) ⇒ Object



6
7
8
# File 'lib/cryptos/utils/hashes.rb', line 6

def sha256(data)
  Digest::SHA256.hexdigest([data].pack('H*'))
end