From 31f9064e90fc82d2fc5fd849a039eb8e223cd944 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Tue, 25 Feb 2014 10:50:12 +0100 Subject: [PATCH] use string instead of array in cfb encrypt --- src/crypto/cfb.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/crypto/cfb.js b/src/crypto/cfb.js index 3bb9e1c6..6d21c3e4 100644 --- a/src/crypto/cfb.js +++ b/src/crypto/cfb.js @@ -130,7 +130,7 @@ module.exports = { ciphertext += String.fromCharCode(FRE[i] ^ plaintext.charCodeAt(i)); } - var tempCiphertext = ciphertext.substring(0, 2 * block_size).split(''); + var tempCiphertext = ciphertext.substring(0, 2 * block_size); var tempCiphertextString = ciphertext.substring(block_size); var tempCiphertextBlock; for (n = block_size; n < plaintext.length; n += block_size) { @@ -148,11 +148,11 @@ module.exports = { // process is repeated until the plaintext is used up. for (i = 0; i < block_size; i++) { tempCiphertextBlock = String.fromCharCode(FRE[i] ^ plaintext.charCodeAt(n + i)); - tempCiphertext[tempCiphertext.length] = tempCiphertextBlock; + tempCiphertext += tempCiphertextBlock; tempCiphertextString += tempCiphertextBlock; } } - ciphertext = tempCiphertext.join(''); + ciphertext = tempCiphertext; } ciphertext = ciphertext.substring(0, plaintext.length + 2 + block_size);