On Fri, 22 Jun 2012 18:34:10 +0100, Johannes Pfau <[email protected]>
wrote:
Am Fri, 22 Jun 2012 18:12:20 +0100
schrieb "Regan Heath" <[email protected]>:
Agreed. In fact I wouldn't bother with finishString either TBH,
people can always pass the result of finish string into the method
which produces the hex string representation.
In any case, we can probably have one static toHexString method for
all digests.
string digestToString(size_t num)(in ubyte[num] digest)
{
auto result = new char[num*2];
size_t i;
foreach(u; digest)
{
result[i++] = std.ascii.hexDigits[u >> 4];
result[i++] = std.ascii.hexDigits[u & 15];
}
return assumeUnique(result);
}
adapted from std.md5. I don't really like the name though ;-)
Name seems fine to me. Alternately just digestString or even the
completely generic "hexString".
R
--
Using Opera's revolutionary email client: http://www.opera.com/mail/