server=localhost
ssh-keygen -l -E md5 -f <(ssh-keyscan $server 2>/dev/null)

https://unix.stackexchange.com/questions/126908/get-ssh-server-key-fingerprint