i have made my own hash chain generator of a string in c++ in linux. now i am trying to make its gui in qt4. i have converted my c++ code to suit qt4 syntax. my hash function works as follows.
- user ask to enter a string.
- based on the string entered it calculates hash value, 10 ten times by putting it in a 'for' loop, so as to make a hashchain.
my problem is that it works fine in c++, but when i am converting to qt4 code, its only giving first value in chain as correct. but after that all values being generated are not correct i.e they are not same as that in c++. i think problem is in data conversion. below is my code. please help in correcting this code. thanx
in advance.
quint32 c;
QString phrase;
phrase = stringlineEdit->text();
char *str = phrase.toAscii().data(); // convert from qstring to *char
for(int i=0;i<10;i++)
{
c = hash(str, strlen(str), 0);
QString str1 = QVariant( c ).toString();
str1 = QString::number( c, 16 );
resulttextEdit->append( "Key: " + str1 );
str = str1.toAscii().data(); // convert from qstring to *char
}
Bookmarks