Commit dc5e0044 authored by Andre Heinecke's avatar Andre Heinecke

Add helper to classify a string as Fingerprint

parent a214cf06
......@@ -45,6 +45,7 @@
#include <QtAlgorithms>
#include <QByteArrayMatcher>
#include <QMap>
#include <QRegularExpression>
#include <boost/range.hpp>
......@@ -381,3 +382,9 @@ const char *Kleo::outputFileExtension(unsigned int classification)
}
return 0;
}
bool Kleo::isFingerprint(const QString &fpr)
{
static QRegularExpression fprRegex("[0-9a-fA-F]{40}");
return fprRegex.match(fpr).hasMatch();
}
......@@ -96,6 +96,9 @@ QString findSignedData(const QString &signatureFileName);
QStringList findSignatures(const QString &signedDataFileName);
QString outputFileName(const QString &input);
/** Check if a string looks like a fingerprint (SHA1 sum) */
bool isFingerprint(const QString &fpr);
const char *outputFileExtension(unsigned int classification);
QString printableClassification(unsigned int classification);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment