QtCryptoHash is a Qt C++ library providing a way to calculate some of the cryptographic hashes not supported by the QCryptographicHash class from the Qt library.
- Supports Tiger-192, RipeMD-160 and Whirlpool algorithms
- Simple interface, identical to the QCryptographicHash class, but renamed QCryptoHash
- Works with Qt 5.x
- Supports MSVC, MinGW, GCC and Clang
#include "qcryptohash.hpp"
...
QByteArray stringHash = QCryptoHash::hash( "abc", QCryptoHash::TIGER );
qInfo() << stringHash.toHex(); //f258c1e88414ab2a527ab541ffc5b8bf935f7b951c132951
#include "qcryptohash.hpp"
...
QFile file( filename );
if ( file.open( QFile::ReadOnly ) ) {
QCryptoHash ripemdHash( QCryptoHash::RMD160 );
while( !file.atEnd() ){
ripemdHash.addData( file.read( 8192 ) );
}
QByteArray fileHash = ripemdHash.result();
qInfo() << fileHash.toHex(); //RipeMD hash of 'filename' file content
}
For a complete description of the QCryptoHash API, see the relative wiki.
QtCryptoHash needs only QtCore library to be linked to the program.
A complete guide to build this library is available here.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.