class Ethereum::SpecialContract::SHA256

Public Instance Methods

call(ext, msg) click to toggle source
# File lib/ethereum/special_contract.rb, line 42
def call(ext, msg)
  gas_cost = Opcodes::GSHA256BASE +
    (Utils.ceil32(msg.data.size) / 32) * Opcodes::GSHA256WORD
  return 0, 0, [] if msg.gas < gas_cost

  d = msg.data.extract_all
  o = Utils.bytes_to_int_array Utils.sha256(d)

  return 1, msg.gas - gas_cost, o
end