How to check if a string is base 64 encoded in Ruby?
You could do a quick check with a regular expression. Something like [A-Za-z0-9+\/]+={0,3}
is pretty close. Then check to see if the length is divisible by 4.
http://en.wikipedia.org/wiki/Base64