From 0a651bdd5356560dba8c2d6fa9d48469da200337 Mon Sep 17 00:00:00 2001 From: Sean Colyer Date: Thu, 2 Feb 2012 00:28:24 -0500 Subject: [PATCH] Optimized string concatenation in symmetric encryption. Slow large file encryption led to investigating that string concatenation used was inefficient(switched to an array). --- resources/openpgp.js | 12 +++++++++--- resources/openpgp.min.js | 4 ++-- src/ciphers/openpgp.cfb.js | 11 ++++++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/resources/openpgp.js b/resources/openpgp.js index 740d61aa..a01e0103 100644 --- a/resources/openpgp.js +++ b/resources/openpgp.js @@ -8957,10 +8957,13 @@ function openpgp_cfb_encrypt(prefixrandom, blockcipherencryptfn, plaintext, bloc // that we have finished encrypting the 10 octets of prefixed data. // This produces C11-C18, the next 8 octets of ciphertext. for (var i = 2; i < block_size; i++) ciphertext += String.fromCharCode(FRE[i] ^ plaintext.charCodeAt(i)); - + var tempCiphertext = ciphertext.substring(0,2*block_size).split(''); + //var tempCiphertextHeader = ciphertext.substring(0,block_size); + var tempCiphertextString = ciphertext.substring(block_size); for(n=block_size; nb*f;){blocka=d.substring(f*b,f*b+b);a("",c);for(var h=0;hb*g;){for(var k=a(f,c),f=d.substring(g*b+0,g*b+b+0),e=0;e