Why JSEncrypt encrypt password is different each time?

76 views Asked by At

I find that JSEncrypt encrypt.encrypt(password) with the same publicKey is different each time, such as: "G8PHyuxAsH3GcDPx3In7fpFVbu0o+APElFFjUJjtdn2mKZy+X1G8b3X3W+C5ANKNrtlPlx8cTPzCgpLKGfGy9g==""T0rPL4z48ZQ6Sve7Bljj/FAnSMZodiooYpB31S8oZOCaRFnKtDZ6UtvNv5xHL3hz/abW+2gybVpHWVDgEX5DYA==". But I can decrypt password correctly from them with privateKey.

jsencrypt.min.js

version: "3.0.0-rc.1"

function encryptPwd(password) {
    
    if (storeData.initData.publicKey) {
      var encrypt = new JSEncrypt();
      encrypt.setPublicKey(storeData.initData.publicKey);

      return encrypt.encrypt(password);
    } else {
      
      return encryptMd5(password);
    }
  }
0

There are 0 answers