我正在Ruby on Rails中的Base64中工作,并且有一个问题:
例如,以下将如何对Base64进行编码/解码?
<a href="myroute?id=<%[email protected]%>"> MY LINK</a>
要创建Base64,请尝试以下操作:
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
为了提高安全性,请尝试将其破解。例如:
b[1] = b[1] << SecureRandom.hex(1)
其他操作,您获得了参数b:
b = params[:b]
b[2]=""
b[2]=""
c = base64.decode64(b.to_s)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句