title: RSA Signature is different generated from rsa module and m2crypto
body: <p>I am migrating a service from Python 2.7 to Python 3.5 which communicated with another service using RSA encryption/decryption.</p>
  
  <hr>
  
  <p>Python(v2.7) m2crypto(0.25.1) &lt; Correct Signature ></p>
  
  <pre><code>key = M2Crypto.RSA.load_key(private_key)
  digest = hashlib.sha1(bytes(cipher_text, encoding="UTF-8")).hexdigest()
  signature = hexlify(key.private_encrypt(digest, M2Crypto.RSA.pkcs1_padding))
  </code></pre>
  
  <hr>
  
  <p>Python(v3.5) rsa(v3.4.2)</p>
  
  <pre><code>pri_key = rsa.PrivateKey.load_pkcs1(private_key)
  signature = hexlify(rsa.sign(cipher_text.encode(), pri_key, "SHA-1"))
  </code></pre>
  
  <p>Signature produced by above codes are different. What is the difference between these packages?</p>