On Sep 22, 12:00=A0am, Justin Collins <justincoll... / ucla.edu> wrote:
> Junkone wrote:
> > many of my ruby apps have the password hard coded. i am looking for a
> > way so that i can control the password not to be stored as text file.
> > what are the ruby options that are available.
>
> Do you need to know what the stored password is, or do you just need to
> validate passwords?
>
> If the latter, you can use the MD5, SHA1, or SHA2 libraries that come
> with Ruby:
>
> require 'digest/sha1'
>
> #Could load the hash from a file instead
> hash =3D Digest::SHA1.new.update("mypassword")
>
> print "Enter password: "
> input_password =3D gets.strip
>
> if hash =3D=3D Digest::SHA1.new.update(input_password)
> =A0 =A0 =A0 =A0 puts "Access granted."
> else
> =A0 =A0 =A0 =A0 puts "Access denied."
> end
>
> -Justin

i just store passwords in text files. i am looking for a secure way of
keeping these passwords and using it thro ruby as my progs need the
pass.
for eg.  i send auto IM using bot and need my IM pass to be kept
secure.