#!/bin/perl -w use strict; use diagnostics; use Shell; print "Enter your username: "; my $USER = ; chop ($USER); print "Password: "; my $PASS = ; chop($PASS); # ypmatch is a linux shell command. my $str = ypmatch("$USER", "passwd"); chop($str); my @Tmp = split(":", $str); my $Tr = $Tmp[1]; my $salt = substr($Tr, 0, 2); my $ENCPASS = crypt($PASS,$salt); print "-------------------------------------------------\n"; print "String from yp: $str\n"; print "Transformed to: $Tr\n"; print "Salt for pass: $salt\n"; print "Your encrypted Password: $ENCPASS\n"; print "Password from ypcat: $Tr\n";