Class: Faker::Bitcoin
Constant Summary
Constants inherited from Base
Faker::Base::Letters, Faker::Base::Numbers, Faker::Base::ULetters
Class Method Summary collapse
Methods inherited from Base
bothify, fetch, flexible, letterify, method_missing, numerify, parse, rand_in_range, regexify, translate
Class Method Details
.address ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/faker/bitcoin.rb', line 8 def address hash = SecureRandom.hex(20) version = 0 packed = version.chr + [hash].pack("H*") checksum = Digest::SHA2.digest(Digest::SHA2.digest(packed))[0..3] base58(packed + checksum) end |