mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
klipper: use Katie's hash algorithm for hashing
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
d7838b9434
commit
7c2828b5cf
5 changed files with 23 additions and 16 deletions
|
@ -16,6 +16,8 @@
|
|||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "klipper.h"
|
||||
#include "historyimageitem.h"
|
||||
|
||||
#include <QtCore/QMimeData>
|
||||
|
@ -28,7 +30,7 @@ namespace {
|
|||
QByteArray buffer;
|
||||
QDataStream out(&buffer, QIODevice::WriteOnly);
|
||||
out << data;
|
||||
return QCryptographicHash::hash(buffer, QCryptographicHash::Sha1);
|
||||
return QCryptographicHash::hash(buffer, KlipperHashAlhorithm);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,12 +16,14 @@
|
|||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "klipper.h"
|
||||
#include "historystringitem.h"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
|
||||
HistoryStringItem::HistoryStringItem( const QString& data )
|
||||
: HistoryItem(QCryptographicHash::hash(data.toUtf8(), QCryptographicHash::Sha1))
|
||||
: HistoryItem(QCryptographicHash::hash(data.toUtf8(), KlipperHashAlhorithm))
|
||||
, m_data( data )
|
||||
{
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "klipper.h"
|
||||
#include "historyurlitem.h"
|
||||
|
||||
#include <QtCore/QMimeData>
|
||||
|
@ -23,7 +25,7 @@
|
|||
|
||||
namespace {
|
||||
QByteArray compute_uuid(const KUrl::List& _urls, KUrl::MetaDataMap _metaData, bool _cut ) {
|
||||
QCryptographicHash hash(QCryptographicHash::Sha1);
|
||||
QCryptographicHash hash(KlipperHashAlhorithm);
|
||||
foreach(const KUrl& url, _urls) {
|
||||
hash.addData(url.toEncoded());
|
||||
hash.addData("\0", 1); // Use binary zero as that is not a valid path character
|
||||
|
|
|
@ -63,12 +63,6 @@
|
|||
|
||||
//#define NOISY_KLIPPER
|
||||
|
||||
#if QT_VERSION >= 0x041200
|
||||
static const QCryptographicHash::Algorithm KlipperHashAlhorithm = QCryptographicHash::KAT;
|
||||
#else
|
||||
static const QCryptographicHash::Algorithm KlipperHashAlhorithm = QCryptographicHash::Sha1;
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
/**
|
||||
* Use this when manipulating the clipboard
|
||||
|
|
|
@ -21,24 +21,31 @@
|
|||
#ifndef KLIPPER_H
|
||||
#define KLIPPER_H
|
||||
|
||||
#include <QtCore/qdatetime.h>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QClipboard>
|
||||
#include <QTime>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <QMimeData>
|
||||
#include <QDateTime>
|
||||
#include <QTimer>
|
||||
#include <QClipboard>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
#include <KGlobal>
|
||||
|
||||
#include "urlgrabber.h"
|
||||
|
||||
#if QT_VERSION >= 0x041200
|
||||
static const QCryptographicHash::Algorithm KlipperHashAlhorithm = QCryptographicHash::KAT;
|
||||
#else
|
||||
static const QCryptographicHash::Algorithm KlipperHashAlhorithm = QCryptographicHash::Sha1;
|
||||
#endif
|
||||
|
||||
class KAction;
|
||||
class KToggleAction;
|
||||
class KAboutData;
|
||||
class KActionCollection;
|
||||
class URLGrabber;
|
||||
#include <QTime>
|
||||
class History;
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <QMimeData>
|
||||
class HistoryItem;
|
||||
class KlipperSessionManager;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue