function encryptByDES(message, key) {
key = CryptoJS.MD5(key);
// copy 3DES subkey 1 to the last 64 bit to make a full 192-bit key
key.words[4] = key.words[0];
key.words[5] = key.words[1];
// create a 64-bit zero filled
var iv = CryptoJS.lib.WordArray.create(64/8);
var encrypted = CryptoJS.TripleDES.encrypt(message, key, {iv: iv});
return encrypted.toString();
};
function decryptByDES(encryptedBase64, key) {
key = CryptoJS.MD5(key);
// copy 3DES subkey 1 to the last 64 bit to make a full 192-bit key
key.words[4] = key.words[0];
key.words[5] = key.words[1];
// create a 64-bit zero filled
var iv = CryptoJS.lib.WordArray.create(64/8);
var ct = { ciphertext: CryptoJS.enc.Base64.parse(encryptedBase64) };
var decrypted = CryptoJS.TripleDES.decrypt(ct, key, {iv: iv});
return decrypted.toString(CryptoJS.enc.Utf8)
};
var key = 'Bsl!ldap2014';
var ADID = 'INOS007445';
var PASSWORD = 'Sep@2020';
var encryptedID = encryptByDES(ADID, key);
var encryptedPass = encryptByDES(PASSWORD, key);
console.log("encryptedID: ", encryptedID);
console.log("encryptedPass: ", encryptedPass);
var decryptedID = decryptByDES(encryptedID, key);
var decryptedPass = decryptByDES(encryptedPass, key);
console.log("decryptedID: ", encryptedID);
console.log("decryptedPass: ", encryptedPass);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.