www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - md5 + coupling

reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
Speaking of coupling, as we were a short while ago, I note that the md5 
module has a printDigest() function, which uses printf(). Is there 
really any good reason for this method, and its inherent coupling to 
printf()? It seems pointless to me, since the impl of printDigest() is 
simply

    void printDigest(ubyte digest[16])
    {
        foreach (ubyte u; digest)
            printf("%02x", u);
    }

???
Jan 27 2005
parent "Regan Heath" <regan netwin.co.nz> writes:
On Fri, 28 Jan 2005 09:55:50 +1100, Matthew  
<admin stlsoft.dot.dot.dot.dot.org> wrote:
 Speaking of coupling, as we were a short while ago, I note that the md5
 module has a printDigest() function, which uses printf(). Is there
 really any good reason for this method, and its inherent coupling to
 printf()? It seems pointless to me, since the impl of printDigest() is
 simply

     void printDigest(ubyte digest[16])
     {
         foreach (ubyte u; digest)
             printf("%02x", u);
     }
AFAIKS there is no reason for it using printf instead of placing the information into a char[]. My hash code in Deimos uses this function to output all the different digests from all the various hashing methods: Regan
Jan 27 2005