module Roda::RodaPlugins::Base64_

def decode64(str)

def decode64(str)
  str.unpack1("m0")
end

def decode64(str)

def decode64(str)
  str.unpack("m0")[0]
end

def urlsafe_decode64(str)

def urlsafe_decode64(str)
  decode64(str.tr("-_", "+/"))
end

def urlsafe_encode64(bin)

def urlsafe_encode64(bin)
  str = [bin].pack("m0")
  str.tr!("+/", "-_")
  str
end