LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Create MD5 hash from string (https://www.linuxquestions.org/questions/linux-general-1/create-md5-hash-from-string-128322/)

trouby 12-23-2003 05:23 AM

Create MD5 hash from string
 
Hey,

Is there any tool to create a hashed MD5 string ? many applications starting to support the password field encrypted starting with {MD5}.

Thanks.

stickman 12-23-2003 07:35 AM

Have you looked at md5sum?

trouby 12-23-2003 10:43 AM

ye, I tried but it seems it doesn't fit openldap's MD5, anyone know why?

stickman 01-22-2004 01:10 PM

Perhaps it's not comparing the same data.

tibbst 10-16-2008 08:48 AM

slappasswd(8)
 
I'm sure you're still looking for this. ;) Or, for those of you who stumble across this looking for the answer, like I did...

# slappasswd -h '{MD5}' -s 'mynewpassword'
{MD5}jnA4PGn3o7fqP3GwLz6XMQ==

I'm pretty sure that's what you were looking for. As I understand it, that's the crypt function using the MD5 algorithm for password hashing. I don't believe the md5sum command is useful in this case.

evaluatinglinux 10-17-2008 01:31 PM

I am not sure I understood your requirements clearly. Could you rephrase it in a slightly more detailed manner.

Thanks in advance!
:)

Debian Kernel

dipu183 02-13-2011 08:34 AM

MD5 hashing
 
try this
echo "STRING" | md5sum

This will give you the md5 hashed value.

linux1:~# echo "STRING" | md5sum
71f48b3561c9e187a7f356729c929a69 -
linux1:~#

AlphaLexman 02-13-2011 04:14 PM

Quote:

Originally Posted by trouby (Post 664997)
Is there any tool to create a hashed MD5 string ?

I know this is an old thread, but:
Code:

uuidgen -r
will generate a random-based UUID,
and:
Code:

uuidgen -t
will generate a time-based UUID

mightybs 02-28-2011 05:02 PM

echo & md5sum
 
dipu183 you left out an important part:

Quote:

try this
echo "STRING" | md5sum
echo ends it's output with a "\n" unless you do this:

Code:

echo -n "STRING" | md5sum
using this in a bash script I do this to get the string:
Code:

md5=$(echo -n "your string here" | md5sum | cut -f1 -d' ')
That way you cut out the rest of the output from the md5sum command as well, just getting the hash you want.

RayJ 02-07-2012 07:08 PM

Quote:

Originally Posted by mightybs (Post 4274458)
dipu183 you left out an important part:



echo ends it's output with a "\n" unless you do this:

Code:

echo -n "STRING" | md5sum
using this in a bash script I do this to get the string:
Code:

md5=$(echo -n "your string here" | md5sum | cut -f1 -d' ')
That way you cut out the rest of the output from the md5sum command as well, just getting the hash you want.

Perfect, Thanks!

--RayJ


All times are GMT -5. The time now is 07:54 PM.