title: How to calculate a fingerprint from an RSA public key?
body: <p>With this command it is possible to generate an RSA public-private key pair:</p>
  <pre><code>ssh-keygen -f key
  </code></pre>
  <p>Now I would like to load these keys in Python using module <code>cryptography</code>. Example:</p>
  <pre class="lang-py prettyprint-override"><code>from cryptography.hazmat.backends import default_backend
  from cryptography.hazmat.primitives import serialization
  
  with open(&quot;key.pub&quot;, &quot;rb&quot;) as f:
      datapub = f.read()
  
  public_key = serialization.load_ssh_public_key(datapub, backend=default_backend())
  </code></pre>
  <p>But now: How do you generate a fingerprint from this public key? With OpenSSH this can be done using <code>ssh-keygen -lf key.pub</code>. But how do you the same in Python?</p>