1 /***************************************************************************
\r
2 * Copyright (C) 2003-2006 Polytechnique.org *
\r
3 * http://opensource.polytechnique.org/ *
\r
5 * This program is free software; you can redistribute it and/or modify *
\r
6 * it under the terms of the GNU General Public License as published by *
\r
7 * the Free Software Foundation; either version 2 of the License, or *
\r
8 * (at your option) any later version. *
\r
10 * This program is distributed in the hope that it will be useful, *
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
13 * GNU General Public License for more details. *
\r
15 * You should have received a copy of the GNU General Public License *
\r
16 * along with this program; if not, write to the Free Software *
\r
17 * Foundation, Inc., *
\r
18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\r
19 ***************************************************************************/
\r
21 document.write('<script language="javascript" src="{rel}/javascript/md5.js"></script>');
\r
22 document.write('<script language="javascript" src="{rel}/javascript/sha1.js"></script>');
\r
25 function hash_encrypt(a) {
\r
29 var hexa_h = "0123456789abcdef";
\r
31 function dechex(a) {
\r
32 return hexa_h.charAt(a);
\r
35 function hexdec(a) {
\r
36 return hexa_h.indexOf(a);
\r
39 function hash_xor(a, b) {
\r
46 d = a; a = b; b = d;
\r
47 k = i; i = j; j = k;
\r
49 for (k = 0; k < j; k++)
\r
50 c += dechex(hexdec(a.charAt(k)) ^ hexdec(b.charAt(k)));
\r