Skip to content
Snippets Groups Projects
Commit b50a93e8 authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

allow option -E to specify hash algorithm

parent 81ddf047
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,32 @@ my ($version, $has_E)= get_ssh_version();
my $hash_algorithm= 'MD5';
my @files= <*.pub>;
push @files, @ARGV if (@ARGV);
while (my $arg= shift (@ARGV))
{
if ($arg eq '--') {}
elsif ($arg =~ m#^--(.+)#)
{
}
elsif ($arg =~ m#^-(.+)#)
{
print ">>> arg=[$arg] 1=[$1]\n";
my @opts= split ('', $1);
foreach my $opt (@opts)
{
if ($opt eq 'E')
{
$has_E= 1;
$hash_algorithm= shift (@ARGV);
print "NOTE: hash_algorithm=[$hash_algorithm]\n";
}
}
}
else
{
push (@files, $arg);
}
}
# print "files: ", join (' ', @files), "\n";
push (@files, <authorized_keys*>);
......@@ -27,6 +52,7 @@ foreach my $file (@files)
my @cmd= qw(ssh-keygen -l);
push (@cmd, '-E', $hash_algorithm) if ($has_E);
push (@cmd, '-f', $file);
# print "cmd: [", join (' ', @cmd), "\n";
my $res= `@cmd`;
my @lines= split ("\n", $res);
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment