Module: Ronin::Support::Encoding::Base32
- Defined in:
- lib/ronin/support/encoding/base32.rb
Overview
Defined Under Namespace
Classes: Chunk
Constant Summary collapse
- TABLE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Base32 alphabet
'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
Class Method Summary collapse
-
.decode(data) ⇒ String
Base32 decodes the given String.
-
.each_chunk(data, size) {|chunk| ... } ⇒ Object
private
Enumerates over the consecutive chunks within the given data.
-
.encode(data) ⇒ String
Base32 encodes the given String.
Class Method Details
.decode(data) ⇒ String
Base32 decodes the given String.
65 66 67 68 69 70 71 72 73 |
# File 'lib/ronin/support/encoding/base32.rb', line 65 def self.decode(data) decoded = String.new(encoding: Encoding::UTF_8) each_chunk(data,8) do |chunk| chunk.decode(decoded) end return decoded end |
.each_chunk(data, size) {|chunk| ... } ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Enumerates over the consecutive chunks within the given data.
170 171 172 173 174 |
# File 'lib/ronin/support/encoding/base32.rb', line 170 def self.each_chunk(data,size) data.bytes.each_slice(size) do |byte_slice| yield Chunk.new(byte_slice) end end |