tag:blogger.com,1999:blog-85871891484352020292024-02-20T13:08:52.821-08:00Encrypt/DecryptEncrypt or Decrypt your data, emails, messages, URLs etc.Unknownnoreply@blogger.comBlogger4125tag:blogger.com,1999:blog-8587189148435202029.post-4211412171189871052010-09-12T19:03:00.000-07:002011-03-10T04:40:48.842-08:00Password Protected Message<script type='text/javascript'>
/************************************************************************
* Copyright 2001 by Terry Yuen.
* Email: kaiser40@yahoo.com
* Last update: July 15, 2001.
* To implement this script onto your page, copy and paste the Javascript
* on this page and place it in the page that you want the encryption
* routine available on. Then use the function "encrypt()" to encrypt
* data. This function takes two parameters. The first parameter is the
* plain text string and the second parameter is the key. The returned
* string is the encrypted string. To decrypt the string, use the
* function "decrypt()" with the encrypted string as the first parameter
* and key as the second parameter. It returns the decrypted string.
*
* Examples:
* var secret = encrypt("My surprise will consist of ....", "password");
* document.writeln(secret);
*
* document.form[0].elements[1].value = decrypt(document.form[0].elements[0].value, "password");
*
*************************************************************************/
/*
String.prototype.chunk = function(n) {
if (typeof n=='undefined') n=2;
return this.match(RegExp('.{1,'+n+'}','g'));
};
*/
function encrypt(str, pwd) {
if(pwd == null || pwd.length <= 0) {
alert("Please enter a password with which to encrypt the message.");
return null;
}
var prand = "";
for(var i=0; i<pwd.length; i++) {
prand += pwd.charCodeAt(i).toString();
}
var sPos = Math.floor(prand.length / 5);
var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
var incr = Math.ceil(pwd.length / 2);
var modu = Math.pow(2, 31) - 1;
if(mult < 2) {
alert("Algorithm cannot find a suitable hash. Please choose a different password. \nPossible considerations are to choose a more complex or longer password.");
return null;
}
var salt = Math.round(Math.random() * 1000000000) % 100000000;
prand += salt;
while(prand.length > 10) {
prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
}
prand = (mult * prand + incr) % modu;
var enc_chr = "";
var enc_str = "";
for(var i=0; i<str.length; i++) {
enc_chr = parseInt(str.charCodeAt(i) ^ Math.floor((prand / modu) * 255));
if(enc_chr < 16) {
enc_str += "0" + enc_chr.toString(16);
} else enc_str += enc_chr.toString(16);
prand = (mult * prand + incr) % modu;
}
salt = salt.toString(16);
while(salt.length < 8)salt = "0" + salt;
enc_str += salt;
// editing starts
String.prototype.chunk = function(n) {
if (typeof n=='undefined') n=2;
return this.match(RegExp('.{1,'+n+'}','g'));
};
// dividing string into chunks
var charray = enc_str.chunk(8);
enc_str = "";
for(i=0; i<charray.length; i++)
enc_str = enc_str + charray[i] + " ";
enc_str += " encryptdecrypt.blogspot.com";
// editing ends
return enc_str;
}
function decrypt(str, pwd) {
if(str == null || str.length < 8) {
alert("A salt value could not be extracted from the encrypted message because it's length is too short. The message cannot be decrypted.");
return;
}
if(pwd == null || pwd.length <= 0) {
alert("Please enter a password with which to decrypt the message.");
return;
}
// editing starts
// removing append
str = str.substr(0, str.length-28);
// removing whitespaces
str = str.replace(/\s+/g,'');
// editing ends
var prand = "";
for(var i=0; i<pwd.length; i++) {
prand += pwd.charCodeAt(i).toString();
}
var sPos = Math.floor(prand.length / 5);
var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
var incr = Math.round(pwd.length / 2);
var modu = Math.pow(2, 31) - 1;
var salt = parseInt(str.substring(str.length - 8, str.length), 16);
str = str.substring(0, str.length - 8);
prand += salt;
while(prand.length > 10) {
prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
}
prand = (mult * prand + incr) % modu;
var enc_chr = "";
var enc_str = "";
for(var i=0; i<str.length; i+=2) {
enc_chr = parseInt(parseInt(str.substring(i, i+2), 16) ^ Math.floor((prand / modu) * 255));
enc_str += String.fromCharCode(enc_chr);
prand = (mult * prand + incr) % modu;
}
return enc_str;
}
// End -->
</script>
<style type='text/css'>
<!--
.html
{
width: 910px;
margin: auto;
background: #ffffff;
padding-bottom: 1px;
padding-top: 1px;
}
.html form
{
}
.html table
{
}
.html textarea
{
width: 895px;
height: 200px;
background: #eeeeee;
border: 0px;
}
.html input[type=text]
{
width: 390px;
//width: 390px;
margin-left: 5px;
border: 1px solid #cccccc;
//background: #eeeeee url(http://i53.tinypic.com/2evayde.jpg);
}
.html input[type=button]
{
width: 250px;
}
.html .title
{
font-size: 20px;
font-style: 'lucida console';
//margin-left: 10px;
padding-left: 10px;
margin-top: 10px;
width: 890px;
background: #dddddd;
color: #666;
}
.html .get
{
margin-top: 10px;
border: 0px;
margin-left: 5px;
}
.html .passinput
{
margin-top: 10px;
background: #ffffff;
}
.html .desc
{
font-size: 18px;
font-style: 'lucida console';
margin-left: 5px;
padding-left: 10px;
margin-bottom: 5px;
margin-top: 10px;
width: 890px;
background: #ffffff;
margin-bottom: 10px;
color: #666;
}
//-->
</style>
<div class='html'>
<form name="box">
<div class='get'>
<div class='title'>Simple Text</div>
<textarea wrap=virtual name=ipt></textarea>
</div>
<div class='get'>
<div class='title'>Encrypted Message:</div>
<textarea wrap=virtual name=opt></textarea>
</div>
<div class='passinput'>
<input type="text" name="pwd" value="">
<input type="button" onclick="document.box.opt.value= encrypt(document.box.ipt.value, document.box.pwd.value);" value="Encrypt"/>
<input type="button" onclick="document.box.ipt.value= decrypt(document.box.opt.value, document.box.pwd.value);" value="Decrypt"/>
</div>
</form>
<div class='desc'>You can encrypt and decrypt a message with your password. Your passwords remain on your computer and are not sent to anyone, so they're absolutely safe whilst using this tool.</div>
<div class='desc'>This tool converts a <b>simple text</b> into <b>encrypted message</b> and vice versa.</div>
<div class='desc'>Note: Please keep in mind that you need all the encrypted message including encryptdecrypt.blogspot.com in the text to successfully decrypt the message.</div>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8587189148435202029.post-70104276979485718402010-09-12T15:56:00.000-07:002010-09-12T20:40:43.055-07:00Base64 Message Encryption Ver 2<script type='text/javascript'>
<!--
/**
*
* Base64 encode / decode
* http://www.webtoolkit.info/
*
**/
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
function enc1(input)
{
return Base64.encode(input)+"\n\nThis message is encrypted using base64 encryption from http://encryptdecrypt.blogspot.com";
}
function dec1(input)
{
var raw=input.substr(0, input.length - 90);
return Base64.decode(raw);
}
function enc2(input)
{
return "b6"+Base64.encode(input);
}
function dec2(input)
{
var raw=input.substr(2, input.length);
return Base64.decode(raw);
}
function enc3(input)
{
var code="b7"+Base64.encode(input);
String.prototype.chunk = function(n) {
if (typeof n=='undefined') n=2;
return this.match(RegExp('.{1,'+n+'}','g'));
return code.chunk(8);
}
function dec3(input)
{
var code = input.replace(/\s+/g,'');
code = code.substr(2, code.length);
return Base64.decode(code);
}
//-->
</script>
<form name='message_encryption_base64'>
<textarea rows='5' cols='50' name='textarea1'>Text to Encrypt/Decrypt</textarea>
<input type='button' value='Encrypt Message' onclick="document.message_encryption_base64.textarea1.value=enc3(document.message_encryption_base64.textarea1.value)" />
<input type='button' value='Decrypt Message' onclick="document.message_encryption_base64.textarea1.value=dec3(document.message_encryption_base64.textarea1.value)" />
</form>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8587189148435202029.post-18172736045257081302010-03-24T08:22:00.000-07:002010-09-12T20:08:08.953-07:00Base64 Encrypt/Decrypt<script type='text/javascript'>
<!--
/**
*
* Base64 encode / decode
* http://www.webtoolkit.info/
*
**/
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
function enc1(input)
{
return Base64.encode(input)+"\n\nThis message is encrypted using base64 encryption from http://encryptdecrypt.blogspot.com";
}
function dec1(input)
{
var raw=input.substr(0, input.length - 90);
return Base64.decode(raw);
}
function enc2(input)
{
var x= "b6"+Base64.encode(input);
String.prototype.chunk = function(n) {
if (typeof n=='undefined') n=2;
return this.match(RegExp('.{1,'+n+'}','g'));
};
// dividing string into chunks
return x;
}
function dec2(input)
{
var raw=input.substr(2, input.length);
//raw = raw.replace(/\s+/g,'');
return Base64.decode(raw);
}
//-->
</script>
<form name='message_encryption_base64'>
<textarea rows='5' cols='50' name='textarea1'>Text to Encrypt/Decrypt</textarea>
<input type='button' value='Encrypt Message' onclick="document.message_encryption_base64.textarea1.value=enc2(document.message_encryption_base64.textarea1.value)" />
<input type='button' value='Decrypt Message' onclick="document.message_encryption_base64.textarea1.value=dec2(document.message_encryption_base64.textarea1.value)" />
</form>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8587189148435202029.post-3487264321569260592010-03-24T08:02:00.000-07:002010-03-24T08:21:53.842-07:00Encrypt URLs<script type='text/javascript'>
<!--
/**
*
* Base64 encode / decode
* http://www.webtoolkit.info/
*
**/
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
//-->
</script>
<form name='formencrypturl' />
<input type='text' value='' name='formencrypturl_textinput' size='50' /><br/>
<input type='button' value='Encrypt URL' onClick="document.formencrypturl.formencrypturl_textinput.value='http://3mbs.blogspot.com/?'+Base64.encode(document.formencrypturl.formencrypturl_textinput.value)" />
</form>Unknownnoreply@blogger.com0