Module: JekyllWKD::ZBase32

Defined in:
lib/jekyll-wkd/hash.rb

Defined Under Namespace

Classes: Block

Constant Summary collapse

CHAR =
"ybndrfg8ejkmcpqxot1uwisza345h769"
SIZE =
5
MASK =
(1 << SIZE) - 1

Class Method Summary collapse

Class Method Details

.blocks(str, size) ⇒ Object



13
14
15
# File 'lib/jekyll-wkd/hash.rb', line 13

def self.blocks str, size
  str.bytes.reverse.each_slice(size).map { |b| Block.new b }.reverse
end

.encode(str) ⇒ Object



9
10
11
# File 'lib/jekyll-wkd/hash.rb', line 9

def self.encode str
  blocks(str, SIZE).map(&:encode).join
end