Click to See Complete Forum and Search --> : Encrypt and Decrypt... Please help


soreijdfinnu
10-24-2003, 10:53 PM
Hi I'm new here and am new to javascript as well.
I'm wondering that, as I've made myself a code for the english alphabets (like a becomes h, b becomes r, c becomes t...), can javascript help me encrypt and decrypt, like putting a little tool on my webpage?
Please help. Thanks a lot!

Jeff Mott
10-24-2003, 11:52 PM
can javascript help me encrypt and decrypt, like putting a little tool on my webpage?Yes it can. ;)
Though unless someone here decides to write the entire program for you, you'll have to make your question a little more specific.

BTW, I hope you don't plan on using the form of encryption you speak of for any kind of real security. Simple substitution ciphers are the simplest form of encryption, and thus the simplest to break.

Charles
10-25-2003, 04:59 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>

<style type="text/css">
<!--
label {display:block; margin:1em 0em}
input {display:block}
-->
</style>

<form action="">
<div>
<label>Text<input type="text" onchange="this.form.encoded.value = this.value.replace(/./g, function (c) {var r = {a:'h', b:'r', c:'t'}[c]; return r ? r : c})"></label>
<label>Encoded<input type="text" name="encoded" disabled></label>
</div>
</form>