What is require 'digest/sha1'?

In http://www.aidanf.net/rails_user_authentication_tutorial there is a
string called require ‘digest/sha1’ in the model. What does it do?
Everything else is well explained besides that.

Pål Bergström wrote:

In http://www.aidanf.net/rails_user_authentication_tutorial there is a
string called require ‘digest/sha1’ in the model. What does it do?
Everything else is well explained besides that.

It is an encryption module. It is probably used to encrypt the
password.

Mike Witt wrote:

Pål Bergström wrote:

In http://www.aidanf.net/rails_user_authentication_tutorial there is a
string called require ‘digest/sha1’ in the model. What does it do?
Everything else is well explained besides that.

It is an encryption module. It is probably used to encrypt the
password.

I figured something like that. To bad it isn’t explained. Or maybe it is
and I just don’t see it.

it’s a mixin Digest::sha1. if you’d like you could read about it on
wikipedia.com, look under sha1 or encryption(i think it’s based on an
encryption algorithim called MV4 or something like that, that NASA
developed, although i am far from sure)…it’s quite interesting
(although maybe not that important for developing an application, at
least not more than the information that once something is encrypted,
you can’t go the other way back[decrypt])
if you go to wiki.rubyonrails.com/pages/ and look under the login
generator, there will be more information that you can find through the
pre-written code. . .

either way, enjoy

: )

‘require’ is how you include other source files in ruby, in this case
it’s the digest/sha1 code from the standard ruby library.

Inge Jørgensen wrote:

‘require’ is how you include other source files in ruby, in this case
it’s the digest/sha1 code from the standard ruby library.

thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs