RSS .92| RSS 2.0| ATOM 0.3
  • Home
  •  

    crypt.pl: crypt() Strings with Salt

    Here is a short perl script to run a string through crypt() with a user defined two character salt. Enjoy!


    #!/usr/bin/perl
    #

    ($NAME=$0) =~ s#.*/##; # get basename from $0

    $salt="00";

    if (@ARGV==2) { $salt=pop(@ARGV); }
    else
    {
    print "salt to use: ";
    chomp($salt=<>);
    }

    if (@ARGV==1) { $string=pop(@ARGV); }
    else
    {
    print "Input-String to crypt: ";
    chomp($string=<>);
    }

    $out=crypt($string, $salt);
    print "The crypt of [$string] with salt [$salt] is [$out]\n";

    Leave a Reply