ahsan_ali
07-09-2010, 04:12 AM
:smileys16:
Look at the code same as it in handouts compare this coding
//Encrypt the input string
function Encrypt(input_size, key){
//////// Your encryption code will be here ///////
var i = 0;
var KeyAdded = 0;
var MyAscii = 0;
var MyArray = new Array();
var InputValue = encrypt.enc_input.value
while (i<input_size) {
MyAscii = parseFloat(InputValue.charCodeAt(i));
KeyAdded = parseFloat(MyAscii+key);
MyArray[i] = String.fromCharCode(KeyAdded); // here i am saving each character in valid array
i++;
}
encrypt.enc_output.value = MyArray.join(""); // here is my output of Encoded Output
}
//Decrypt the input string
function Decrypt(input_size, key) {
///////////// Your decryption code will be here /////////////
var i = 0;
var KeyAdded = 0;
var MyAscii = 0;
var MyArray = new Array();
var InputValue = encrypt.dec_input.value
while (i<input_size) {
MyAscii = parseFloat(InputValue.charCodeAt(i));
KeyAdded = parseFloat(MyAscii-key); // subtracting key to reverse encoded conversion
MyArray[i] = String.fromCharCode(KeyAdded); // here i am saving each character in valid array
i++;
}
encrypt.dec_output.value = MyArray.join(""); // here is my output of Original String it works !
}
Please Rate ***:smileys69:
Look at the code same as it in handouts compare this coding
//Encrypt the input string
function Encrypt(input_size, key){
//////// Your encryption code will be here ///////
var i = 0;
var KeyAdded = 0;
var MyAscii = 0;
var MyArray = new Array();
var InputValue = encrypt.enc_input.value
while (i<input_size) {
MyAscii = parseFloat(InputValue.charCodeAt(i));
KeyAdded = parseFloat(MyAscii+key);
MyArray[i] = String.fromCharCode(KeyAdded); // here i am saving each character in valid array
i++;
}
encrypt.enc_output.value = MyArray.join(""); // here is my output of Encoded Output
}
//Decrypt the input string
function Decrypt(input_size, key) {
///////////// Your decryption code will be here /////////////
var i = 0;
var KeyAdded = 0;
var MyAscii = 0;
var MyArray = new Array();
var InputValue = encrypt.dec_input.value
while (i<input_size) {
MyAscii = parseFloat(InputValue.charCodeAt(i));
KeyAdded = parseFloat(MyAscii-key); // subtracting key to reverse encoded conversion
MyArray[i] = String.fromCharCode(KeyAdded); // here i am saving each character in valid array
i++;
}
encrypt.dec_output.value = MyArray.join(""); // here is my output of Original String it works !
}
Please Rate ***:smileys69: