2015-10-11 14:58:31 +00:00
|
|
|
// Copyright (C) 2007 Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
// Copyright (C) 2013 James Almer <jamrial@gmail.com>
|
|
|
|
// Copyright (C) 2015 Zhe Wang <0x1998@gmail.com>
|
|
|
|
//
|
|
|
|
// Based on the RIPEMD-128 implementation from libavutil
|
|
|
|
//
|
|
|
|
// This program is a 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, version 3 of the License.
|
|
|
|
//
|
|
|
|
// You can get a copy of GNU General Public License along this program
|
|
|
|
// But you can always get it from http://www.gnu.org/licenses/gpl.txt
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
#ifndef __RIPEMD_HH_INCLUDED__
|
|
|
|
#define __RIPEMD_HH_INCLUDED__
|
|
|
|
|
|
|
|
#include <stddef.h>
|
2016-06-03 15:37:34 +00:00
|
|
|
#include <QtGlobal>
|
2015-10-11 14:58:31 +00:00
|
|
|
|
2016-04-07 21:45:27 +00:00
|
|
|
#if defined( _MSC_VER ) && _MSC_VER < 1800 // VS2012 and older
|
|
|
|
#include <stdint_msvc.h>
|
|
|
|
#else
|
|
|
|
#include <stdint.h>
|
|
|
|
#endif
|
2015-10-11 14:58:31 +00:00
|
|
|
|
|
|
|
class RIPEMD128
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RIPEMD128();
|
|
|
|
|
|
|
|
// Update hash value
|
2016-06-03 15:37:34 +00:00
|
|
|
void update( const uchar * data, size_t len );
|
2015-10-11 14:58:31 +00:00
|
|
|
|
|
|
|
// Finish hashing and output digest value.
|
2016-06-03 15:37:34 +00:00
|
|
|
void digest( uchar * digest );
|
2015-10-11 14:58:31 +00:00
|
|
|
|
|
|
|
private:
|
2016-06-03 15:37:34 +00:00
|
|
|
quint64 count; // number of bytes in buffer
|
|
|
|
uchar buffer[64]; // 512-bit buffer of input values used in hash updating
|
|
|
|
quint32 state[10]; // current hash value
|
2015-10-11 14:58:31 +00:00
|
|
|
|
2016-06-03 15:37:34 +00:00
|
|
|
void transform( const uchar buffer[64] );
|
2015-10-11 14:58:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __RIPEMD_HH_INCLUDED__
|