var codesHexa="0123456789ABCDEF";


function codeHexa (octetDec) // octet décimal ==> hexadécimal
	{
	return (codesHexa.charAt(octetDec>>>4)+codesHexa.charAt(octetDec&15));
	}


function decodeHexa (octetHex)
	{
	return ( (codesHexa.indexOf(octetHex.charAt(0))<<4) + codesHexa.indexOf(octetHex.charAt(1)) );
	}

var clef="9Ajf0kDhD4GBwnuis1ys1d45br7uyZ";


function crypte (texte)
	{
	resultat="";
	l=texte.length;
	lc=clef.length;

	m=0;
	for (n=0;n<l;n++)
		{
		c=texte.charCodeAt(n);
		if (c<256)
			{
     			resultat+=codeHexa( c ^ clef.charCodeAt(m%lc) );
			m++;
			}
		}

	return resultat;
	}


function decrypte (texte)
	{
	resultat="";
	l=texte.length;
	lc=clef.length;

	m=0;
	for (n=0;n<l;n+=2)
		{
		c=decodeHexa(texte.substr(n,2));
		resultat+=String.fromCharCode( c ^ clef.charCodeAt(m%lc) );
		m++;
		}
		return resultat;
	}
