module Base
Defined in:
base.crbase/converters.cr
Constant Summary
-
CONVERTERS =
{"16" => {from: ->(hex : String) do hex.hexbytes end, to: ->(binary : Bytes, opts : Options) do binary.hexstring end}, "32" => {from: ->(base32 : String) do Base32.decode(base32.upcase) end, to: ->(binary : Bytes, opts : Options) do (Base32.encode(binary, opts.output_padding)).downcase end}, "64" => {from: ->(base64 : String) do Base64.decode(base64) end, to: ->(binary : Bytes, opts : Options) do base64 = Base64.urlsafe_encode(binary, opts.output_padding) if opts.output_url_safe else base64 = base64.tr("-_", "+/") end base64 end}}
-
Lambdas to convert :from the format to binary, or from binary :to the format