Link to home
Start Free TrialLog in
Avatar of edz_pgt
edz_pgtFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Javascript text encryption

I have inherited a web site to look after. The site is programmed in ASP which I'm not too familiar with but this issue seems to be java related.

On the main page of the site is the client's email address. This appears to be encoded within the source code using javascript. I now need to change the email address but I can't seem to find the origin of the script in order to work out how to create a new encryption code.

Does anyone recognise this and can they point me in the right direction please?

NOTE: I've changed the values within the code since I don't yet understand it and don't want to unintentionally release any client related data into the public domain.
<head>
<script language="javascript">function d(o){q="asdfgsadfgsdagasdfhasfgas";k=0;s="";for(i=0;i<o.length;i=i+2){c="0x"+o.substr(i,2);c=Math.abs(c-q.charCodeAt(k));k++;if(k>q.length-1)k=0;c=String.fromCharCode(c);s+=c;}document.write(s);}</script>
</head>

<body>
d('d1jk34jk34jh34jh34jk25j25jkj235mk34kmnl34knl34jkl235kl235235nkl235kl')

</body>

Open in new window

Avatar of leakim971
leakim971
Flag of Guadeloupe image

Why do you want to let the encryption ? Remove it and put directly your email with or without another encryption method...
Avatar of edz_pgt

ASKER

hmm... well, currently I don't have another method of doing this encryption and taking it away would be a reduction in spam control from the clietns perspective so I can't justify that.
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To encode use :


function e(o) {
		q="asdfgsadfgsdagasdfhasfgas";
		k=0;
		s="";
		for(i=0;i<o.length;i++) {
			c = o.charCodeAt(i) + q.charCodeAt(k);
			k++;
			if(k>q.length-1) k=0;
			s+=c.toString(16);
		}
		document.write(s);
	}

Open in new window

Test page :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript">
	function d(o) {
		q="asdfgsadfgsdagasdfhasfgas";
		k=0;
		s="";
		for(i=0;i<o.length;i=i+2) {
			c="0x"+o.substr(i,2);
			c=Math.abs(c-q.charCodeAt(k));
			k++;
			if(k>q.length-1) k=0;
			c=String.fromCharCode(c);
			s+=c;
		}
		document.write(s);
	}
	function e(o) {
		q="asdfgsadfgsdagasdfhasfgas";
		k=0;
		s="";
		for(i=0;i<o.length;i++) {
			c = o.charCodeAt(i) + q.charCodeAt(k);
			k++;
			if(k>q.length-1) k=0;
			s+=c.toString(16);
		}
		document.write(s);
	}
</script>
</head>
<body>
<script language="javascript">
	d('cfe2d6cbd7dfdaa4cbdfe3c9d3dbd4a0c9decbc9d4d4cec6a1c4e2d1');
</script>
</body>
</html>

Open in new window