From 8e36766d3c970a553f84e7a5c4ef58dc50ed701f Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Sat, 30 Mar 2013 12:24:34 +0100 Subject: [PATCH] Conversion to Digest::SHA --- CGIscriptor.pl | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/CGIscriptor.pl b/CGIscriptor.pl index b85154d..05d2bd5 100755 --- a/CGIscriptor.pl +++ b/CGIscriptor.pl @@ -373,6 +373,19 @@ sub hash_string # ($string) -> hex_hash chomp($hash); return $hash; }; + +# Generate random hex hash +sub get_random_hex # () -> hex +{ + # Create Random Hash Salt + open(URANDOM, "$RANDOMHASHCMD |") || die "URANDOM; $RANDOMHASHCMD | $!\n"; + my $RANDOMSALT= ; + close(URANDOM); + chomp($RANDOMSALT); + + return $RANDOMSALT; +}; + # # You can also use Digest::SHA (SHA.pm), you need sha256_hex # See http://search.cpan.org/~mshelor/Digest-SHA-5.84/lib/Digest/SHA.pm @@ -388,18 +401,17 @@ sub hash_string # ($string) -> hex_hash # return $digest; #}; # - -# Generate random hex hash -sub get_random_hex # () -> hex -{ - # Create Random Hash Salt - open(URANDOM, "$RANDOMHASHCMD |") || die "URANDOM; $RANDOMHASHCMD | $!\n"; - my $RANDOMSALT= ; - close(URANDOM); - chomp($RANDOMSALT); +#sub get_random_hex # () -> hex +#{ + #my $randomstring = ""; + ## Create Random Hash Salt + #open(URANDOM, "