code: def fingerprint_from_ssh_pub_key(data):
      
      data = data.strip()
  
      # Let's accept either:
      # - just the base64 encoded data part, e.g.
      #   'AAAAB3NzaC1yc2EAAAABIwAA...2l24uq9Lfw=='
      # - the full ssh pub key file content, e.g.:
      #   'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAA...2l24uq9Lfw== my comment'
      if (re.search(r'^ssh-(?:rsa|dss) ', data) or
          re.search(r'^ecdsa-sha2-nistp(?:[0-9]+)', data)):
          data = data.split(None, 2)[1]
  
      key = base64.b64decode(data)
      fp_plain = hashlib.md5(key).hexdigest()
      return ':'.join(a + b for a, b in zip(fp_plain[::2], fp_plain[1::2]))
docs: Calculate the fingerprint of SSH public key data.
  
      >>> data = "ssh-rsa AAAAB3NzaC1y...4IEAA1Z4wIWCuk8F9Tzw== my key comment"
      >>> fingerprint_from_ssh_pub_key(data)
      '54:c7:4c:93:cf:ff:e3:32:68:bc:89:6e:5e:22:b5:9c'
  
      Adapted from <http://stackoverflow.com/questions/6682815/>
      and imgapi.js#fingerprintFromSshpubkey.