Difference in MD5 hash generated by the terminal and with API GetHashN of IHash interface

Difference in MD5 hash generated by the terminal and with API GetHashN of IHash interface

BY 28 May 2013 General Support

Hi,

I am genarating a MD5 Hash for a certain text input and found that the hash generated was not similar to that of the terminal command.

So i tried a sample code to generate a hash for sample string “test”

 I am using the following command on terminal of the device

echo “test” | md5sum

the hash generated is d8e8fca2dc0f896fd7cb4cb0031ba249

 

In my application the code is as below

String inputStr(L”test”);

IHash* pHash = new Md5Hash();

Tizen::Text::Utf8Encoding utf8Enc;

ByteBuffer* pInput = utf8Enc.GetBytesN(inputStr);
pOutput = pHash->GetHashN(*pInput);

this generates a hash e2a3e68d23ce348b8f68b379de3d4c9

Please let me know the procedure to obtain the same MD5 hast for the input both in code and terminal.

 

Thanks & Regards

 

 
Written by