Fixed bug in find_key_in_known_hosts

This patch fixes a bug where the incorrect key is found if you have one (or more) hostnames which themselves include the names of other hosts, e.g.: host1, host11, host111, ... hostA, hostAA, ...