#!/usr/bin/env perl

use strict;
use Crypt::SaltedHash;

my $prompt = 'Enter plain-text password ?> ';
my $plain_text;

# falls back to Term::ReadPassword on other systems
eval "use Term::ReadPassword::Win32";
if ($@) {
    print $prompt;
    chomp($plain_text = <>);
} else {
    $plain_text = Term::ReadPassword::Win32::read_password($prompt);
}


my $csh = Crypt::SaltedHash->new(algorithm => 'SHA-1');
$csh->add($plain_text);
my $salted = $csh->generate;

print "Result: $salted\n";

