EnochRoot has asked for the wisdom of the Perl Monks concerning the following question:
sub generate_apache_bcrypt_hash { my($plaintext) = @_; my $bcrypt_hash = ''; try { $bcrypt_hash = capturex("/bin/htpasswd","-nbB","''", $plaintext); } catch { print STDERR "generate_apache_bcrypt_hash = '$_'\n" if $DEBUG; }; # remove: # - extra 3 chars at the front # - 1 trailing spaces # - line break $bcrypt_hash = substr $bcrypt_hash,3; chomp($bcrypt_hash); chop($bcrypt_hash); return $bcrypt_hash }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sanitize user input for system() call
by oiskuu (Hermit) on May 19, 2015 at 20:29 UTC | |
by EnochRoot (Novice) on May 19, 2015 at 23:27 UTC | |
|
Re: sanitize user input for system() call (yes)
by tye (Sage) on May 19, 2015 at 19:13 UTC | |
by EnochRoot (Novice) on May 19, 2015 at 19:17 UTC | |
|
Re: sanitize user input for system() call
by Anonymous Monk on May 19, 2015 at 20:59 UTC | |
by EnochRoot (Novice) on May 19, 2015 at 23:28 UTC |