I'm working in Base64 in Ruby on Rails and have a question:
For example how would the following be Base64 encoded / decoded?
<a href="myroute?id=<%[email protected]%>"> MY LINK</a>
To create Base64 try this:
def create_base_64
begin
#for create
a = 1
b = Base64.encode64(a.to_s)
# for decoding
c = Base64.decode64(b)
puts c
rescue Exception => e
puts e
end
end
For more security try to broke it. For example:
b[1] = b[1] << SecureRandom.hex(1)
And other action, you recived the param b:
b = params[:b]
b[2]=""
b[2]=""
c = base64.decode64(b.to_s)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With