base32.rb 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 36ce9ea6988f7f35310fd56a62a3827f36b0baf14b5527d48aac8a26a7dbfb8f
4
+ data.tar.gz: 22af2071d932f515109602837c02d209557adedff42c6aaa6dbb4d7ca651eac8
5
+ SHA512:
6
+ metadata.gz: c4db78a588ec044ba38c83ac151f5fbecccdafa27fabbcd85f5a7d336bc87743c2a5ae70f8c53b5cdef780051f65b1bfb606976ad30e92c5747d81290030f32e
7
+ data.tar.gz: 515b5c125bc98ed66ba049bf67297068d556bbf9a76e80d590436968d4f2d7f12b91ee30d8492b8a549fda3bd76a42d98b2798a96b3452fab1868a6724ee86b8
@@ -0,0 +1,5 @@
1
+ ext/Makefile
2
+ ext/*.o
3
+ ext/*.so
4
+ ext/*.bundle
5
+ Gemfile.lock
@@ -0,0 +1,52 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-performance
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.5
8
+ DisplayCopNames: true
9
+
10
+ Layout/AccessModifierIndentation:
11
+ EnforcedStyle: outdent
12
+
13
+ Lint/ReturnInVoidContext:
14
+ Enabled: false
15
+
16
+ Metrics/BlockLength:
17
+ Exclude:
18
+ - '**/*.gemspec'
19
+ - 'spec/**/*'
20
+
21
+ Style/AndOr:
22
+ EnforcedStyle: conditionals
23
+
24
+ Style/AsciiComments:
25
+ Enabled: false
26
+
27
+ Style/Documentation:
28
+ Enabled: false
29
+
30
+ Style/DoubleNegation:
31
+ Enabled: false
32
+
33
+ Style/FrozenStringLiteralComment:
34
+ Enabled: true
35
+ EnforcedStyle: always
36
+ Exclude:
37
+ - 'lib/base32.rb'
38
+
39
+ Style/RegexpLiteral:
40
+ Enabled: false
41
+
42
+ Style/RescueStandardError:
43
+ EnforcedStyle: implicit
44
+
45
+ Style/TrailingCommaInArguments:
46
+ EnforcedStyleForMultiline: comma
47
+
48
+ Style/TrailingCommaInArrayLiteral:
49
+ EnforcedStyleForMultiline: comma
50
+
51
+ Style/TrailingCommaInHashLiteral:
52
+ EnforcedStyleForMultiline: comma
@@ -0,0 +1,34 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-02-20 22:20:53 +0300 using RuboCop version 0.73.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ Metrics/AbcSize:
11
+ Max: 29
12
+
13
+ # Offense count: 1
14
+ # Configuration parameters: CountComments.
15
+ Metrics/ClassLength:
16
+ Max: 102
17
+
18
+ # Offense count: 1
19
+ # Configuration parameters: CountComments, ExcludedMethods.
20
+ Metrics/MethodLength:
21
+ Max: 18
22
+
23
+ # Offense count: 1
24
+ # Cop supports --auto-correct.
25
+ Style/IfUnlessModifier:
26
+ Exclude:
27
+ - 'lib/base32/alphabet.rb'
28
+
29
+ # Offense count: 5
30
+ # Cop supports --auto-correct.
31
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
32
+ # URISchemes: http, https
33
+ Metrics/LineLength:
34
+ Max: 100
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.4
4
+ - 2.5
5
+ - 2.6
6
+ - 2.7
7
+
8
+ before_install: gem install bundler -v 1.13.6
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'http://rubygems.org'
4
+
5
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2007-2011 Samuel Tesla
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,22 @@
1
+ Base32.rb
2
+ =========
3
+
4
+ This package contains base32, a Ruby extension for encoding and decoding
5
+ in base32 per [RFC 3548](http://www.faqs.org/rfcs/rfc3548.html).
6
+
7
+ ## Install
8
+
9
+ ```
10
+ gem install base32.rb
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ruby
16
+ require 'base32'
17
+
18
+ encoded = Base32.encode("chunky bacon!") #==> "MNUHK3TLPEQGEYLDN5XCC==="
19
+ decoded = Base32.decode(encoded) #==> "chunky bacon!"
20
+
21
+ puts %Q{"#{decoded}" is "#{encoded}" in base32}
22
+ ```
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'bundler'
5
+ Bundler.setup(:default, :development)
6
+ rescue Bundler::BundlerError => e
7
+ warn e.message
8
+ warn 'Run `bundle install` to install missing gems'
9
+ exit e.status_code
10
+ end
11
+
12
+ require 'bundler/gem_tasks'
13
+ require 'rubygems'
14
+ require 'rake/testtask'
15
+
16
+ task default: :test
17
+
18
+ Rake::TestTask.new do |t|
19
+ t.libs << 'test'
20
+ t.test_files = FileList['test/**/*_test.rb']
21
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
4
+ require 'base32/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'base32.rb'
8
+ spec.version = Base32::VERSION
9
+ spec.license = 'MIT'
10
+ spec.homepage = 'https://github.com/ydakuka/base32.rb'
11
+ spec.summary = 'Ruby extension for base32 encoding and decoding.'
12
+ spec.platform = Gem::Platform::RUBY
13
+
14
+ spec.authors = ['Samuel Tesla']
15
+ spec.email = 'samuel.tesla@gmail.com'
16
+
17
+ spec.description = <<-DESCRIPTION.split.join ' '
18
+ Base32 is one of several base 32 transfer encodings. Base32 uses a
19
+ 32-character set comprising the twenty-six upper-case letters A–Z,
20
+ and the digits 2–7.
21
+
22
+ Base32 is primarily used to encode binary data, but Base32 is also able to
23
+ encode binary text like ASCII.
24
+
25
+ Base32 is a notation for encoding arbitrary byte data using a restricted set
26
+ of symbols that can be conveniently used by humans and processed by
27
+ computers.
28
+
29
+ Base32 consists of a symbol set made up of 32 different characters, as well
30
+ as an algorithm for encoding arbitrary sequences of 8-bit bytes into the
31
+ Base32 alphabet. Because more than one 5-bit Base32 symbol is needed to
32
+ represent each 8-bit input byte, it also specifies requirements on the
33
+ allowed lengths of Base32 strings (which must be multiples of 40 bits). The
34
+ closely related Base64 system, in contrast, uses a set of 64 symbols.
35
+ DESCRIPTION
36
+
37
+ spec.metadata = {
38
+ 'homepage_uri' => 'https://github.com/ydakuka/base32.rb',
39
+ 'source_code_uri' => 'https://github.com/ydakuka/base32.rb',
40
+ 'bug_tracker_uri' => 'https://github.com/ydakuka/base32.rb/issues',
41
+ }.freeze
42
+
43
+ spec.require_paths = ['lib']
44
+
45
+ spec.files = `git ls-files`.split("\n")
46
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
47
+
48
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
49
+
50
+ spec.add_development_dependency 'gem-release', '~> 2.0'
51
+ spec.add_development_dependency 'minitest', '~> 5.11'
52
+ spec.add_development_dependency 'rake', '~> 12.3'
53
+ spec.add_development_dependency 'rubocop', '~> 0.73'
54
+ spec.add_development_dependency 'rubocop-performance', '~> 1.5'
55
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2007-2011 Samuel Tesla
4
+
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ unless defined? BASE32_ROOT
24
+ root_path = File.join(File.dirname(__FILE__), '..')
25
+ BASE32_ROOT = File.expand_path(root_path)
26
+ end
27
+
28
+ $LOAD_PATH.unshift File.join(BASE32_ROOT, 'lib')
29
+ $LOAD_PATH.unshift File.join(BASE32_ROOT, 'ext')
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'base32/version'
4
+
5
+ require 'base32/alphabet'
6
+ require 'base32/chunk'
7
+ require 'base32/decoder'
8
+ require 'base32/encoder'
9
+ require 'base32/random'
10
+
11
+ # Module for encoding and decoding in Base32 per RFC 3548
12
+ module Base32
13
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Base32
4
+ class Alphabet
5
+ CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
6
+
7
+ attr_reader :chars
8
+
9
+ alias to_s chars
10
+
11
+ def initialize(chars)
12
+ self.chars = chars
13
+ end
14
+
15
+ def inspect
16
+ "#<#{self.class}:#{chars.inspect}>"
17
+ end
18
+
19
+ def chars=(chars)
20
+ unless chars_valid?(chars)
21
+ raise ArgumentError, 'Chars must have 32 unique characters'
22
+ end
23
+
24
+ @chars = chars
25
+ end
26
+
27
+ def chars_valid?(chars)
28
+ chars.bytes.to_a.size == 32 && chars.bytes.to_a.uniq.size == 32
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Base32
4
+ class Chunk
5
+ attr_reader :alphabet
6
+
7
+ def initialize(bytes, alphabet = Base32::Alphabet::CHARS)
8
+ @bytes = bytes
9
+ @alphabet = Base32::Alphabet.new alphabet
10
+ end
11
+
12
+ def self.call(str, size, alphabet)
13
+ result = []
14
+ bytes = str.bytes
15
+ while bytes.any?
16
+ result << Chunk.new(bytes.take(size), alphabet)
17
+ bytes = bytes.drop(size)
18
+ end
19
+ result
20
+ end
21
+
22
+ def decode
23
+ bytes = @bytes.take_while { |c| c != 61 } # strip padding
24
+ n = (bytes.length * 5.0 / 8.0).floor
25
+ p = bytes.length < 8 ? 5 - (n * 8) % 5 : 0
26
+
27
+ c = bytes.inject(0) do |m, o|
28
+ i = alphabet.to_s.index(o.chr)
29
+ raise ArgumentError, "invalid character '#{o.chr}'" if i.nil?
30
+
31
+ (m << 5) + i
32
+ end >> p
33
+
34
+ (0..n - 1).to_a.reverse.collect { |i| ((c >> i * 8) & 0xff).chr }
35
+ end
36
+
37
+ def encode
38
+ n = (@bytes.length * 8.0 / 5.0).ceil
39
+ p = n < 8 ? 5 - (@bytes.length * 8) % 5 : 0
40
+ c = @bytes.inject(0) { |m, o| (m << 8) + o } << p
41
+
42
+ [
43
+ (0..n - 1).to_a.reverse.collect do |i|
44
+ alphabet.to_s[(c >> i * 5) & 0x1f].chr
45
+ end,
46
+ ('=' * (8 - n)),
47
+ ]
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Base32
4
+ class Decoder
5
+ attr_reader :str, :alphabet
6
+
7
+ def initialize(str, alphabet = Base32::Alphabet::CHARS)
8
+ @str = str
9
+ @alphabet = alphabet
10
+ end
11
+
12
+ def call
13
+ Base32::Chunk.call(str, 8, alphabet).collect(&:decode).flatten.join
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Base32
4
+ class Encoder
5
+ attr_reader :str, :alphabet
6
+
7
+ def initialize(str, alphabet = Base32::Alphabet::CHARS)
8
+ @str = str
9
+ @alphabet = alphabet
10
+ end
11
+
12
+ def call
13
+ Base32::Chunk.call(str, 5, alphabet).collect(&:encode).flatten.join
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'openssl'
4
+
5
+ # Module for encoding and decoding in Base32 per RFC 3548
6
+ module Base32
7
+ class Random
8
+ attr_reader :length, :padding
9
+
10
+ def initialize(length = 16, padding = true)
11
+ @length = length
12
+ @padding = padding
13
+ end
14
+
15
+ def call
16
+ random = ''
17
+
18
+ OpenSSL::Random.random_bytes(length).each_byte do |b|
19
+ random += alphabet.to_s[b % 32]
20
+ end
21
+ padding ? random.ljust((length / 8.0).ceil * 8, '=') : random
22
+ end
23
+
24
+ def alphabet
25
+ @alphabet ||= Base32::Alphabet.new Base32::Alphabet::CHARS
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Base32
4
+ VERSION = '0.4.1'
5
+ end
@@ -0,0 +1,126 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require File.dirname(__FILE__) + '/../lib/base32.rb'
5
+
6
+ class TestBase32 < Minitest::Test
7
+ def assert_decoding(encoded, plain, alphabet)
8
+ decoded = Base32::Decoder.new(encoded, alphabet).call
9
+ assert_equal(plain, decoded)
10
+ end
11
+
12
+ def assert_encoding(encoded, plain, alphabet)
13
+ actual = Base32::Encoder.new(plain, alphabet).call
14
+ assert_equal(encoded, actual)
15
+ end
16
+
17
+ def assert_encode_and_decode(encoded, plain, alphabet = Base32::Alphabet::CHARS)
18
+ assert_encoding(encoded, plain, alphabet)
19
+ assert_decoding(encoded, plain, alphabet)
20
+ end
21
+
22
+ def assert_hex_encode_and_decode(encoded, hex, alphabet = Base32::Alphabet::CHARS)
23
+ plain = [hex].pack('H*')
24
+ assert_encode_and_decode(encoded, plain, alphabet)
25
+ end
26
+
27
+ def test_empty_string
28
+ assert_encode_and_decode('', '')
29
+ end
30
+
31
+ def test_a
32
+ assert_encode_and_decode('ME======', 'a')
33
+ end
34
+
35
+ def test_12345
36
+ assert_encode_and_decode('GEZDGNBV', '12345')
37
+ end
38
+
39
+ def test_abcde
40
+ assert_encode_and_decode('MFRGGZDF', 'abcde')
41
+ end
42
+
43
+ def test_constitution_preamble
44
+ plaintext = <<-TEXT
45
+ We the people of the United States, in order to form a more perfect union,
46
+ establish justice, insure domestic tranquility, provide for the common
47
+ defense, promote the general welfare, and secure the blessings of liberty
48
+ to ourselves and our posterity, do ordain and establish this Constitution
49
+ for the United States of America.
50
+ TEXT
51
+ encoded = %w[
52
+ EAQCAIBAEBLWKIDUNBSSA4DFN5YGYZJAN5TCA5DIMUQFK3TJORSWIICTORQXIZLTFQQGS3RA
53
+ N5ZGIZLSEB2G6IDGN5ZG2IDBEBWW64TFEBYGK4TGMVRXIIDVNZUW63RMBIQCAIBAEAQGK43U
54
+ MFRGY2LTNAQGU5LTORUWGZJMEBUW443VOJSSAZDPNVSXG5DJMMQHI4TBNZYXK2LMNF2HSLBA
55
+ OBZG65TJMRSSAZTPOIQHI2DFEBRW63LNN5XAUIBAEAQCAIDEMVTGK3TTMUWCA4DSN5WW65DF
56
+ EB2GQZJAM5SW4ZLSMFWCA53FNRTGC4TFFQQGC3TEEBZWKY3VOJSSA5DIMUQGE3DFONZWS3TH
57
+ OMQG6ZRANRUWEZLSOR4QUIBAEAQCAIDUN4QG65LSONSWY5TFOMQGC3TEEBXXK4RAOBXXG5DF
58
+ OJUXI6JMEBSG6IDPOJSGC2LOEBQW4ZBAMVZXIYLCNRUXG2BAORUGS4ZAINXW443UNF2HK5DJ
59
+ N5XAUIBAEAQCAIDGN5ZCA5DIMUQFK3TJORSWIICTORQXIZLTEBXWMICBNVSXE2LDMEXAU===
60
+ ].join
61
+ assert_encode_and_decode(encoded, plaintext)
62
+ end
63
+
64
+ def test_hex_byte_encoding
65
+ assert_hex_encode_and_decode('FA======', '28')
66
+ assert_hex_encode_and_decode('2Y======', 'd6')
67
+ assert_hex_encode_and_decode('234A====', 'd6f8')
68
+ assert_hex_encode_and_decode('234AA===', 'd6f800')
69
+ assert_hex_encode_and_decode('234BA===', 'd6f810')
70
+ assert_hex_encode_and_decode('234BCDA=', 'd6f8110c')
71
+ assert_hex_encode_and_decode('234BCDEA', 'd6f8110c80')
72
+ assert_hex_encode_and_decode('234BCDEFGA======', 'd6f8110c8530')
73
+ assert_hex_encode_and_decode('234BCDEFG234BCDEFE======', 'd6f8110c8536b7c0886429')
74
+ end
75
+
76
+ def test_random_base32
77
+ assert_equal(16, Base32::Random.new.length)
78
+ assert_match(/^[A-Z2-7]+$/, Base32::Random.new.call)
79
+ end
80
+
81
+ def test_random_base32_length
82
+ assert_equal(32, Base32::Random.new(32).length)
83
+ assert_equal(40, Base32::Random.new(40).length)
84
+ assert_equal(29, Base32::Random.new(29).length)
85
+ assert_match(/^[A-Z2-7]{1}={7}$/, Base32::Random.new(1).call)
86
+ assert_match(/^[A-Z2-7]{29}={3}$/, Base32::Random.new(29).call)
87
+ end
88
+
89
+ def test_random_base32_padding
90
+ assert_equal(32, Base32::Random.new(32, false).length)
91
+ assert_equal(40, Base32::Random.new(40, false).length)
92
+ assert_equal(29, Base32::Random.new(29, false).length)
93
+ assert_match(/^[A-Z2-7]{1}$/, Base32::Random.new(1, false).call)
94
+ assert_match(/^[A-Z2-7]{29}$/, Base32::Random.new(29, false).call)
95
+ end
96
+
97
+ def test_assign_new_chars
98
+ new_chars = 'abcdefghijklmnopqrstuvwxyz234567'
99
+ alphabet = Base32::Alphabet.new(new_chars).to_s
100
+ assert_equal(new_chars, alphabet)
101
+ end
102
+
103
+ def test_check_chars_length
104
+ assert_raises(ArgumentError) { Base32::Alphabet.new('a' * 31) }
105
+ assert_raises(ArgumentError) { Base32::Alphabet.new('a' * 32) }
106
+ assert_raises(ArgumentError) { Base32::Alphabet.new('a' * 33) }
107
+
108
+ assert_raises(ArgumentError) do
109
+ Base32::Alphabet.new('abcdefghijklmnopqrstuvwxyz234567' * 2)
110
+ end
111
+ end
112
+
113
+ def test_encode_decode_with_alternate_chars
114
+ new_alphabet = 'abcdefghijklmnopqrstuvwxyz234567'
115
+
116
+ assert_hex_encode_and_decode('fa======', '28', new_alphabet)
117
+ assert_hex_encode_and_decode('2y======', 'd6', new_alphabet)
118
+ assert_hex_encode_and_decode('234a====', 'd6f8', new_alphabet)
119
+ assert_hex_encode_and_decode('234aa===', 'd6f800', new_alphabet)
120
+ assert_hex_encode_and_decode('234ba===', 'd6f810', new_alphabet)
121
+ assert_hex_encode_and_decode('234bcda=', 'd6f8110c', new_alphabet)
122
+ assert_hex_encode_and_decode('234bcdea', 'd6f8110c80', new_alphabet)
123
+ assert_hex_encode_and_decode('234bcdefga======', 'd6f8110c8530', new_alphabet)
124
+ assert_hex_encode_and_decode('234bcdefg234bcdefe======', 'd6f8110c8536b7c0886429', new_alphabet)
125
+ end
126
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: base32.rb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.1
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Tesla
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gem-release
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '12.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.73'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.73'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-performance
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.5'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.5'
83
+ description: Base32 is one of several base 32 transfer encodings. Base32 uses a 32-character
84
+ set comprising the twenty-six upper-case letters A–Z, and the digits 2–7. Base32
85
+ is primarily used to encode binary data, but Base32 is also able to encode binary
86
+ text like ASCII. Base32 is a notation for encoding arbitrary byte data using a restricted
87
+ set of symbols that can be conveniently used by humans and processed by computers.
88
+ Base32 consists of a symbol set made up of 32 different characters, as well as an
89
+ algorithm for encoding arbitrary sequences of 8-bit bytes into the Base32 alphabet.
90
+ Because more than one 5-bit Base32 symbol is needed to represent each 8-bit input
91
+ byte, it also specifies requirements on the allowed lengths of Base32 strings (which
92
+ must be multiples of 40 bits). The closely related Base64 system, in contrast, uses
93
+ a set of 64 symbols.
94
+ email: samuel.tesla@gmail.com
95
+ executables: []
96
+ extensions: []
97
+ extra_rdoc_files: []
98
+ files:
99
+ - ".gitignore"
100
+ - ".rubocop.yml"
101
+ - ".rubocop_todo.yml"
102
+ - ".travis.yml"
103
+ - Gemfile
104
+ - LICENSE
105
+ - README.md
106
+ - Rakefile
107
+ - base32.gemspec
108
+ - config/environment.rb
109
+ - lib/base32.rb
110
+ - lib/base32/alphabet.rb
111
+ - lib/base32/chunk.rb
112
+ - lib/base32/decoder.rb
113
+ - lib/base32/encoder.rb
114
+ - lib/base32/random.rb
115
+ - lib/base32/version.rb
116
+ - test/base32_test.rb
117
+ homepage: https://github.com/ydakuka/base32.rb
118
+ licenses:
119
+ - MIT
120
+ metadata:
121
+ homepage_uri: https://github.com/ydakuka/base32.rb
122
+ source_code_uri: https://github.com/ydakuka/base32.rb
123
+ bug_tracker_uri: https://github.com/ydakuka/base32.rb/issues
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.7.7
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: Ruby extension for base32 encoding and decoding.
144
+ test_files: []