Results 1 to 4 of 4

Thread: How to get sha1 hash

  1. #1
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to get sha1 hash

    Hi, guys. I need you help.

    I'm trying to obtain a sha1 hash. I use QCryptographicHash for this.
    Qt Code:
    1. QCryptographicHash hash(QCryptographicHash::Sha1);
    2. hash.addData("123", 3);
    To copy to clipboard, switch view to plain text mode 

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

    Thanks.
    I'm a rebel in the S.D.G.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to get sha1 hash

    There's an example in our wiki: [WIKI]Cryptography[/WIKI]. Use QByteArray::toHex() to get a hexadecimal presentation of the hash.
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    lyuts (5th November 2008)

  4. #3
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to get sha1 hash

    That helped. Thanks a lot.
    I'm a rebel in the S.D.G.

  5. #4
    Join Date
    Feb 2012
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to get sha1 hash

    very thanks for you ,i find this for very long time

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.