bech32 1.0.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/main.yml +35 -0
- data/.ruby-version +1 -1
- data/README.md +39 -3
- data/bech32.gemspec +14 -12
- data/exe/bech32 +31 -0
- data/lib/bech32.rb +32 -14
- data/lib/bech32/segwit_addr.rb +7 -4
- data/lib/bech32/version.rb +5 -0
- metadata +27 -11
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1556fd0046c912f798c99efd7162f3afc6ca970d618d0ba44dd38c05ab88de75
|
4
|
+
data.tar.gz: fc267a9f2e3344f11f692f7749666ba099a5f5fd73326271c412bc1000fe8616
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21045a72a45ddf3640801ed9845fa61e758a6199cf492f64cee355bec019f5f0e0a62696e6061aa3479c30d6e566c3e63663f3c8a9838b1bc2ba0e860265f335
|
7
|
+
data.tar.gz: cfb2828365abd683dfeb0af311a583661cd2bc95d0c5af65a09f0d3b5d8cf38215cd95552f903667e4589764030b6a1da65473bc11f762262c63936a72340699
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
22
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
- name: Set up Ruby
|
27
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
28
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
+
# uses: ruby/setup-ruby@v1
|
30
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
+
- name: Run tests
|
35
|
+
run: bundle exec rake
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
ruby-3.0.0
|
data/README.md
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
# Bech32 [![Build Status](https://travis-ci.org/azuchi/bech32rb.svg?branch=master)](https://travis-ci.org/azuchi/bech32rb) [![Gem Version](https://badge.fury.io/rb/bech32.svg)](https://badge.fury.io/rb/bech32) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE) <img src="http://segwit.co/static/public/images/logo.png" width="100">
|
2
2
|
|
3
|
-
The implementation of the Bech32 encoder and decoder for Ruby.
|
3
|
+
The implementation of the Bech32/Bech32m encoder and decoder for Ruby.
|
4
4
|
|
5
5
|
Bech32 is checksummed base32 format that is used in following Bitcoin address format.
|
6
6
|
|
7
7
|
https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki
|
8
8
|
|
9
|
+
Bech32m is checksummed base32m format that is used in following Bitcoin address format.
|
10
|
+
|
11
|
+
https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki
|
12
|
+
|
9
13
|
## Installation
|
10
14
|
|
11
15
|
Add this line to your application's Gemfile:
|
@@ -35,13 +39,15 @@ require 'bech32'
|
|
35
39
|
Decode Bech32-encoded data into hrp part and data part.
|
36
40
|
|
37
41
|
```ruby
|
38
|
-
hrp, data = Bech32.decode('BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4')
|
42
|
+
hrp, data, spec = Bech32.decode('BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4')
|
39
43
|
|
40
44
|
# hrp is human-readable part of Bech32 format
|
41
45
|
'bc'
|
42
46
|
|
43
47
|
# data is data part of Bech32 format
|
44
48
|
[0, 14, 20, 15, 7, 13, 26, 0, 25, 18, 6, 11, 13, 8, 21, 4, 20, 3, 17, 2, 29, 3, 12, 29, 3, 4, 15, 24, 20, 6, 14, 30, 22]
|
49
|
+
|
50
|
+
# spec is whether Bech32::Encoding::BECH32 or Bech32::Encoding::BECH32M
|
45
51
|
```
|
46
52
|
|
47
53
|
Decode Bech32-encoded Segwit address into `Bech32::SegwitAddr` instance.
|
@@ -55,6 +61,20 @@ segwit_addr.to_script_pubkey
|
|
55
61
|
=> 0014751e76e8199196d454941c45d1b3a323f1433bd6
|
56
62
|
```
|
57
63
|
|
64
|
+
#### Advanced
|
65
|
+
|
66
|
+
The maximum number of characters of Bech32 defined in [BIP-173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki) is limited to 90 characters.
|
67
|
+
However, LN specification [BOLT#11](https://github.com/lightningnetwork/lightning-rfc/blob/master/11-payment-encoding.md) has no limitation.
|
68
|
+
|
69
|
+
To decode data of more than 90 characters, specify `max_length` at decode as below. (The default value of `max_length` is 90.)
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
MAX_INTEGER = 2**31 - 1
|
73
|
+
Bech32.decode(bechString, MAX_INTEGER)
|
74
|
+
```
|
75
|
+
|
76
|
+
Note that between length of the addresses and the error-detection capabilities are [trade-off](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#checksum-design).
|
77
|
+
|
58
78
|
### Encode
|
59
79
|
|
60
80
|
Encode Bech32 human-readable part and data part into Bech32 string.
|
@@ -63,7 +83,7 @@ Encode Bech32 human-readable part and data part into Bech32 string.
|
|
63
83
|
hrp = 'bc'
|
64
84
|
data = [0, 14, 20, 15, 7, 13, 26, 0, 25, 18, 6, 11, 13, 8, 21, 4, 20, 3, 17, 2, 29, 3, 12, 29, 3, 4, 15, 24, 20, 6, 14, 30, 22]
|
65
85
|
|
66
|
-
bech = Bech32.encode(hrp, data)
|
86
|
+
bech = Bech32.encode(hrp, data, Bech32::Encoding::BECH32)
|
67
87
|
=> bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4
|
68
88
|
```
|
69
89
|
|
@@ -78,6 +98,22 @@ segwit_addr.addr
|
|
78
98
|
=> bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4
|
79
99
|
```
|
80
100
|
|
101
|
+
### CLI
|
102
|
+
|
103
|
+
After installing the gem, the `bech32` command will be available. Encoding and decoding features are also available in the cli.
|
104
|
+
|
105
|
+
#### Encode
|
106
|
+
|
107
|
+
$ bech32 encode genesis 000409190707111719041a120308120a060c161408110d091b090009021b1e1d150e190215010d0a1603091e1f0b100609090d1a1c1a13030c120c0c0f1c020d1d1a0e170b1c17021018121e0a021c121a1c0d161b16131d1609130f1d13180f1e081d041d0a110f110d1313081c11100600180b000c08140c1e130e0f090c160e0018191e1d1c0016060c11101214121e19070d1a0c1c15020414001f10100c09090600181806001809080e180507021913031100030216141b100908160c1213120f1912011f07021c13190d1900170c1d1203040f071c1908050504130e080d0a100d130b03000a0a08191310090918120f11031104120c15180c15120a0f1919070c1c12060c1911091010120a0d191b040c1613020e1911081f000b1a0b0514150c1613010d0c1c030b17011805090119061e0b051e130c00030419000112030110181d011a000f020c0901080c1113060201041a0e1b060a15160506181c11140c1c1d0b1b14020c131e0b0f071519181e0b1f0e0a08170f1d0c05060e1c1b0e160c0f0a171d0b101a1a1f1417160e0d1414030e161b0a000709100d15020c000e010c00000000 bech32
|
108
|
+
genesis1qyfe883hey6jrgj2xvk5g3dfmfqfzm7a4wez4pd2krf7ltsxffd6u6nrvjvv0uzda6whtuhzscj72zuj6udkmknakfn0anc07gaya2303dnngu3sxqctqvg5v7nw0fvkwqce7auqkxv3sj5j7e8d6vu4zy5qlssvffxqccxqcfgwc98zenr3qrzk5msfgkvjnj0ejpl8zunedeqhvajry08ueg99ynwgd2sdntrq22gensffcj03r3yjv4cv4j20ee8vujxve3fssj2demyvknzwe3glqt6t954vknpdvurthpc9fpex7t97nvqryeqpjrpscap6q0zvfpgv3nxzpy6wmx24k9xcu35vuatm5zvn7t084ec7tlw2gh0av9xwumwkv02hats66l5hkwd55rwkm2q8fsd4zvqwpvqqqqtdc6rp
|
109
|
+
|
110
|
+
# Decode
|
111
|
+
|
112
|
+
$ bech32 decode genesis1qyfe883hey6jrgj2xvk5g3dfmfqfzm7a4wez4pd2krf7ltsxffd6u6nrvjvv0uzda6whtuhzscj72zuj6udkmknakfn0anc07gaya2303dnngu3sxqctqvg5v7nw0fvkwqce7auqkxv3sj5j7e8d6vu4zy5qlssvffxqccxqcfgwc98zenr3qrzk5msfgkvjnj0ejpl8zunedeqhvajry08ueg99ynwgd2sdntrq22gensffcj03r3yjv4cv4j20ee8vujxve3fssj2demyvknzwe3glqt6t954vknpdvurthpc9fpex7t97nvqryeqpjrpscap6q0zvfpgv3nxzpy6wmx24k9xcu35vuatm5zvn7t084ec7tlw2gh0av9xwumwkv02hats66l5hkwd55rwkm2q8fsd4zvqwpvqqqqtdc6rp
|
113
|
+
HRP: genesis
|
114
|
+
DATA: 000409190707111719041a120308120a060c161408110d091b090009021b1e1d150e190215010d0a1603091e1f0b100609090d1a1c1a13030c120c0c0f1c020d1d1a0e170b1c17021018121e0a021c121a1c0d161b16131d1609130f1d13180f1e081d041d0a110f110d1313081c11100600180b000c08140c1e130e0f090c160e0018191e1d1c0016060c11101214121e19070d1a0c1c15020414001f10100c09090600181806001809080e180507021913031100030216141b100908160c1213120f1912011f07021c13190d1900170c1d1203040f071c1908050504130e080d0a100d130b03000a0a08191310090918120f11031104120c15180c15120a0f1919070c1c12060c1911091010120a0d191b040c1613020e1911081f000b1a0b0514150c1613010d0c1c030b17011805090119061e0b051e130c00030419000112030110181d011a000f020c0901080c1113060201041a0e1b060a15160506181c11140c1c1d0b1b14020c131e0b0f071519181e0b1f0e0a08170f1d0c05060e1c1b0e160c0f0a171d0b101a1a1f1417160e0d1414030e161b0a000709100d15020c000e010c00000000
|
115
|
+
TYPE: bech32
|
116
|
+
|
81
117
|
## License
|
82
118
|
|
83
119
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/bech32.gemspec
CHANGED
@@ -1,23 +1,25 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bech32/version'
|
4
5
|
|
5
6
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
7
|
-
spec.version =
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
7
|
+
spec.name = 'bech32'
|
8
|
+
spec.version = Bech32::VERSION
|
9
|
+
spec.authors = ['Shigeyuki Azuchi']
|
10
|
+
spec.email = ['techmedia.think@gmail.com']
|
10
11
|
|
11
|
-
spec.summary = %q
|
12
|
-
spec.description = %q
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
12
|
+
spec.summary = %q(The implementation of Bech32 encoder and decoder.)
|
13
|
+
spec.description = %q(The implementation of Bech32 encoder and decoder.)
|
14
|
+
spec.homepage = 'https://github.com/azuchi/bech32rb'
|
15
|
+
spec.license = 'MIT'
|
15
16
|
|
16
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
18
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
spec.add_runtime_dependency 'thor', '>= 1.1.0'
|
20
22
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
23
25
|
end
|
data/exe/bech32
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bech32'
|
4
|
+
require 'thor'
|
5
|
+
|
6
|
+
class CLI < Thor
|
7
|
+
|
8
|
+
desc 'encode hrp data bech32/bech32m', 'Encoding data to bech32/bech32m string.'
|
9
|
+
def encode(hrp, data, type)
|
10
|
+
if type && !['bech32', 'bech32m'].include?(type)
|
11
|
+
puts 'Invalid type value. type must be bech32 or bech32m.'
|
12
|
+
else
|
13
|
+
spec = type.nil? || type == 'bech32' ? 1 : 2
|
14
|
+
data = [data].pack('H*').unpack('C*')
|
15
|
+
puts Bech32.encode(hrp, data, spec)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'decode "bech32string"', 'Decoding bech32/bech32m string.'
|
20
|
+
def decode(bech32_str)
|
21
|
+
bech32 = Bech32.decode(bech32_str, bech32_str.length)
|
22
|
+
puts <<~EOS
|
23
|
+
HRP: #{bech32[0]}
|
24
|
+
DATA: #{bech32[1].pack('C*').unpack1('H*')}
|
25
|
+
TYPE: #{bech32[2] == Bech32::Encoding::BECH32 ? 'bech32' : 'bech32m'}
|
26
|
+
EOS
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
CLI.start(ARGV)
|
data/lib/bech32.rb
CHANGED
@@ -1,66 +1,84 @@
|
|
1
1
|
module Bech32
|
2
2
|
|
3
|
+
module Encoding
|
4
|
+
BECH32 = 1
|
5
|
+
BECH32M = 2
|
6
|
+
end
|
7
|
+
|
3
8
|
autoload :SegwitAddr, 'bech32/segwit_addr'
|
4
9
|
|
5
10
|
SEPARATOR = '1'
|
6
11
|
|
7
12
|
CHARSET = %w(q p z r y 9 x 8 g f 2 t v d w 0 s 3 j n 5 4 k h c e 6 m u a 7 l)
|
8
13
|
|
14
|
+
BECH32M_CONST = 0x2bc830a3
|
15
|
+
|
9
16
|
module_function
|
10
17
|
|
11
18
|
# Returns the encoded Bech32 string.
|
12
19
|
#
|
13
20
|
# require 'bech32'
|
14
21
|
#
|
15
|
-
# bech = Bech32.encode('bc', [])
|
22
|
+
# bech = Bech32.encode('bc', [], Bech32::Encoding::BECH32)
|
16
23
|
#
|
17
24
|
# <i>Generates:</i>
|
18
25
|
# 'BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4' # bech
|
19
26
|
#
|
20
|
-
def encode(hrp, data)
|
21
|
-
checksummed = data + create_checksum(hrp, data)
|
27
|
+
def encode(hrp, data, spec)
|
28
|
+
checksummed = data + create_checksum(hrp, data, spec)
|
22
29
|
hrp + SEPARATOR + checksummed.map{|i|CHARSET[i]}.join
|
23
30
|
end
|
24
31
|
|
25
|
-
# Returns the
|
32
|
+
# Returns the Bech32 decoded hrp and data.
|
26
33
|
#
|
27
34
|
# require 'bech32'
|
28
35
|
#
|
29
36
|
# addr = 'BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4'
|
30
|
-
# hrp, data = Bech32.decode(addr)
|
37
|
+
# hrp, data, spec = Bech32.decode(addr)
|
31
38
|
#
|
32
39
|
# <i>Generates:</i>
|
33
40
|
# 'bc' # hrp
|
34
41
|
# [0, 14, 20, 15, 7, 13, 26, 0, 25, 18, 6, 11, 13, 8, 21, 4, 20, 3, 17, 2, 29, 3, 12, 29, 3, 4, 15, 24, 20, 6, 14, 30, 22] # data
|
42
|
+
# 1 # spec see Bech32::Encoding
|
35
43
|
#
|
36
|
-
def decode(bech)
|
44
|
+
def decode(bech, max_length = 90)
|
37
45
|
# check uppercase/lowercase
|
46
|
+
return nil if bech.bytes.index{|x| x < 33 || x > 126}
|
38
47
|
return nil if (bech.downcase != bech && bech.upcase != bech)
|
39
|
-
bech.each_char{|c|return nil if c.ord < 33 || c.ord > 126}
|
40
48
|
bech = bech.downcase
|
41
49
|
# check data length
|
42
50
|
pos = bech.rindex(SEPARATOR)
|
43
|
-
return nil if pos.nil? || pos + 7 > bech.length || bech.length >
|
51
|
+
return nil if pos.nil? || pos + 7 > bech.length || bech.length > max_length
|
44
52
|
# check valid charset
|
45
53
|
bech[pos+1..-1].each_char{|c|return nil unless CHARSET.include?(c)}
|
46
54
|
# split hrp and data
|
47
55
|
hrp = bech[0..pos-1]
|
48
56
|
data = bech[pos+1..-1].each_char.map{|c|CHARSET.index(c)}
|
49
57
|
# check checksum
|
50
|
-
|
51
|
-
[hrp, data[0..-7]]
|
58
|
+
spec = verify_checksum(hrp, data)
|
59
|
+
spec ? [hrp, data[0..-7], spec] : nil
|
52
60
|
end
|
53
61
|
|
54
62
|
# Returns computed checksum values of +hrp+ and +data+
|
55
|
-
def create_checksum(hrp, data)
|
63
|
+
def create_checksum(hrp, data, spec)
|
56
64
|
values = expand_hrp(hrp) + data
|
57
|
-
|
65
|
+
const = (spec == Bech32::Encoding::BECH32M ? Bech32::BECH32M_CONST : 1)
|
66
|
+
polymod = polymod(values + [0, 0, 0, 0, 0, 0]) ^ const
|
58
67
|
(0..5).map{|i|(polymod >> 5 * (5 - i)) & 31}
|
59
68
|
end
|
60
69
|
|
61
70
|
# Verify a checksum given Bech32 string
|
71
|
+
# @param [String] hrp hrp part.
|
72
|
+
# @param [Array[Integer]] data data array.
|
73
|
+
# @return [Integer] spec
|
62
74
|
def verify_checksum(hrp, data)
|
63
|
-
polymod(expand_hrp(hrp) + data)
|
75
|
+
const = polymod(expand_hrp(hrp) + data)
|
76
|
+
case const
|
77
|
+
when 1
|
78
|
+
Encoding::BECH32
|
79
|
+
when BECH32M_CONST
|
80
|
+
Encoding::BECH32M
|
81
|
+
end
|
64
82
|
end
|
65
83
|
|
66
84
|
# Expand the hrp into values for checksum computation.
|
@@ -82,4 +100,4 @@ module Bech32
|
|
82
100
|
|
83
101
|
private_class_method :polymod, :expand_hrp
|
84
102
|
|
85
|
-
end
|
103
|
+
end
|
data/lib/bech32/segwit_addr.rb
CHANGED
@@ -4,6 +4,7 @@ module Bech32
|
|
4
4
|
|
5
5
|
HRP_MAINNET = 'bc'
|
6
6
|
HRP_TESTNET = 'tb'
|
7
|
+
HRP_REGTEST = 'bcrt'
|
7
8
|
|
8
9
|
attr_accessor :hrp # human-readable part
|
9
10
|
attr_accessor :ver # witness version
|
@@ -23,25 +24,27 @@ module Bech32
|
|
23
24
|
# parse script pubkey into witness version and witness program
|
24
25
|
def script_pubkey=(script_pubkey)
|
25
26
|
values = [script_pubkey].pack('H*').unpack("C*")
|
26
|
-
@ver = values[0]
|
27
|
+
@ver = values[0] == 0 ? values[0] : values[0] - 0x50
|
27
28
|
@prog = values[2..-1]
|
28
29
|
end
|
29
30
|
|
30
31
|
# Returns segwit address string which generated from hrp, witness version and witness program.
|
31
32
|
def addr
|
32
|
-
|
33
|
+
spec = (ver == 0 ? Bech32::Encoding::BECH32 : Bech32::Encoding::BECH32M)
|
34
|
+
Bech32.encode(hrp, [ver] + convert_bits(prog, 8, 5), spec)
|
33
35
|
end
|
34
36
|
|
35
37
|
private
|
36
38
|
|
37
39
|
def parse_addr(addr)
|
38
|
-
@hrp, data = Bech32.decode(addr)
|
39
|
-
raise 'Invalid address.' if
|
40
|
+
@hrp, data, spec = Bech32.decode(addr)
|
41
|
+
raise 'Invalid address.' if hrp.nil? || data[0].nil? || ![HRP_MAINNET, HRP_TESTNET, HRP_REGTEST].include?(hrp)
|
40
42
|
@ver = data[0]
|
41
43
|
raise 'Invalid witness version' if @ver > 16
|
42
44
|
@prog = convert_bits(data[1..-1], 5, 8, false)
|
43
45
|
raise 'Invalid witness program' if @prog.nil? || @prog.length < 2 || @prog.length > 40
|
44
46
|
raise 'Invalid witness program with version 0' if @ver == 0 && (@prog.length != 20 && @prog.length != 32)
|
47
|
+
raise 'Witness version and encoding spec do not match' if (@ver == 0 && spec != Bech32::Encoding::BECH32) || (@ver != 0 && spec != Bech32::Encoding::BECH32M)
|
45
48
|
end
|
46
49
|
|
47
50
|
def convert_bits(data, from, to, padding=true)
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bech32
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shigeyuki Azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rake
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
|
-
- - "
|
31
|
+
- - ">="
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
33
|
+
version: 12.3.3
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
|
-
- - "
|
38
|
+
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
40
|
+
version: 12.3.3
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,16 +54,17 @@ dependencies:
|
|
40
54
|
version: '3.0'
|
41
55
|
description: The implementation of Bech32 encoder and decoder.
|
42
56
|
email:
|
43
|
-
-
|
44
|
-
executables:
|
57
|
+
- techmedia.think@gmail.com
|
58
|
+
executables:
|
59
|
+
- bech32
|
45
60
|
extensions: []
|
46
61
|
extra_rdoc_files: []
|
47
62
|
files:
|
63
|
+
- ".github/workflows/main.yml"
|
48
64
|
- ".gitignore"
|
49
65
|
- ".rspec"
|
50
66
|
- ".ruby-gemset"
|
51
67
|
- ".ruby-version"
|
52
|
-
- ".travis.yml"
|
53
68
|
- CODE_OF_CONDUCT.md
|
54
69
|
- Gemfile
|
55
70
|
- LICENSE.txt
|
@@ -58,8 +73,10 @@ files:
|
|
58
73
|
- bech32.gemspec
|
59
74
|
- bin/console
|
60
75
|
- bin/setup
|
76
|
+
- exe/bech32
|
61
77
|
- lib/bech32.rb
|
62
78
|
- lib/bech32/segwit_addr.rb
|
79
|
+
- lib/bech32/version.rb
|
63
80
|
homepage: https://github.com/azuchi/bech32rb
|
64
81
|
licenses:
|
65
82
|
- MIT
|
@@ -79,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
96
|
- !ruby/object:Gem::Version
|
80
97
|
version: '0'
|
81
98
|
requirements: []
|
82
|
-
|
83
|
-
rubygems_version: 2.6.12
|
99
|
+
rubygems_version: 3.2.3
|
84
100
|
signing_key:
|
85
101
|
specification_version: 4
|
86
102
|
summary: The implementation of Bech32 encoder and decoder.
|