Hi, I'm having problems with the HexEncoder with the following code 
the problem is that when the fonction returns it segfaults

When I comment the HexDecoder portions , it doesn't crash...
I checked the documentation and I think I'm following the faq correctly...

Any ideas why HexEncoder makes a segfault???

( I need to ouput the hexed sha to a (char *)  to make a wxString with
it ( wxwidgets) )

Thanks

Antoine 

--- CODE ---

        wxString tosha1 = _bdecoder->get_info_string(); // gets a wxString
        
        byte hash[SHA::DIGESTSIZE];
        byte hexhash[2*SHA::DIGESTSIZE];

        SHA sha;
        
        // tosha1.c_str() will give a char * for the string
        sha.Update((const byte*) tosha1.c_str(), (unsigned int) tosha1.Length());
        sha.Final(hash);
        
        //SHA().CalculateDigest(hash, (byte*) tosha1.c_str(), (int) tosha1.Length());
        
        HexEncoder hexEncoder;
        hexEncoder.Put(hash, SHA::DIGESTSIZE);
        hexEncoder.MessageEnd();
        hexEncoder.Get(hexhash,SHA::DIGESTSIZE*2);
     
        wxLogDebug("hahs is : %s",  hash);
        wxLogDebug("hash HEX  is : %s",  hexhash);
        
        // this returns the correct hex and hash except that i Get like 
        hash HEX  is :
F96EED59348E22A5C9C4C45128B5F49482C36A73:ï@@[EMAIL 
PROTECTED](ïïïïïjsïïïïXïïïLï@@ïïdïïï(ïïïpïïïp
        i'm not sure why there is stuff afater the : ? even the : itself ?
especially since the hexhash is only 40 char.... :( maybe it's the
string that has no \0 or something but the ":" is intriging...
        
        
        return

Reply via email to