summaryrefslogtreecommitdiff
path: root/filters.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-12-14 10:58:31 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-12-14 10:58:31 +0000
commit60b7db799a5d9d607dba4b9a66c4421bb60f2577 (patch)
tree0d3e13a1e3a79e9472ecbb877e915239a18ef443 /filters.h
parentddb5a732f871e2ac92a40af4b989aac7fe368281 (diff)
downloadcryptopp-60b7db799a5d9d607dba4b9a66c4421bb60f2577.tar.gz
implement AlgorithmName() for hash and signature filters
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@259 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'filters.h')
-rw-r--r--filters.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/filters.h b/filters.h
index 2737dc0..9cc70ef 100644
--- a/filters.h
+++ b/filters.h
@@ -108,9 +108,12 @@ private:
bool ShouldPropagateMessageEnd() const {return m_transparent;}
bool ShouldPropagateMessageSeriesEnd() const {return m_transparent;}
- struct MessageRange {unsigned int message; lword position; lword size;};
- friend inline bool operator<(const MessageRange &a, const MessageRange &b)
- {return a.message < b.message || (a.message == b.message && a.position < b.position);}
+ struct MessageRange
+ {
+ inline bool operator<(const MessageRange &b)
+ {return message < b.message || (message == b.message && position < b.position);}
+ unsigned int message; lword position; lword size;
+ };
bool m_transparent;
lword m_currentMessageBytes, m_totalBytes;
@@ -282,6 +285,8 @@ public:
HashFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, bool putMessage=false, int truncatedDigestSize=-1)
: m_hashModule(hm), m_putMessage(putMessage), m_truncatedDigestSize(truncatedDigestSize) {Detach(attachment);}
+ std::string AlgorithmName() const {return m_hashModule.AlgorithmName();}
+
void IsolatedInitialize(const NameValuePairs &parameters);
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);
@@ -309,6 +314,8 @@ public:
enum Flags {HASH_AT_BEGIN=1, PUT_MESSAGE=2, PUT_HASH=4, PUT_RESULT=8, THROW_EXCEPTION=16, DEFAULT_FLAGS = HASH_AT_BEGIN | PUT_RESULT};
HashVerificationFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, word32 flags = DEFAULT_FLAGS);
+ std::string AlgorithmName() const {return m_hashModule.AlgorithmName();}
+
bool GetLastResult() const {return m_verified;}
protected:
@@ -336,6 +343,8 @@ public:
SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *attachment = NULL, bool putMessage=false)
: m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewSignatureAccumulator(rng)), m_putMessage(putMessage) {Detach(attachment);}
+ std::string AlgorithmName() const {return m_signer.AlgorithmName();}
+
void IsolatedInitialize(const NameValuePairs &parameters);
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);
@@ -361,6 +370,8 @@ public:
enum Flags {SIGNATURE_AT_BEGIN=1, PUT_MESSAGE=2, PUT_SIGNATURE=4, PUT_RESULT=8, THROW_EXCEPTION=16, DEFAULT_FLAGS = SIGNATURE_AT_BEGIN | PUT_RESULT};
SignatureVerificationFilter(const PK_Verifier &verifier, BufferedTransformation *attachment = NULL, word32 flags = DEFAULT_FLAGS);
+ std::string AlgorithmName() const {return m_verifier.AlgorithmName();}
+
bool GetLastResult() const {return m_verified;}
protected: