Hi, I know that there is a way to encrypt passwords, but what would be the easiest? For example you have 2 functions in php. You use them by calling: fuction("data-to-be-encrypted-here"); But is there a similar way in ruby on rails?
You can use one of the Ruby digest package: http://www.ruby-doc.org/stdlib/libdoc/digest/rdoc/index.html For example, if you want to digest a password with SHA 512: require ''digest/sha2'' Digest::SHA2.hexdigest(''password'', 512) Regards. Franco Catena. On May 8, 6:18 pm, Lakridserne <kristoffer.han...-dBeNsRhVotRknbxzx/v8hQ@public.gmane.org> wrote:> Hi, > > I know that there is a way to encrypt passwords, but what would be the > easiest? > For example you have 2 functions in php. You use them by calling: > > fuction("data-to-be-encrypted-here"); > > But is there a similar way in ruby on rails?
Thanks. I looked at it, but could not understand it. I will use md5 because I also use it in my PHP-applications, and I can therefore use the same data without reset users passwords and so on. Can I do that and how? On 9 Maj, 17:38, Franco Catena <francocat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You can use one of the Ruby digest package:http://www.ruby-doc.org/stdlib/libdoc/digest/rdoc/index.html > > For example, if you want to digest a password with SHA 512: > > require ''digest/sha2'' > > Digest::SHA2.hexdigest(''password'', 512) > > Regards. > > Franco Catena. > > On May 8, 6:18 pm, Lakridserne <kristoffer.han...-dBeNsRhVotRknbxzx/v8hQ@public.gmane.org> wrote: > > > Hi, > > > I know that there is a way to encrypt passwords, but what would be the > > easiest? > > For example you have 2 functions in php. You use them by calling: > > > fuction("data-to-be-encrypted-here"); > > > But is there a similar way in ruby on rails?
Is the same thing: require ''digest'' Digest::MD5.hexdigest(''password'') You need to know how to read an API, you must use it every day ... The "always open" are: http://www.ruby-doc.org/core/ and http://api.rubyonrails.org/ Expend a while figuring it out. Regards. Franco Catena. On May 12, 5:46 pm, Lakridserne <kristoffer.han...-dBeNsRhVotRknbxzx/v8hQ@public.gmane.org> wrote:> Thanks. I looked at it, but could not understand it. I will use md5 > because I also use it in my PHP-applications, and I can therefore use > the same data without reset users passwords and so on. Can I do that > and how? > > On 9 Maj, 17:38, Franco Catena <francocat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > You can use one of the Ruby digest package:http://www.ruby-doc.org/stdlib/libdoc/digest/rdoc/index.html > > > For example, if you want to digest a password with SHA 512: > > > require ''digest/sha2'' > > > Digest::SHA2.hexdigest(''password'', 512) > > > Regards. > > > Franco Catena. > > > On May 8, 6:18 pm, Lakridserne <kristoffer.han...-dBeNsRhVotRknbxzx/v8hQ@public.gmane.org> wrote: > > > > Hi, > > > > I know that there is a way to encrypt passwords, but what would be the > > > easiest? > > > For example you have 2 functions in php. You use them by calling: > > > > fuction("data-to-be-encrypted-here"); > > > > But is there a similar way in ruby on rails?
Thanks that helped On May 13, 5:27 am, Franco Catena <francocat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is the same thing: > > require ''digest'' > > Digest::MD5.hexdigest(''password'') > > You need to know how to read an API, you must use it every day ... The > "always open" are: > > http://www.ruby-doc.org/core/andhttp://api.rubyonrails.org/ > > Expend a while figuring it out. > > Regards. > > Franco Catena. > > On May 12, 5:46 pm, Lakridserne <kristoffer.han...-dBeNsRhVotRknbxzx/v8hQ@public.gmane.org> wrote: > > > Thanks. I looked at it, but could not understand it. I will use md5 > > because I also use it in my PHP-applications, and I can therefore use > > the same data without reset users passwords and so on. Can I do that > > and how? > > > On 9 Maj, 17:38, Franco Catena <francocat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > You can use one of the Ruby digest package:http://www.ruby-doc.org/stdlib/libdoc/digest/rdoc/index.html > > > > For example, if you want to digest a password with SHA 512: > > > > require ''digest/sha2'' > > > > Digest::SHA2.hexdigest(''password'', 512) > > > > Regards. > > > > Franco Catena. > > > > On May 8, 6:18 pm, Lakridserne <kristoffer.han...-dBeNsRhVotRknbxzx/v8hQ@public.gmane.org> wrote: > > > > > Hi, > > > > > I know that there is a way to encrypt passwords, but what would be the > > > > easiest? > > > > For example you have 2 functions in php. You use them by calling: > > > > > fuction("data-to-be-encrypted-here"); > > > > > But is there a similar way in ruby on rails?