Every line of 'md4 decrypt' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
71 function decryptAES(msg, c, iv) { 72 var opts = { 73 mode: CryptoJS.mode.CTR, 74 iv: correctIvLength(iv), 75 padding: CryptoJS.pad.NoPadding 76 }; 77 var aesctr = CryptoJS.AES.decrypt( 78 msg, 79 c, 80 opts 81 ); 82 return aesctr; 83 }
53 function decrypt(ciphertextAndNonce, key) { 54 // Create buffers of nonce, ciphertext and tag. 55 let nonce = ciphertextAndNonce.slice(0, ALGORITHM_NONCE_SIZE); 56 let ciphertext = ciphertextAndNonce.slice(ALGORITHM_NONCE_SIZE, ciphertextAndNonce.length - ALGORITHM_TAG_SIZE); 57 let tag = ciphertextAndNonce.slice(ciphertext.length + ALGORITHM_NONCE_SIZE); 58 59 // Create the cipher instance. 60 let cipher = crypto.createDecipheriv(ALGORITHM_NAME, key, nonce); 61 62 // Decrypt and return result. 63 cipher.setAuthTag(tag); 64 return Buffer.concat([ cipher.update(ciphertext), cipher.final() ]); 65 }
153 return function decrypt(_x6, _x7, _x8) { 154 return _ref2.apply(this, arguments); 155 };
152 function aesDecrypt(ivCiphertext, myPrivateKey, theirPublicKey, nonce) { 153 if (ivCiphertext.length < 16 || ivCiphertext.length % 16 != 0) { 154 throw { 155 name: "invalid ciphertext" 156 }; 157 } 158 var iv = converters.byteArrayToWordArray(ivCiphertext.slice(0, 16)); 159 var ciphertext = converters.byteArrayToWordArray(ivCiphertext.slice(16)); 160 var sharedKey = getSharedKey(myPrivateKey, theirPublicKey); 161 for (var i = 0; i < 32; i++) { 162 sharedKey[i] ^= nonce[i]; 163 } 164 var key = CryptoJS.SHA256(converters.byteArrayToWordArray(sharedKey)); 165 var encrypted = CryptoJS.lib.CipherParams.create({ 166 ciphertext: ciphertext, 167 iv: iv, 168 key: key 169 }); 170 var decrypted = CryptoJS.AES.decrypt(encrypted, key, { 171 iv: iv 172 }); 173 var plaintext = converters.wordArrayToByteArray(decrypted); 174 175 return plaintext; 176 }