Class: Ethereum::SpecialContract::RIPEMD160

Inherits:
Object
  • Object
show all
Defined in:
lib/ethereum/special_contract.rb

Instance Method Summary collapse

Instance Method Details

#call(ext, msg) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/ethereum/special_contract.rb', line 56

def call(ext, msg)
  gas_cost = Opcodes::GRIPEMD160BASE +
    (Utils.ceil32(msg.data.size) / 32) * Opcodes::GRIPEMD160WORD
  return 0, 0, [] if msg.gas < gas_cost

  d = msg.data.extract_all
  o = Utils.bytes_to_int_array Utils.zpad(Utils.ripemd160(d), 32)

  return 1, msg.gas - gas_cost, o
end