Module: PhcStringFormat::B64

Defined in:
lib/phc_string_format/b64.rb

Overview

Class Method Summary collapse

Class Method Details

.decode(bin) ⇒ Object



16
17
18
19
# File 'lib/phc_string_format/b64.rb', line 16

def self.decode(bin)
  return nil unless bin
  Base64.strict_decode64(bin + '=' * (-bin.size % 4))
end

.encode(bin) ⇒ Object



11
12
13
14
# File 'lib/phc_string_format/b64.rb', line 11

def self.encode(bin)
  return nil unless bin
  Base64.strict_encode64(bin).delete('=')
end