class CryptoconditionsRuby::Utils::Bytes
Attributes
bytes[R]
Public Class Methods
new(input)
click to toggle source
# File lib/cryptoconditions_ruby/utils/bytes.rb, line 4 def initialize(input) @bytes = input.is_a?(Array) ? input : input.bytes end
Public Instance Methods
to_i(base)
click to toggle source
# File lib/cryptoconditions_ruby/utils/bytes.rb, line 8 def to_i(base) bytes.reverse.each_with_index.inject(0) do |store, (byte, index)| store += byte * base**(index * 2) end end