From: "Ara.T.Howard" Date: 2005-06-10T03:08:44+09:00 Subject: Re: How to take password from user On Fri, 10 Jun 2005, James Edward Gray II wrote: > On Jun 9, 2005, at 11:19 AM, sujeet kumar wrote: > >> Hi >> I have to take some password from user in a Ruby Program. I want >> that when he type password an echo character like * prints on screen >> and the program gets the password as string. I am using Ruby function >> "gets" to get password. I don't want password to be seen by others. >> Suggest me some way. > > The HighLine library (http://highline.rubyforge.org/) on RubyForge makes this > (and more) trivial. Here's an example using that library: > > #!/usr/local/bin/ruby -w > > require "rubygems" > require "highline/import" > > pass = ask("Enter your password: ") { |q| q.echo = false } # or q.echo = "*" > puts "Your password is #{pass}!" > > __END__ > > Hope that helps. > > James Edward Gray II does this clear out the password buffer in memory? -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | My religion is very simple. My religion is kindness. | --Tenzin Gyatso ===============================================================================