Overview
Features
Download
Documentation
Community
Add-Ons & Services

Missing DigestEngine operators?

General discussion regarding the development of POCO for contributors.

Missing DigestEngine operators?

Postby philipp » 31 Jan 2012, 21:30

I was thininking that the DigestEngine class needs some additional methods...

const std::string& toString();
bool operator!=(const DigestEngine& other);
bool operator==(const DigestEngine& other);

except of course that the subclasses of the DigestEngines need to be identical...

No point comparing the digest of an MD5 to the digest of an SHA1...

Oh, and was thinking that a SHA2 object might be nice, too.
philipp
 
Posts: 16
Joined: 08 Dec 2011, 03:59

Re: Missing DigestEngine operators?

Postby guenter » 31 Jan 2012, 23:05

What would be the point of comparing DigestEngine instances (instead of DigestEngine::Digest values)?

Regarding SHA2, it would be best to implement this in Poco::Crypto, probably in a generic way, using the generic OpenSSL digest functions (EVP_Digest...). Interestingly, I thought this had already been done, but it was wishful thinking on my part...
guenter
 
Posts: 1138
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Missing DigestEngine operators?

Postby philipp » 01 Feb 2012, 04:35

Err, sorry, yes... comparing Digests, not DigestEngines...
philipp
 
Posts: 16
Joined: 08 Dec 2011, 03:59

Re: Missing DigestEngine operators?

Postby philipp » 01 Feb 2012, 07:17

Oh, also comparing to a stringified digest, such that:

digest == digest.toString()

i.e.,

bool operator==(const std::string& otherDigest)
{
return (toString() == otherDigest);
}
philipp
 
Posts: 16
Joined: 08 Dec 2011, 03:59

Re: Missing DigestEngine operators?

Postby guenter » 01 Feb 2012, 23:57

I don't think comparison functions belong in the DigestEngine class. Conceptually it just makes no sense, at DigestEngine instances are not value objects, but rather objects creating values (digests), which can then be compared easily.
guenter
 
Posts: 1138
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Missing DigestEngine operators?

Postby philipp » 02 Feb 2012, 00:18

guenter wrote:I don't think comparison functions belong in the DigestEngine class. Conceptually it just makes no sense, at DigestEngine instances are not value objects, but rather objects creating values (digests), which can then be compared easily.


Right, which is why I amended my statement as:

"Err, sorry, yes... comparing Digests, not DigestEngines..."

so it should be possible to compare a Digest and the serialized representation of a Digest (i.e. digest.toString()).
philipp
 
Posts: 16
Joined: 08 Dec 2011, 03:59

Re: Missing DigestEngine operators?

Postby killerbot » 22 Mar 2012, 19:45

is there already an idea when sha2 will be supported in poco ?
killerbot
 
Posts: 66
Joined: 03 Dec 2009, 12:55


Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest