digest-base32 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/digest-base32.gemspec +1 -1
- data/ext/digest/{base32 → base32_ext}/base32.c +0 -0
- data/ext/digest/{base32 → base32_ext}/base32.h +0 -0
- data/ext/digest/{base32 → base32_ext}/digest-base32.c +1 -1
- data/ext/digest/{base32 → base32_ext}/extconf.rb +1 -1
- data/lib/digest/base32.rb +29 -0
- data/lib/digest/base32/version.rb +1 -1
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fca59661b4ef22a81c0027994c420a5acdf00989a47b23e6206012f198c6b76
|
4
|
+
data.tar.gz: 83e51fa62a12b3370660cdb717d1771ee8510e9ac2df7d920c54ae61cc74dfa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1f205a6d4158e0adf04774dfca5ec1229660b37d62630db4a6154952dd4b321a658fe537f58650b29e5be89d6b59314bb4094d09b3e10302987836ba830586d
|
7
|
+
data.tar.gz: fe261bb240202c120e6f9466dc5f578323f52af14402c21da131ff238037fe7434cefd1a44c1e9c2c7677fce67bc3613f9f9b1587eb3d693c098a3b97f046654
|
data/digest-base32.gemspec
CHANGED
@@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
|
|
40
40
|
|
41
41
|
spec.executables = spec.files.grep %r{^exe/}, &File.method(:basename)
|
42
42
|
|
43
|
-
spec.extensions << 'ext/digest/
|
43
|
+
spec.extensions << 'ext/digest/base32_ext/extconf.rb'
|
44
44
|
|
45
45
|
spec.add_development_dependency 'base32', '~> 0.3.2'
|
46
46
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
File without changes
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'digest/base32_ext'
|
4
|
+
|
5
|
+
require 'digest/base32/version'
|
6
|
+
|
7
|
+
require 'securerandom'
|
8
|
+
|
9
|
+
module Digest
|
10
|
+
class Base32
|
11
|
+
CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
|
12
|
+
|
13
|
+
def self.random(length: 16, padding: true)
|
14
|
+
unless length.is_a? Integer
|
15
|
+
raise TypeError, "Expected #{Integer}, got #{length.class}"
|
16
|
+
end
|
17
|
+
|
18
|
+
unless [true, false].include? padding
|
19
|
+
raise TypeError, "Expected bool, got #{padding.class}"
|
20
|
+
end
|
21
|
+
|
22
|
+
random = +''
|
23
|
+
SecureRandom.random_bytes(length).each_byte do |b|
|
24
|
+
random << CHARS[b % 32]
|
25
|
+
end
|
26
|
+
padding ? random.ljust((length / 8.0).ceil * 8, '=') : random
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digest-base32
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Cook
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base32
|
@@ -126,16 +126,17 @@ description: Ruby native extension for base32 encoding and decoding.
|
|
126
126
|
email:
|
127
127
|
executables: []
|
128
128
|
extensions:
|
129
|
-
- ext/digest/
|
129
|
+
- ext/digest/base32_ext/extconf.rb
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
132
|
- LICENSE
|
133
133
|
- README.md
|
134
134
|
- digest-base32.gemspec
|
135
|
-
- ext/digest/
|
136
|
-
- ext/digest/
|
137
|
-
- ext/digest/
|
138
|
-
- ext/digest/
|
135
|
+
- ext/digest/base32_ext/base32.c
|
136
|
+
- ext/digest/base32_ext/base32.h
|
137
|
+
- ext/digest/base32_ext/digest-base32.c
|
138
|
+
- ext/digest/base32_ext/extconf.rb
|
139
|
+
- lib/digest/base32.rb
|
139
140
|
- lib/digest/base32/version.rb
|
140
141
|
homepage: https://github.com/ydakuka/digest-base32
|
141
142
|
licenses:
|
@@ -159,7 +160,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
160
|
- !ruby/object:Gem::Version
|
160
161
|
version: '0'
|
161
162
|
requirements: []
|
162
|
-
|
163
|
+
rubyforge_project:
|
164
|
+
rubygems_version: 2.7.7
|
163
165
|
signing_key:
|
164
166
|
specification_version: 4
|
165
167
|
summary: Base32 Ruby C Extension
|