Hack Forums
How can I make a program in Ruby to encode a string? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: How can I make a program in Ruby to encode a string? (/showthread.php?tid=3618374)



How can I make a program in Ruby to encode a string? - gimzy.H-O - Jul 13, 2013

I am learning Ruby (Started two nights ago, doing about 20 mins a night) but I want to make a program that simply encodes a string, yet I have no idea how. Preferably encode in base64.

Just needs to be as simple as

Code
puts "String to encode:"
enc = gets.chomp
#Whatever I need here to encode string

Thanks a bunch :3


* - EmptyRedData - Jul 13, 2013

Quick google search for "ruby base64"
Quote:http://ruby-doc.org/stdlib-2.0/libdoc/base64/rdoc/Base64.html




* - gimzy.H-O - Jul 13, 2013

(Jul 13, 2013 01:21 PM)EmptyRedData Wrote:  Quick google search for "ruby base64"

Oh derp. I'm not thinking straight tonight. Thanks.

/solved