MD5 Encryption in C++ and Unix

Posted: January 20, 2012 in Programming
Tags: , , , , , ,

We can perform md5 encryption of a text by using md5sum command in unix..

$ echo -n “TEXT” | md5sum

Replace your text to be encrypted with TEXT

For Example

$ echo -n “hello” | md5sum

It will produce the following result

40be4e59b9a2a2b5dffb918c0e86b3d7

We can use the same command in C++ as follows

system(“echo -n “TEXT” | md5sum”);

If you need to store the encrypted text in a variable use it as

x = system(“echo -n “TEXT” | md5sum”);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s