PDA

View Full Version : How to get sha1 hash



lyuts
5th November 2008, 15:43
Hi, guys. I need you help.

I'm trying to obtain a sha1 hash. I use QCryptographicHash for this.


QCryptographicHash hash(QCryptographicHash::Sha1);
hash.addData("123", 3);


But I get something like this
"$6rJ╟)щъa4тБ(\еEY├"
instead of
"40bd001563085fc35165329ea1ff5c5ecbdbbeef".
What am I doing wrong?

Thanks.

jpn
5th November 2008, 15:50
There's an example in our wiki: Cryptography. Use QByteArray::toHex() to get a hexadecimal presentation of the hash.

lyuts
5th November 2008, 15:53
That helped. Thanks a lot.

newgod
15th February 2012, 15:35
very thanks for you ,i find this for very long time;)