Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Help in masking password

by gasho (Beadle)
on Aug 15, 2006 at 17:46 UTC ( [id://567509]=note: print w/replies, xml ) Need Help??


in reply to Help in masking password

Try this
###################################################################### +####### # This functions will store and retreive pass using crypt # Usage: =begin COMMENT $LocationOfTheScriptsDirectory='D:\InstallV3'; $passFile="$LocationOfTheScriptsDirectory\\as.txt"; $passEncrFile="$LocationOfTheScriptsDirectory\\ass.txt"; $key='test'; $pas='zest'; storePass($key,$pas,$passEncrFile,$passFile); $P=retreivePass($key,$passEncrFile); print $P; $WhoAmI=`whoami`; @SystemUserid=split(/\\/,$WhoAmI); $MyUserId=trim($SystemUserid[1]); #crypt -e myuserid < MyPass.txt > mpcr.txt $MP=`crypt -d $MyUserId < mpcr.txt`; $MyPassword=trim($MP); =end COMMENT =cut sub storePass #($Key,$Pass,$passEncrFile,$passFile) { my($Key,$Pass,$passEncrFile,$passFile)= @_; my($enc); open (OFH,">$passFile") || die "Can't open OFH file: \n"; print OFH $Pass; close OFH; #create $passEncrFile that will hold pass encrypted value $enc=`crypt -e $Key < $passFile > $passEncrFile`; #remove passFile unlink ($passFile); } sub retreivePass #($Key,$passEncrFile) { my($Key,$passEncrFile)= @_; my($cr,$myPassword); $cr=`crypt -d $Key < $passEncrFile`; $myPassword=trim($cr); return $myPassword; }
(: Life is short enjoy it :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://567509]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-25 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found