module Base32
Overview
The Base32 module provides for the encoding (#encode
, #hex_encode
) and
decoding (#decode
, #decode_string
, #hex_decode
, #hex_decode_string
) of
binary data using a Base32 representation as defined in RFC 4648.
Examples
A simple encoding and decoding:
require "base32"
Base32.encode("Hello World!") # => "JBSWY3DPEBLW64TMMQQQ===="
Base32.encode("Hello World!", false) # => "JBSWY3DPEBLW64TMMQQQ"
Base32.decode_string("JBSWY3DPEBLW64TMMQQQ====") # => "Hello World!"
Base32.decode_string("JBSWY3DPEBLW64TMMQQQ") # => "Hello World!"
Extended Modules
Defined in:
base32.crbase32/version.cr
Constant Summary
-
VERSION =
"0.1.1"
Instance Method Summary
-
#decode(data) : Slice(UInt8)
Decode base32 data, regardless if padded or not
-
#decode_string(data) : String
Decode base32 data, regardless if padded or not
-
#encode(data, pad : Bool = true) : String
Encode data as base32 with padding, or without if
pad
= false -
#hex_decode(data) : Slice(UInt8)
Decode base32hex data, regardless if padded or not
-
#hex_decode_string(data) : String
Decode base32hex data, regardless if padded or not
-
#hex_encode(data, pad : Bool = true) : String
Encode data as base32hex with padding, or without if
pad
= false
Instance Method Detail
def encode(data, pad : Bool = true) : String
#
Encode data as base32 with padding, or without if pad
= false
def hex_encode(data, pad : Bool = true) : String
#
Encode data as base32hex with padding, or without if pad
= false