std.hash design
Johannes Pfau
nospam at example.com
Fri Jun 22 10:34:10 PDT 2012
Am Fri, 22 Jun 2012 18:12:20 +0100
schrieb "Regan Heath" <regan at netmail.co.nz>:
>
> 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 ;-)
More information about the Digitalmars-d
mailing list