Index: benchmarks/crypto.js |
=================================================================== |
--- benchmarks/crypto.js (revision 362) |
+++ benchmarks/crypto.js (working copy) |
@@ -1674,16 +1674,23 @@ |
setupEngine(am3, 28); |
-var RSA = new RSAKey(); |
-var TEXT = "The quick brown fox jumped over the extremely lazy frogs!"; |
+var TEXT = "The quick brown fox jumped over the extremely lazy frog! " + |
+ "Now is the time for all good men to come to the party."; |
+var encrypted; |
-RSA.setPublic(nValue, eValue); |
-RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); |
- |
function encrypt() { |
- return RSA.encrypt(TEXT); |
+ var RSA = new RSAKey(); |
+ RSA.setPublic(nValue, eValue); |
+ RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); |
+ encrypted = RSA.encrypt(TEXT); |
} |
function decrypt() { |
- return RSA.decrypt(TEXT); |
+ var RSA = new RSAKey(); |
+ RSA.setPublic(nValue, eValue); |
+ RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); |
+ var decrypted = RSA.decrypt(encrypted); |
+ if (decrypted != TEXT) { |
+ throw new Error("Crypto operation failed"); |
+ } |
} |