A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Base64 Encode Decode in Ruby page! Here, you'll find the source code for this program as well as a description of how the program works.
# frozen_string_literal: true
require "base64"
USAGE = "Usage: please provide a mode and a string to encode/decode"
mode, input = ARGV
abort(USAGE) if mode.nil? || input.nil? || input.strip.empty?
case mode
when "encode"
puts Base64.strict_encode64(input)
when "decode"
begin
puts Base64.strict_decode64(input)
rescue
abort(USAGE)
end
else
abort(USAGE)
end
Base64 Encode Decode in Ruby was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.