Sha256: a602fcec736e5380e7eeaadc348d1e1ca7b4cd61d3fbeb2e34243e91702fd6bf
Contents?: true
Size: 309 Bytes
Versions: 2
Compression:
Stored size: 309 Bytes
Contents
class CryptoconditionsRuby::Utils::Bytes attr_reader :bytes private :bytes def initialize(input) @bytes = input.is_a?(Array) ? input : input.bytes end def to_i(base) bytes.reverse.each_with_index.inject(0) do |store, (byte, index)| store += byte * base**(index * 2) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cryptoconditions_ruby-0.5.2 | lib/cryptoconditions_ruby/utils/bytes.rb |
cryptoconditions_ruby-0.5.1 | lib/cryptoconditions_ruby/utils/bytes.rb |