module PhcStringFormat::B64
Implementation of B64
See:
Public Class Methods
decode(bin)
click to toggle source
# 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)
click to toggle source
# File lib/phc_string_format/b64.rb, line 11 def self.encode(bin) return nil unless bin Base64.strict_encode64(bin).delete('=') end