On Fri, 10 Mar 2000, Mayur Joshi wrote:
> Well thats eaxctly I want. I want 100000 encrypted before it is submittted
> by the browser. That means when a user sees the url in the location bar of
> browser it should be seen something like this.
> http://130.52.10.6/xay.pl?emp_code=dnsadb86h38
> Will the following work?
> my $str = crypt(100000);
This is perl code. What you need is javascript code. I cannot remember
javascript functions of the top of my head so I think the best thing would
be to implement the algo at satya's page (the url is at the footer of his
mails).
> <a href="http://130.52.10.6/xyz.pl?emp_code=$str
This is also wrong and will not work. You will need this:
<script ...>
...
function validate() {
var toEncrypt=document.formname.fieldname.value;
var encrypted=encrypt(toEncrypt);
document.formname.hiddenfieldname.value=encrypted;
document.formname.fieldname.value="";
return true;
}
...
</script>
...
<form ... onSubmit="return validate();">
...
</form>
Of course, this will not work if the browser does not support javascript
or if javascript is disabled.
> How to decode the string when i get it in encrypted form by param in the
> xyz.pl file?
This is weird. See if you can decode the string, then anyone who has
access to your page can decode the string, so it makes no sense encoding
it in the first place.
If you still want to, then you will need to use an invertible funtion to
encrypt the data. I cannot give you a specific example, but constant XOR
is good.
> About the encryption algo you said, well I havent done that before. Can you
> help me in giving me some start in developing that kind of algos.
Check satya's page for his XOR algo. I don't do encryption so I can't
help there.
Philip
To subscribe / unsubscribe goto the site www.ilug-bom.org ., click on the mailing list
button and fill the appropriate information
and submit. For any other queries contact the ML maintener