Class: JekyllWKD::ZBase32::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-wkd/hash.rb

Instance Method Summary collapse

Constructor Details

#initialize(bytes) ⇒ Block

Returns a new instance of Block.



18
19
20
# File 'lib/jekyll-wkd/hash.rb', line 18

def initialize bytes
  @bytes = bytes
end

Instance Method Details

#encodeObject



22
23
24
25
26
# File 'lib/jekyll-wkd/hash.rb', line 22

def encode
  n = -(@bytes.length * -8 / SIZE)
  c = @bytes.reverse.reduce(0) { |a, b| (a << 8) + b }
  (n - 1).downto(0).map { |i| CHAR[(c >> i * SIZE) & MASK] }
end