Module: CryptoHelper

Included in:
Contract
Defined in:
lib/rubysol/contract/crypto.rb

Overview

use a differet name? why? why not?

e.g CryptoFunctons or ...

Instance Method Summary collapse

Instance Method Details

#keccak256(input) ⇒ Object

fix-fix-fix - return a bytes32 type!!!!!!



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rubysol/contract/crypto.rb', line 14

def keccak256( input )
## todo/fix: check if input is binary string 
##    (convert to bytes - why? why not?)
##    should really always use hex_to_bin !!! 
##    and convert the result in the end only - why? why not??

  str = Types::String.new( input )

  ## fix: convert hexdigest to binary
  '0x' + Digest::KeccakLite.hexdigest( str.as_data, 256  )
end