QTfrontend/misc.cpp
author unc0rr
Mon, 16 Mar 2009 20:55:10 +0000
changeset 1898 f0ab0c77946d
parent 1878 b3b277d2b891
child 1904 20348675b015
permissions -rw-r--r--
Send scheme data over net (but recieving part isn't implemented yet)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1878
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
     1
/*
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
     3
 *
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
     4
 * This program is free software; you can redistribute it and/or modify
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
     5
 * it under the terms of the GNU General Public License as published by
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
     6
 * the Free Software Foundation; version 2 of the License
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
     7
 *
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
     8
 * This program is distributed in the hope that it will be useful,
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
     9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    11
 * GNU General Public License for more details.
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    12
 *
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    13
 * You should have received a copy of the GNU General Public License
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    14
 * along with this program; if not, write to the Free Software
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    15
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    16
 */
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    17
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    18
#include "misc.h"
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    19
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    20
#define F1(x, y, z)	(z ^ (x & (y ^ z)))
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    21
#define F2(x, y, z)	F1(z, x, y)
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    22
#define F3(x, y, z)	(x ^ y ^ z)
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    23
#define F4(x, y, z)	(y ^ (x | ~z))
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    24
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    25
#define MD5STEP(f, w, x, y, z, in, s) \
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    26
	(w += f(x, y, z) + in, w = (w<<s | w>>(32-s)) + x)
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    27
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    28
Hash::Hash()
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    29
{
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    30
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    31
}
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    32
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    33
QString Hash::md5(QByteArray buf)
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    34
{
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    35
// prepare
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    36
	quint32 size = buf.size();
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    37
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    38
	if (size > 55)
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    39
		return QString("md5 hash value :D");
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    40
	
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    41
	buf += '\x80';
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    42
	buf += QByteArray(55 - size, '\x00');
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    43
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    44
	size *= 8;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    45
	
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    46
	quint8 tb1 = size & 0xff;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    47
	quint8 tb2 = (size >> 8) & 0xff;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    48
	
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    49
	buf += QByteArray::fromRawData((char *)&tb1, 1);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    50
	buf += QByteArray::fromRawData((char *)&tb2, 1);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    51
	buf += QByteArray(6, '\x00');
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    52
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    53
	const char * message = buf.data();
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    54
	
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    55
// start hashing
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    56
	
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    57
	quint32 w[16], i, a, b, c, d, f, g, t;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    58
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    59
	quint32 h0 = 0x67452301;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    60
	quint32 h1 = 0xEFCDAB89;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    61
	quint32 h2 = 0x98BADCFE;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    62
	quint32 h3 = 0x10325476;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    63
	int j;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    64
	
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    65
	for(i = 0; i < 16; i++)
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    66
	{
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    67
		w[i] = 0;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    68
		
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    69
		for(j = 3; j >= 0; j--)
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    70
		{
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    71
			w[i] <<= 8;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    72
			w[i] += message[(i << 2) + j] & 0xFF;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    73
		}
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    74
	}
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    75
	a = h0; b = h1; c = h2; d = h3;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    76
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    77
	MD5STEP(F1, a, b, c, d, w[0]  + 0xd76aa478, 7);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    78
	MD5STEP(F1, d, a, b, c, w[1]  + 0xe8c7b756, 12);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    79
	MD5STEP(F1, c, d, a, b, w[2]  + 0x242070db, 17);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    80
	MD5STEP(F1, b, c, d, a, w[3]  + 0xc1bdceee, 22);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    81
	MD5STEP(F1, a, b, c, d, w[4]  + 0xf57c0faf, 7);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    82
	MD5STEP(F1, d, a, b, c, w[5]  + 0x4787c62a, 12);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    83
	MD5STEP(F1, c, d, a, b, w[6]  + 0xa8304613, 17);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    84
	MD5STEP(F1, b, c, d, a, w[7]  + 0xfd469501, 22);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    85
	MD5STEP(F1, a, b, c, d, w[8]  + 0x698098d8, 7);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    86
	MD5STEP(F1, d, a, b, c, w[9]  + 0x8b44f7af, 12);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    87
	MD5STEP(F1, c, d, a, b, w[10] + 0xffff5bb1, 17);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    88
	MD5STEP(F1, b, c, d, a, w[11] + 0x895cd7be, 22);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    89
	MD5STEP(F1, a, b, c, d, w[12] + 0x6b901122, 7);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    90
	MD5STEP(F1, d, a, b, c, w[13] + 0xfd987193, 12);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    91
	MD5STEP(F1, c, d, a, b, w[14] + 0xa679438e, 17);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    92
	MD5STEP(F1, b, c, d, a, w[15] + 0x49b40821, 22);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    93
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    94
	MD5STEP(F2, a, b, c, d, w[1]  + 0xf61e2562, 5);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    95
	MD5STEP(F2, d, a, b, c, w[6]  + 0xc040b340, 9);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    96
	MD5STEP(F2, c, d, a, b, w[11] + 0x265e5a51, 14);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    97
	MD5STEP(F2, b, c, d, a, w[0]  + 0xe9b6c7aa, 20);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    98
	MD5STEP(F2, a, b, c, d, w[5]  + 0xd62f105d, 5);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
    99
	MD5STEP(F2, d, a, b, c, w[10] + 0x02441453, 9);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   100
	MD5STEP(F2, c, d, a, b, w[15] + 0xd8a1e681, 14);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   101
	MD5STEP(F2, b, c, d, a, w[4]  + 0xe7d3fbc8, 20);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   102
	MD5STEP(F2, a, b, c, d, w[9]  + 0x21e1cde6, 5);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   103
	MD5STEP(F2, d, a, b, c, w[14] + 0xc33707d6, 9);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   104
	MD5STEP(F2, c, d, a, b, w[3]  + 0xf4d50d87, 14);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   105
	MD5STEP(F2, b, c, d, a, w[8]  + 0x455a14ed, 20);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   106
	MD5STEP(F2, a, b, c, d, w[13] + 0xa9e3e905, 5);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   107
	MD5STEP(F2, d, a, b, c, w[2]  + 0xfcefa3f8, 9);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   108
	MD5STEP(F2, c, d, a, b, w[7]  + 0x676f02d9, 14);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   109
	MD5STEP(F2, b, c, d, a, w[12] + 0x8d2a4c8a, 20);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   110
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   111
	MD5STEP(F3, a, b, c, d, w[5]  + 0xfffa3942, 4);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   112
	MD5STEP(F3, d, a, b, c, w[8]  + 0x8771f681, 11);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   113
	MD5STEP(F3, c, d, a, b, w[11] + 0x6d9d6122, 16);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   114
	MD5STEP(F3, b, c, d, a, w[14] + 0xfde5380c, 23);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   115
	MD5STEP(F3, a, b, c, d, w[1]  + 0xa4beea44, 4);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   116
	MD5STEP(F3, d, a, b, c, w[4]  + 0x4bdecfa9, 11);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   117
	MD5STEP(F3, c, d, a, b, w[7]  + 0xf6bb4b60, 16);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   118
	MD5STEP(F3, b, c, d, a, w[10] + 0xbebfbc70, 23);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   119
	MD5STEP(F3, a, b, c, d, w[13] + 0x289b7ec6, 4);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   120
	MD5STEP(F3, d, a, b, c, w[0]  + 0xeaa127fa, 11);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   121
	MD5STEP(F3, c, d, a, b, w[3]  + 0xd4ef3085, 16);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   122
	MD5STEP(F3, b, c, d, a, w[6]  + 0x04881d05, 23);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   123
	MD5STEP(F3, a, b, c, d, w[9]  + 0xd9d4d039, 4);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   124
	MD5STEP(F3, d, a, b, c, w[12] + 0xe6db99e5, 11);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   125
	MD5STEP(F3, c, d, a, b, w[15] + 0x1fa27cf8, 16);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   126
	MD5STEP(F3, b, c, d, a, w[2]  + 0xc4ac5665, 23);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   127
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   128
	MD5STEP(F4, a, b, c, d, w[0]  + 0xf4292244, 6);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   129
	MD5STEP(F4, d, a, b, c, w[7]  + 0x432aff97, 10);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   130
	MD5STEP(F4, c, d, a, b, w[14] + 0xab9423a7, 15);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   131
	MD5STEP(F4, b, c, d, a, w[5]  + 0xfc93a039, 21);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   132
	MD5STEP(F4, a, b, c, d, w[12] + 0x655b59c3, 6);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   133
	MD5STEP(F4, d, a, b, c, w[3]  + 0x8f0ccc92, 10);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   134
	MD5STEP(F4, c, d, a, b, w[10] + 0xffeff47d, 15);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   135
	MD5STEP(F4, b, c, d, a, w[1]  + 0x85845dd1, 21);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   136
	MD5STEP(F4, a, b, c, d, w[8]  + 0x6fa87e4f, 6);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   137
	MD5STEP(F4, d, a, b, c, w[15] + 0xfe2ce6e0, 10);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   138
	MD5STEP(F4, c, d, a, b, w[6]  + 0xa3014314, 15);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   139
	MD5STEP(F4, b, c, d, a, w[13] + 0x4e0811a1, 21);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   140
	MD5STEP(F4, a, b, c, d, w[4]  + 0xf7537e82, 6);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   141
	MD5STEP(F4, d, a, b, c, w[11] + 0xbd3af235, 10);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   142
	MD5STEP(F4, c, d, a, b, w[2]  + 0x2ad7d2bb, 15);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   143
	MD5STEP(F4, b, c, d, a, w[9]  + 0xeb86d391, 21);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   144
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   145
	h0 = h0 + a;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   146
	h1 = h1 + b;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   147
	h2 = h2 + c;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   148
	h3 = h3 + d;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   149
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   150
	QString result;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   151
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   152
	result.sprintf("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   153
			h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >> 24 & 0xFF,
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   154
			h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >> 24 & 0xFF,
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   155
			h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >> 24 & 0xFF,
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   156
			h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >> 24 & 0xFF
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   157
		);
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   158
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   159
	return result;
b3b277d2b891 own md5 function, no qca2 dependancy (patch by nemo with Qt adaptation by me)
unc0rr
parents:
diff changeset
   160
}