To find a key:

ssh-keygen -H -F hostname              # this often works
ssh-keygen -H -F hostname:port
ssh-keygen -H -F '[hostname]:port'
ssh-keygen -H -F ip_address
ssh-keygen -H -F ip_address:port
ssh-keygen -H -F '[ip_address]:port'   # e.g. '[192.168.1.55]:2202', this appears to be the usual format for nonstandard port entries

Note that all of these are considered different; ssh-keygen will not
automatically print all entries for a host if there are multiple ports for that
host, for instance. This is annoying.


To quickly remove a line from a file (in general):
sed -i 178d .ssh/known_hosts
To do the same with with ssh-keygen (but note that you have to get the format
of the hostname exactly right, see above):
ssh-keygen -R <exact quirky hostname format that worked with -H -F>


About the format of hashed known_hosts:
(from http://security.stackexchange.com/questions/56268/ssh-benefits-of-using-hashed-known-hosts)
for an entry for 192.168.1.61

|1|F1E1KeoE/eEWhi10WpGv4OdiO6Y=|3988QV0VE8wmZL7suNrYQLITLCg= ssh-rsa ...

the first part F1E1KeoE/eEWhi10WpGv4OdiO6Y= is a random salt - that acts as a key for the HMAC-SHA1 to hash 192.168.1.61

You can verify in the command line with:

$ key=`echo F1E1KeoE/eEWhi10WpGv4OdiO6Y= | base64 -d | xxd -p`
$ echo -n "192.168.1.61" | openssl sha1 -mac HMAC -macopt hexkey:$key | awk '{print $2}' | xxd -r -p | base64
3988QV0VE8wmZL7suNrYQLITLCg=