- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: regarding password encryption in perl into ***...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2008 06:21 AM
тАО04-17-2008 06:21 AM
Thanks.
BS
Solved! Go to Solution.
- Tags:
- encryption
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2008 06:53 AM
тАО04-17-2008 06:53 AM
Re: regarding password encryption in perl into *****
Use the 'Term::ReadKey' module. You will probably need to fetch it from CPAN.
Regards!
..JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2008 10:25 AM
тАО04-18-2008 10:25 AM
Re: regarding password encryption in perl into *****
Using that CPAN Module we can change the terminal settings but,there is no solution for my Question.
again my question is, when the user types the password from keyboard ,on the screen it should be encrpted as *****.
We can disable the display completely by using system("stty -echo"),But i donast want that ,instead it should display as **** form.
If possible please help me with the line of code which solves my question.
Thanks in Advance,
Regards,
BS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2008 10:31 AM
тАО04-18-2008 10:31 AM
Re: regarding password encryption in perl into *****
> Using that CPAN Module we can change the terminal settings but,there is no solution for my Question.
On the contrary:
# cat ./hidepw
#@(#)hidepw $ Hide password prompt - JRF $
use strict;
use warnings;
use Term::ReadKey;
$SIG{HUP} = 'IGNORE';
$SIG{INT} = 'IGNORE';
$SIG{QUIT} = 'IGNORE';
$SIG{TERM} = sub { ReadMode 'restore'; exit 0 };
my $char;
my @password;
print "Enter password: ";
ReadMode 'noecho';
ReadMode 'raw';
while ( $char = ReadKey 0 ) {
last if $char eq "\n";
next if ( ord($char) < 040 or ord($char) > 0176 );
push @password, $char;
print '*';
}
ReadMode 'restore';
print "\n";
print ">", @password, "<\n";
1;
...run as:
# ./hidepw
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2008 10:54 AM
тАО04-18-2008 10:54 AM
Re: regarding password encryption in perl into *****
Thanks for ur Immediate reply.
I got to know.its like reading character by character and displaying as * for every character.
--BS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2008 10:59 AM
тАО04-18-2008 10:59 AM
Re: regarding password encryption in perl into *****
> I got to know. its like reading character by character and displaying as * for every character.
Yes, that is the underlying mechanism using getc().
By the way, welcome to the Forums. If you are happy with the responses you received, please read the following about assigning points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2008 12:28 AM
тАО04-30-2008 12:28 AM
Re: regarding password encryption in perl into *****
Thanks for letting me know about the Points.
Regarding the above query i tried using your code .it was working with some abnormality.
i.e after entering the pwd if we hit "Enter Key" immediatly it will not come out from loop.again we need to hit the key for 3 to 4 times then its coming out from loop.
please find below chunk of code.
use strict;
use warnings;
use Term::ReadKey;
my $char;
my @password;
print "Enter password: ";
ReadMode 'noecho';
ReadMode 'cbreak';
while ( $char = ReadKey 0 ) {
if($char eq "\r") {
last;
}
push @password, $char;
print '*';
}
ReadMode 'restore';
print "\n";
print ">", @password, "<\n";
Regards,
BS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2008 03:48 AM
тАО04-30-2008 03:48 AM
SolutionTry this version:
# cat ./hidepw
#!/usr/bin/perl
#@(#)hidepw $ Hide password prompt - JRF $
use strict;
use warnings;
use Term::ReadKey;
$SIG{HUP} = 'IGNORE';
$SIG{INT} = 'IGNORE';
$SIG{QUIT} = 'IGNORE';
$SIG{TERM} = sub { ReadMode 'restore'; exit 0 };
my $char;
my @password;
print "Enter password: ";
ReadMode 'noecho';
ReadMode 'raw';
while ( $char = ReadKey 0 ) {
last if ( $char eq "\012" or $char eq "\015" );
next if ( ord($char) < 040 or ord($char) > 0176 );
push @password, $char;
print '*';
}
ReadMode 'restore';
print "\n";
print ">", @password, "<\n";
1;
Regards!
...JRF...