|
|
Creating an MD5 hash
Hi,
I want to generate an MD5 checksum with crypt.h, installed OS Debian Woody.
Unfortunately I only get DES hashes with
strncpy(salt, row[0], 12);
salt[12] = '\0';
encryptedPass = crypt(passwd, salt);
free(salt);
Later I compare the two:
if (!strcmp(row[0], encryptedPass))
row[0] looks like that: $1$mYV0L3j8$nUUWy09JYrzdXurr92ywv1
salt starts with $1$ to indicate that I want an MD5 hash.
Unfortunately the encryptedPass looks like that:
1ba49f4d1ff0f49c
What am I doing wrong ? Did I forget anything ?
Thanks
|
|
0
|
|
|
|
Reply
|
carsten_maul (2)
|
9/23/2004 2:40:56 PM |
|
Carsten Maul <carsten_maul@gmx.de> writes:
>I want to generate an MD5 checksum with crypt.h, installed OS Debian Woody.
>Unfortunately I only get DES hashes with
>strncpy(salt, row[0], 12);
>salt[12] = '\0';
>encryptedPass = crypt(passwd, salt);
>free(salt);
Typical use is:
crypt(passwd, row[0]);
i.e., pass the entire encrypted password in as salt.
That makes your code portable to different algorithms.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
|
|
0
|
|
|
|
Reply
|
Casper
|
9/23/2004 5:35:48 PM
|
|
On Thu, 23 Sep 2004 16:40:56 +0200, Carsten Maul wrote:
> Hi,
>
>
> I want to generate an MD5 checksum with crypt.h, installed OS Debian Woody.
> Unfortunately I only get DES hashes with
>
> strncpy(salt, row[0], 12);
> salt[12] = '\0';
> row[0] looks like that: $1$mYV0L3j8$nUUWy09JYrzdXurr92ywv1
>
> salt starts with $1$ to indicate that I want an MD5 hash.
You need at least "$1$mYV0L3j8$" which is bigger than 11 characters. And
as casper said, the second argument should be const char * ... so you
don't need the copy.
--
James Antill -- james@and.org
Need an efficient and powerful string library for C?
http://www.and.org/vstr/
|
|
0
|
|
|
|
Reply
|
James
|
9/24/2004 5:56:10 PM
|
|
|
2 Replies
445 Views
(page loaded in 0.044 seconds)
Similiar Articles: Creating an MD5 hash - comp.unix.programmerHi, I want to generate an MD5 checksum with crypt.h, installed OS Debian Woody. Unfortunately I only get DES hashes with strncpy(salt, row[0], 12);... MD5 Hash - comp.lang.c++Hi, I need in my C++ programm a MD5 hash value. I'm write my codes with Boost for Unix, OSX and Windows. Is there any class or function in the ... Mixed SHA, MD5 and Crypt Password Authentication - comp.sys.sun ...Creating an MD5 hash - comp.unix.programmer Hi, I want to generate an MD5 checksum with crypt.h, installed OS ... row[0]); i.e., pass the entire encrypted password in ... How to set the seed as a 128 binary string of psudo random number ...I'm doing a research, which requires me to feed the hash (MD5 hash) of an image to a pseudo random number generator to create a watermark (1*1000 matrix). validate-checksum Command - comp.dcom.sys.ciscoCreating an MD5 hash - comp.unix.programmer validate-checksum Command - comp.dcom.sys.cisco The MD5 File Validation feature allows you to generate the MD5 checksum ... Checksum with no creation date - comp.lang.java.helpCreating an MD5 hash - comp.unix.programmer Checksum with no creation date - comp.lang.java.help Creating an MD5 hash - comp.unix.programmer Checksum with no creation date ... IPSec VPN - Cisco 837 to Fortigate 60 - comp.dcom.sys.cisco ...Creating an MD5 hash - comp.unix.programmer IPSec VPN - Cisco 837 to Fortigate 60 - comp.dcom.sys.cisco ... Relevant sections of my config are below: crypto isakmp policy ... javax.net.ssl.SSLException: Unrecognized SSL message - comp.lang ...... default factory (javax.net.ssl.SSLSocketFactory) to create ... DHE_DSS_WITH_DES_CBC_SHA SSL_RSA_EXPORT_WITH_RC4_40_MD5 ... -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ranga wrote ... Generating unique string identifier - comp.soft-sys.sas... generate unique string identifier using md5() function from macro %sysfunc like: %let __hash = %nrbquote(%sysfunc(md5(%sysfunc(rand(UNIFORM))))); It takes md5 hash ... generating AES 128 bit key frm password - comp.lang.java.security ...Creating an MD5 hash - comp.unix.programmer generating AES 128 bit key frm password - comp.lang.java.security ... MD5 Hash - comp.lang.c++ Mixed SHA, MD5 and Crypt Password ... MD5 Hash GeneratorMD5 Hash Generator. Free tool to create an MD5 hash from a string. Example C Program: Creating an MD5 Hash from File ContentThe following example demonstrates using CryptoAPI to compute the MD5 hash of the contents of a file. This example performs the computation on the contents ... 7/22/2012 10:54:11 AM
|
|
|
|
|
|
|
|
|