One way is to create a byte array that's 2* DIGESTSIZE and then pass address of the starting point to the Digest function (&bytearray[0] and &bytearray[digestsize]). In your code you should probably specifically use the correct array size as well (SHA265::DIGESTSIZE).
You could use a stringsink if you are heading that way and then just concatenate the 2 strings. This is potentially easier. There are several examples in the docs for this. Sorry for quick reply, on way out. On Mon, Sep 19, 2011 at 9:37 PM, shinde <[email protected]> wrote: > Hello everyone, > > I'm currently working on a requirement which suggests concatenating > two hashes( appending one hash to the other), say hash1 and hash2. > > How can this be achieved using crypto++ ?? > > E.g: > > SHA256 hash; > SHA256 hash2; > string message1="Hello"; > string message2 = "world"; > > byte digest1[SHA::DIGESTSIZE]; > byte digest2[SHA::DIGESTSIZE]; > > hash.CalculateDigest(digest1,(byte*) > message1.c_str(),message1.length()); > hash2.CalculateDigest(digest2, > (byte*)message2.c_str(),message2.length()); > > // Need to concatenate hash and hash2, i.e. hash2 should be appended > to hash1. > > Looking for some help regarding this !!.. > > Thanks, > > Nitin > > -- > You received this message because you are subscribed to the "Crypto++ > Users" Google Group. > To unsubscribe, send an email to > [email protected]. > More information about Crypto++ and this group is available at > http://www.cryptopp.com. > -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com.
