This page is READ-ONLY. It is generated from the old site.
All timestamps are relative to 2013 (when this page is generated).
If you are looking for TeX support, please go to

ruby: encode64 string

Added by over 3 years ago

From ruby shell

Use ruby shell to get base64 encoded version of any string:

$ irb
> require 'rubygems'
=> true
> require 'activesupport'
=> true
> Base64.encode64("adsf")
=> "YWRzZg==\n" 
> Base64.encode64s("adsf")
=> "YWRzZg==" 

The function encode64s doesnot provide you the "\n" charater.


Below the script (named base64.rb)


require 'rubygems'
require 'activesupport'

ARGV.each do |st|
  est = Base64.encode64s(st)
  puts "#{st}\t=> #{est}" 


$ time base64.rb foobar
foobar  => Zm9vYmFy     => ZXhhbXBsZS5uZXQ=

real    0m0.249s
user    0m0.231s
sys     0m0.017s


Added by over 2 years ago

printf "foobar" | openssl enc -base64