Revision [401]

Last edited on 2007-04-15 12:50:27 by KlenwellAdmin
Additions:
A note of efficiency : the kwypt_string method basically double-encrypts a string twice using the rc4 method. This is highly inefficient (effectively tripling string length). But it does add a little more security for public data against brute-force trolling attacks. For basic rc4 encryption, there are encrypt and decrypt methods available. (See [[http://klenwell.googlecode.com/svn/trunk/JS/kwyption/kwyption.core.js kwyption.core.js]] and the [[http://klenwell.googlecode.com/svn/trunk/JS/kwyption/rick4.js Rick 4 class]].)


Revision [396]

Edited on 2007-04-12 10:53:40 by KlenwellAdmin
Additions:
----
CategoryJavascript
Deletions:
====Reference====


Revision [395]

Edited on 2007-04-12 10:51:27 by KlenwellAdmin
Additions:
**working example**


Revision [394]

Edited on 2007-04-12 10:50:53 by KlenwellAdmin
Additions:
**simple example**
var key = 'a simple key';
var plaintext = 'This is top secret. Reveal to no one. Unless they have the precious key.'
TheKwyptor.ini(key);
var ciphertext = TheKwyptor.enkwypt_string(plaintext);
alert(ciphertext);
// will display something like: OLRHqz+$XDS3Mb+R3LOAlF55SiiU1v2ekAnh7$dw9IKMK612$FWKthCTlVg$ykpiwfW61oQ174ea6cc8187d9bbdd96358f1a279db43XuuKI$RrrEPKXGUNGievyp$gNOb@VgQ5Gop


Revision [393]

Edited on 2007-04-11 22:50:15 by KlenwellAdmin
Additions:
<!-- from head -->
<!-- from body-->
Deletions:
<!-- External Script -->
<!-- from body -->


Revision [392]

Edited on 2007-04-11 22:49:28 by KlenwellAdmin
Additions:
<!-- External Script -->
Deletions:
<!-- from head -->


Revision [391]

Edited on 2007-04-11 22:48:58 by KlenwellAdmin
Additions:
%%(javascript)
Deletions:
%%(js)


Revision [390]

Edited on 2007-04-11 22:48:40 by KlenwellAdmin
Additions:
%%(js)
<!-- from head -->
<script type="text/javascript" src="http://klenwell.googlecode.com/svn/trunk/JS/kwyption/kwyption.ini.js"></script>
<!-- from body -->
<!-- SCRIPT -->
<!-- end SCRIPT -->
<!-- THE FORM -->
<div id="kwyption_form" class="js_form">
<form name="kwyptor" id="kwyptor">
<h4>plain text</h4>
<textarea id="plaintext" cols="40" rows="4" onfocus="javascript:this.value='';">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</textarea>
<h4>key</h4>
<input id="keytext" name="keytext" type="text" value="your key here" onfocus="javascript:this.value='';" size="24" />
<div class="bx_group">
<input id="bx_encrypt" name="bx_encrypt" type="button" value="encrypt" onclick="javascript:run_encrypt();" />
<input id="bx_decrypt" name="bx_decrypt" type="button" value="decrypt" onclick="javascript:run_decrypt();" />
</div>
<h4>cipher text</h4>
<textarea id="ciphertext" cols="40" rows="4"></textarea>
</form>
</div>
<!-- end FORM -->


Revision [389]

Edited on 2007-04-11 22:46:09 by KlenwellAdmin
Additions:
the code below is the actual code from [[http://klenwell.googlepages.com/demo.kwyption.htm the demo]] listed above
%%
<script type="text/javascript">
/* Create Kwyption Object */
var debug = 0;
var TheKwyptor = new Kwyption(debug);
TheKwyptor.ini();
function run_encrypt()
{
var TheForm = document.forms['kwyptor'];
var TxtKey = TheForm.elements['keytext'];
var TaPlain = TheForm.elements['plaintext'];
var TaCipher = TheForm.elements['ciphertext'];
if ( TaPlain.value == '' )
{
alert('please enter the text you wish to encrypt in the plain text box');
return;
}

TheKwyptor.set_key(TxtKey.value);
TaCipher.value = TheKwyptor.enkwypt_string(TaPlain.value);
TaPlain.value = '';
return;
}
function run_decrypt()
{
var TheForm = document.forms['kwyptor'];
var TxtKey = TheForm.elements['keytext'];
var TaPlain = TheForm.elements['plaintext'];
var TaCipher = TheForm.elements['ciphertext'];
if ( TaCipher.value == '' )
{
alert('please enter the text you wish to decrypt in the cipher text box');
return;
}
else if ( TxtKey.value == '' )
{
alert('please enter your key in the key field');
return;
}

TheKwyptor.set_key(TxtKey.value);
TaPlain.value = TheKwyptor.dekwypt_string(TaCipher.value);
TaCipher.value = '';
return;
}
</script>
%%


Revision [388]

Edited on 2007-04-11 22:08:30 by KlenwellAdmin
Additions:
**license** : [[http://www.opensource.org/licenses/gpl-license.php GPL2]]
**source** : [[http://klenwell.googlecode.com/svn/trunk/JS/kwyption/ google code]]
**demo** : [[http://klenwell.googlepages.com/demo.kwyption.htm klenwell.googlepages.com]]
Deletions:
**License** [[http://www.opensource.org/licenses/gpl-license.php GPL2]]
**Source** [[http://klenwell.googlecode.com/svn/trunk/JS/kwyption/ google code]]
**Demo** [[http://klenwell.googlepages.com/demo.kwyption.htm klenwell.googlepages.com]]


Revision [387]

The oldest known version of this page was created on 2007-04-11 22:08:13 by KlenwellAdmin
Valid XHTML 1.0 TransitionalValid CSSWikkaWiki