title: python RSA encrypt differs from JSEncrypt?
body: <p>I am writing a crawler using python. The website uses JSEncrypt to encrypt password. The JS code is as follows:</p>
  
  <pre><code>var pubkey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDB3Xn/+WP5OVbA8hCj3zuTlqAJ+CVt5UPHi1TYTbsBzEZ0W0+tgn9YElA9hNIi5ElFTicpGCYW4w+B2zmniSLKy3sqItT1wNCt6zGJ7lkUCkhLSIY4mp9Tqs8hn01/3HNnqDRBPhFcmA99Vy+SOoTUvCOUMiGp4ENruyxkvEp5vwIDAQAB"
  var encrypt = new JSEncrypt();
  encrypt.setKey(pubkey)
  encrypt.encrypt("123")
  </code></pre>
  
  <p>And my python codes are:</p>
  
  <pre><code>from Crypto.Cipher import PKCS1_v1_5
  from Crypto.PublicKey import RSA
  import base64
  pubkey = '''-----BEGIN PUBLIC KEY-----
  MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDB3Xn/+WP5OVbA8hCj3zuTlqAJ
  +CVt5UPHi1TYTbsBzEZ0W0+tgn9YElA9hNIi5ElFTicpGCYW4w+B2zmniSLKy3sq
  ItT1wNCt6zGJ7lkUCkhLSIY4mp9Tqs8hn01/3HNnqDRBPhFcmA99Vy+SOoTUvCOU
  MiGp4ENruyxkvEp5vwIDAQAB
  -----END PUBLIC KEY-----'''
  rsa_key = RSA.importKey(pubkey)
  cipher = PKCS1_v1_5.new(rsa_key)
  print base64.b64encode(cipher.encrypt("123"))
  </code></pre>
  
  <p>But their results are different. Also, I found that these codes produce different encryption output each time called. With the same key and plaintext, shouldn't rsa algorithm return the same output?</p>