From bd01f266a09177fa702561684a982ab3babb96ef Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Fri, 28 Dec 2018 08:10:57 -0800 Subject: [PATCH] Report total number of keys and number of unique key types --- wack.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wack.pl b/wack.pl index 1771a54..e51877d 100755 --- a/wack.pl +++ b/wack.pl @@ -13,6 +13,7 @@ my $db = tie %wallet, 'BerkeleyDB::Btree', -Flags => DB_RDONLY, or die "Cannot open file $filename: $! $BerkeleyDB::Error\n"; +my $count = 0; my $counts = {}; while (my ($k,$v) = each %wallet) { my $len = unpack("W", substr($k, 0, 1)); @@ -56,11 +57,14 @@ while (my ($k,$v) = each %wallet) { printf "$vlen $type %s:\n", $key; } $counts->{$type}++; + $count++; } printf "\n=====Wallet Key Stats=====\n"; -my @keys = sort { $counts->{$b} <=> $counts->{$a} } keys(%$counts); +my @keys = sort { $counts->{$b} <=> $counts->{$a} } keys(%$counts); +my $numkeys = scalar @keys; for my $k (@keys) { printf "%-25s %s\n", $k, $counts->{$k}; } +printf "Total: $count keys in $numkeys key types\n";