 |
05-24-2006, 08:37 AM
|
Encrption in HTML
|
Posts: 6
|
Hello,
I need to encrypt a word in HTML, how to do it?
if i give letter A then the answer should be some other word .
how to do it ?
thanks,
Jayender
|
|
|
|
05-24-2006, 08:47 AM
|
Re: Encrption in HTML
|
Posts: 13,486
Location: Blackpool. UK
|
you can't in HTML
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
|
|
|
|
05-24-2006, 08:53 AM
|
Re: Encrption in HTML
|
Posts: 6
|
Is there any other way?
Please like java script ?
|
|
|
|
05-24-2006, 09:02 AM
|
Re: Encrption in HTML
|
Posts: 13,486
Location: Blackpool. UK
|
it's possible in javascript
but pointless and why would you want to anyway?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
|
|
|
|
05-24-2006, 09:06 AM
|
Re: Encrption in HTML
|
Posts: 6
|
Hey thats fine dude..
i need to do it .. thats all.. what makes u to say point less?
I am new to this .. but worth it doing i felt ..
waiting for the solution
thanks,
Jay
|
|
|
|
05-24-2006, 09:12 AM
|
Re: Encrption in HTML
|
Posts: 1,626
Location: Guildford, UK
|
What exactly do you need to encrypt, and what sort of encryption do you need?
There's a number of different types of encryption and ways of implementing them (such as private/public key cryptography for transfering encrypted messages over an insecure medium, one way MD5/SHA-1/etc hashing for secure password authentication and checksums, simple password protected encryption for example to put a password on a file, plus a number of simple substitution algorythems you can use)
If you have no idea, let us know what you're trying to do, and how secure it needs to be, and we can suggest an encryption method and possibly a way of implementing it.
- Mina
|
|
|
|
05-24-2006, 09:16 AM
|
Re: Encrption in HTML
|
Posts: 6
|
Well .. i have a text box .. and in that i will enter a letter say"A" and in return there should be a message box saying the encrypted value say "J".
this is just a sample project wihich will help me latter
waiting for ur response.
thanks,
jayender
|
|
|
|
05-24-2006, 10:47 AM
|
Re: Encrption in HTML
|
Posts: 1,626
Location: Guildford, UK
|
Do you want decryption as well?
How secure does it need to be? (What's it being used for?)
Is it only single letters, or do you want to encrypt words, blocks of text, or even files?
|
|
|
|
05-25-2006, 05:19 AM
|
Re: Encrption in HTML
|
Posts: 6
|
Thanks for the reply Minaki,
well this is for my learning so just want to know how to encrypt a letter in Javascript... i know in C++... but am new to javascript ...
hope i will get the code pretty soon .. 
Last edited by jayender : 05-25-2006 at 07:37 AM.
|
|
|
|
05-25-2006, 11:33 AM
|
Re: Encrption in HTML
|
Posts: 880
Location: Leeds UK
|
The XOR '^' does not work as it does in C++, also using Jscript your exposing your encryption technique + your key to whom ever is looking at that page.
Thats why its pointless.
However simple char exchanges are quite easy to do. Build an array of alpha chars. You get your char.value from your page and swap it for char_array[n] depending on what N is.
Of course you will need to roll back to 1 if you hit 26 etc but thats a basic substitution method that is not too hard to work out.
Example:
Code:
<script>
var subs = 15;
var chars = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
var alength = chars.length;
var j=0;
var conv;
function swapChar(ch){
for(i=0;i<alength;i++){
if(ch == chars[i]){
document.write("found " + ch + " Converting ");
if(i + subs > 26){
j=0;
tmp = 26 - i;
conv = chars[(j + subs) - tmp];
}else{
conv = chars[j + subs - 1];
}
document.write(ch + " + " + subs + " Now == " + conv + "<br />");
}
j++;
}
}
swapChar('z'); // should be o
document.write('<hr>');
swapChar('c'); // should be r
document.write('<hr>');
swapChar('u');// should be
document.write('<hr>');
swapChar('p');// should be
document.write('<hr>');
swapChar('q');// should be f
document.write('<hr>');
</script>
Of course to enable it to decode will be down to some coding by yourself. (a quick tip been its the opposite of ^)
But as I mention doing this in Jscript is totally behond reason!
Ibbo
Last edited by ibbo : 05-25-2006 at 11:36 AM.
|
|
|
|
05-26-2006, 03:41 AM
|
Re: Encrption in HTML
|
Posts: 6
|
Thanks a lot dude ... 
|
|
|
|
05-26-2006, 05:25 AM
|
Re: Encrption in HTML
|
Posts: 880
Location: Leeds UK
|
A pleasure
Ibbo
|
|
|
|
|
« Reply to Encrption in HTML
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|