module Base64
def encode64(bin)
Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
s = "This is line 1\nThis is line 2\n"
Base64.encode64("\n\n\n") # => "CgoK\n"
which will be encoded as ordinary \Base64:
The string to be encoded may itself contain newlines,
# => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq\nKg==\n"
Base64.encode64('*' * 46)
Base64.encode64('*') # => "Kg==\n"
see {Newlines}[Base64.html#module-Base64-label-Newlines] above:
will have one or more embedded newline characters;
The returned string ends with a newline character, and if sufficiently long
Base64.encode64('*') # => "Kg==\n"
see {Padding}[Base64.html#module-Base64-label-Padding] above.
The returned string may include padding;
Base64.encode64("\xFF\xFF\xFF") # => "////\n"
Base64.encode64("\xFB\xEF\xBE") # => "++++\n"
see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
+ or /;
Per RFC 2045, the returned string may contain the URL-unsafe characters
Returns a string containing the RFC-2045-compliant \Base64-encoding of +string+.
Base64.encode64(string) -> encoded_string
:call-seq:
def encode64(bin) [bin].pack("m") end