LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Howto convert base64 to md5 (https://www.linuxquestions.org/questions/linux-security-4/howto-convert-base64-to-md5-533491/)

celeron 03-01-2007 12:24 AM

Howto convert base64 to md5
 
Hi, all
I have a LDAP database on Redhat 8.x. When I use ldapsearch comand, I receive userPassword at base64 hash format (userPassword:: e0NSWVBUfSQxJEZ1dVR0cGt0JFd0RkM1eUpOeTd2bmQ1cXNzY3ZMTC8=). Now, I want to convert this hash to MD5 hash. After, I will enter this MD5 hash to /etc/shadow and convert /etc/passwd to ldif file.
Do you have any solutions for this?

Thanks.

puffinman 03-01-2007 01:30 AM

You can use openssl to decode the base64 and the pipe it to md5sum like so

Code:

openssl enc -d -base64 -in myb64passwd.txt | md5sum
Depending on the format of your password file you'll probably have to wrap it in some sort of loop to process each password with md5sum individually.

celeron 03-01-2007 02:14 AM

howto convert base64 to md5.
 
Thanks for regarding.
I have just tried your solution but I can't use hash which export from openssl command.
It displays result:
[root@abc ~]# openssl enc -d -base64 -in myb64passwd.txt | md5sum
d41d8cd98f00b204e9800998ecf8427e -

Please give me more information.

Thanks.

puffinman 03-01-2007 02:19 AM

Yeah, that's md5sum giving you the answer. Look at the man pages for openssl and for md5sum.


All times are GMT -5. The time now is 04:38 PM.