base32-alphabets 1.1.1 → 1.1.2
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.
- checksums.yaml +4 -4
- data/README.md +21 -7
- data/lib/base32-alphabets/base.rb +3 -6
- data/lib/base32-alphabets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc6d2430003b634ee280df16f5521203651c3ca8
|
4
|
+
data.tar.gz: 4f22fb3f84adc4fa39538850b01ed94ec7e52233
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afef3f590f72d39f6d379408d2aa1ea8767f65121c973cc7e95837591580e1d500373214758efeaac09e6e1775c69353ec98b441d44646af6a88830f119aedde
|
7
|
+
data.tar.gz: 649b95e979d1e64aade72adc5f693a4eb7539e9409e2c75874896d47420cf4b455a9eceb30172326f8e5d2d4d20109daa7bfab82d59755fb6898ebc524907cb3
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ require 'base32-alphabets'
|
|
50
50
|
|
51
51
|
|
52
52
|
binary = 0b0000000000000000010010100101001010010011000111001110010000001000010111000001010010111101110011100000000101001010000000110001100010000100011010100000110010000000100011000110000000101001010010100110001100010100101000110100101000010010100101011011100111001110 # binary
|
53
|
-
hex =
|
53
|
+
hex = 0x00004a52931ce4085c14bdce014a0318846a0c808c60294a6314a34a1295b9ce # hex
|
54
54
|
|
55
55
|
pp binary == hex
|
56
56
|
# => true
|
@@ -153,7 +153,7 @@ require 'base32-alphabets'
|
|
153
153
|
|
154
154
|
|
155
155
|
binary = 0b0000000000000000010010100101001010010011000111001110010000001000010111000001010010111101110011100000000101001010000000110001100010000100011010100000110010000000100011000110000000101001010010100110001100010100101000110100101000010010100101011011100111001110 # binary
|
156
|
-
hex =
|
156
|
+
hex = 0x00004a52931ce4085c14bdce014a0318846a0c808c60294a6314a34a1295b9ce # hex
|
157
157
|
|
158
158
|
pp binary == hex
|
159
159
|
# => true
|
@@ -197,10 +197,7 @@ pp = Base32.decode( str ) ## text to (binary) number
|
|
197
197
|
## Electrologica
|
198
198
|
|
199
199
|
The electrologica notation / alphabet (
|
200
|
-
`00 01 02 03 04 05 06 07`
|
201
|
-
`08 09 10 11 12 13 14 15`
|
202
|
-
`16 17 18 19 20 21 22 23`
|
203
|
-
`24 25 26 27 28 29 30 31`)
|
200
|
+
`00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31`)
|
204
201
|
|
205
202
|
|
206
203
|
### Electrologica (Base32) Notation
|
@@ -225,7 +222,7 @@ require 'base32-alphabets'
|
|
225
222
|
|
226
223
|
|
227
224
|
binary = 0b0000000000000000010010100101001010010011000111001110010000001000010111000001010010111101110011100000000101001010000000110001100010000100011010100000110010000000100011000110000000101001010010100110001100010100101000110100101000010010100101011011100111001110 # binary
|
228
|
-
hex =
|
225
|
+
hex = 0x00004a52931ce4085c14bdce014a0318846a0c808c60294a6314a34a1295b9ce # hex
|
229
226
|
|
230
227
|
pp binary == hex
|
231
228
|
# => true
|
@@ -266,6 +263,23 @@ pp = Base32.decode( str ) ## text to (binary) number
|
|
266
263
|
|
267
264
|
|
268
265
|
|
266
|
+
## Real World Usage
|
267
|
+
|
268
|
+
See [copycats command line tool (and core library)(https://github.com/cryptocopycats/copycats) - crypto cats / kitties collectibles unchained - buy! sell! hodl! sire! - play for free - runs off the blockchain - no ether / gas required
|
269
|
+
|
270
|
+
|
271
|
+
## More Documentation / Articles / Samples
|
272
|
+
|
273
|
+
- [Programming Crypto Collectibles Step-by-Step Book / Guide](https://github.com/cryptocopycats/programming-cryptocollectibles)
|
274
|
+
Let's start with CryptoKitties & Copycats. Inside Unique Bits & Bytes on the Blockchain...
|
275
|
+
|
276
|
+
- [Ruby Quiz - Challenge #8 - Base32 Alphabet](https://github.com/planetruby/quiz/tree/master/008) - Convert the Super "Sekretoooo" 240-Bit CryptoKitties Genome to Kai Notation - Annipurrsary!
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
269
283
|
|
270
284
|
## License
|
271
285
|
|
@@ -39,10 +39,7 @@ class Base
|
|
39
39
|
def self.fmt( str_or_num_or_bytes, group: 4, sep: ' ' )
|
40
40
|
if str_or_num_or_bytes.is_a? String
|
41
41
|
str = str_or_num_or_bytes
|
42
|
-
else ## assume number
|
43
|
-
## str_or_num_or_bytes.is_a?(Integer) ||
|
44
|
-
## str_or_num_or_bytes.is_a?(Bignum) ||
|
45
|
-
## str_or_num_or_bytes.is_a?(Fixnum)
|
42
|
+
else ## assume number (Integer) or bytes (Array)
|
46
43
|
num_or_bytes = str_or_num_or_bytes
|
47
44
|
str = encode( num_or_bytes ) ## auto-encode (shortcut)
|
48
45
|
end
|
@@ -92,7 +89,7 @@ class Base
|
|
92
89
|
## (private) helpers
|
93
90
|
def self._build_binary
|
94
91
|
## e.g. '00000', '00001', '00010', '00011', etc.
|
95
|
-
number.
|
92
|
+
number.reduce({}) do |h, (char,index)|
|
96
93
|
h[char] = '%05b' % index
|
97
94
|
h
|
98
95
|
end
|
@@ -100,7 +97,7 @@ class Base
|
|
100
97
|
|
101
98
|
def self._build_code
|
102
99
|
## e.g. '00', '01', '02', '03', '04', etc.
|
103
|
-
number.
|
100
|
+
number.reduce({}) do |h, (char,index)|
|
104
101
|
h[char] = '%02d' % index
|
105
102
|
h
|
106
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: base32-alphabets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|