Sha256: ab69559480c5148758b1ddbcf57fe800862ea91643ecf6f8f6ed4d88a2a028f6
Contents?: true
Size: 619 Bytes
Versions: 3
Compression:
Stored size: 619 Bytes
Contents
module BTC # Transaction ID <-> Transaction Hash conversion # Block ID <-> Block Hash conversion # Converts string transaction or block ID into binary hash. def self.hash_from_id(identifier) return nil if !identifier # so we can convert optional ID into optional hash without extra headache BTC::Data.data_from_hex(identifier).reverse end # Converts binary hash to hex identifier (as a big-endian 256-bit integer). def self.id_from_hash(hash) return nil if !hash # so we can convert optional hash into optional ID without extra headache BTC::Data.hex_from_data(hash.reverse) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
btcruby-1.0.2 | lib/btcruby/hash_id.rb |
btcruby-1.0.1 | lib/btcruby/hash_id.rb |
btcruby-1.0.0 | lib/btcruby/hash_id.rb |