#!/usr/bin/perl # FILE: encrypt_it # Demonstrates how to # - encode a string using the crypt() function, # - compare to user input # Note: the encryption is irreversible! use warnings; use strict; my $password = "t4st1ng"; my $salt = "s2"; #$salt is a 2 character string choses from [a-zA-Z0-9./] $password = crypt ($password, $salt); `stty -echo`; print ("what is your password?\n"); chomp(my $answer = ); `stty echo`; if (crypt($answer,$salt) eq $password) { print "success" } else { print "failure" } print "\n";