473,657 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CRYPT_MD5 on Mac OS/X via mhash/mcrypt/md5/etc etc?

Long story short. I want to use Mac OS/X and PHP. I have a db with
passwords stored under Linux using the crypt("foo", "$1$".$salt."$) ;
scheme. This means that crypt should execute a CRYPT_MD5 password hash.
I know that Mac OS/X only supports the two DES'. So is there a way I can
use mcrypt, or mhash or ANY library to reproduce php's CRYPT_MD5 crypt()
call?

I don't really have a choice to use another password hash scheme, as the
data is being given to me. I have tried almost everything to produce the
same output to no avail:

Under Linux, php has a crypt() function which takes the md5 format (and
blowfish). This will produce a hash of:

<<CRYPT MAGIC><< 8 CHAR USER SALT>$ <<HASHED PW>>

$1$ FpsaEXUM $ rXsH1UzUs6w3vfi k/wHGr.

PHP supports DES under Mac OS/X (no blowfish, or MD5 crypt). Sites I've
been to, have informed the developer to use a different algorithm and
that it would solve their problem. I, alas, cannot use a different
system. The passwords are stored in someone else's DB and I am forced to
use the Linux PHP/Crypt/MD5 version.

I have tried the md5(), mcrypt (as much as i can understand it, I am not
an encryption expert), mhash (MHASH_MD5) functions to no avail.

To explain what I am doing...

With PHP's crypt() on Linux:

1) look up the password for the user logging in (in a DB or file)
2) grab the salt for that password (it's created at random when the
password is created): chars between '$1$' and '$' (8 characters)
3) take the user supplied password, run it through PHP's crypt with the
same salt: crypt("foobar", "$1$"."FpsaEXUM "."$")
3a) Result: $1$FpsaEXUM$rXs H1UzUs6w3vfik/wHGr.

With mhash:
base64_encode(m hash(MHASH_MD5, $mypassword, "$1$".$salt."$" ));
Result: 6ZspEb5d0AMqo/RkSod8dw==

With mhash:
base64_encode(m hash_keygen_s2k (MHASH_MD5, $mypassword, "$1$".$salt."$" ,
16));
Result: blAOWSV9/hmRk/Z06IFQKA==

I've tried permutations of those without the "$1$"..."$" and still
nothing. Even if the hash matched, and I would just add the "$1$"..."$"
that would work. I've tried md5(), no luck.

Needless to say, the crypt() functions on the mac don't work. I
obviously recompiled php to support mcrypt and mhash (and gd, unrelated
issue), hoping that would solve the issue... no dice.

any help, i am desparate here... heck even an explanation as to why it's
not possible even with external libraries, would be good.

-E
Sep 12 '06 #1
0 2021

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3300
by: Matt McKay | last post by:
I've written a php page which allows users to type in a text string and a key, then choose from a dropdown menu of encryption/decryption cyphers, and a method (encrypt, decrypt). The whole thing works, except the mcrypt command doesn't work. here is my mcrypt command: if ($method == 0) { //Encrypt $output = mcrypt_ecb ($algorithm, $key, $input, MCRYPT_ENCRYPT);
0
1386
by: dave | last post by:
Hello, Does anyone have experience with mhash? I've got a situation where i have to "create an mhash module and load it in to php" which is apparently not what i thought it was, recompiling php with mhash support. If anyone has done this please get back to me. Thanks. Dave.
0
1359
by: dave | last post by:
Hello, I'm really hoping someone can help here, i am very frustrated on this issue. If this were my linux box i'd commit myself for insanity, this setup is so frustrating! Ok, done rambling, Linux box, rh version unknown, apache 1.3.27 with frontpage extensions, php 4.3.0, and i'm trying to install mhash. I was informed this is occurring in a vdp environment whatever that is, and so i compiled and installed mhash thinking apache and php...
1
9068
by: BKDotCom | last post by:
I'm writing an app that will use blowfish encryption.. PHP's mcrypt will be used if available. if not, I'll use PHPmyadmin's blowfish.php library. The problem is I can't figure out what initialization vector blowfish.php is useing (or if that's even my problem). ie, if I encrypt with blowfish.php and decrypt with mcrypt: /* include path to phpmyadmin '/libraries/blowfish.php'; */ $secret = 'secret';
4
28022
by: believein | last post by:
Hi all, I installed PHP thru the XAMPP package on my windows machine. The problem, I couldn't solve, is that the mcryppt funcs don't work. It return the following message: Call to undefined function mcrypt_decrypt() ... If I write a <?php echo ***";
1
2127
by: laredotornado | last post by:
Hello, My hosting company does not support the PHP mcrypt functions. Instead, they recomend using the command line, /usr/local/bin/mcrypt utility via PHP's exec method. Sadly, they do not provide any documentation how to do this. How would i translate the following function encryptString($p_str) { $iv_size = mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
5
3060
by: sylvian stone | last post by:
Hi, I'm getting some strange errors that I cannot pin down: Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 7, needed: 8 in...... This is strange because the data is encrypted, inserted into the databse, then later retrieved and decrypted with the necessary hash and ivector keys.
3
3178
by: Paul Furman | last post by:
I'm trying to set up a web page for credit card transactions and baffled trying to find a download for mhash functions for my windows apache development server. The real server supports mhash but I can't test it on my localhost system. php.net points me to http://pecl.php.net/packages.php where I don't see it in plain english, googling around it looks like this may be it: http://sourceforge.net/forum/forum.php?forum_id=585348 but it's...
3
8767
by: =?UTF-8?Q?Ahmad_=E3=8B=A1_Baitalmal?= | last post by:
Hi, I'm having a hard time getting python-mcrypt extension to build. I installed libmcrypt with --prefix=/usr and I checked that the library exists -rwxr-xr-x 1 root wheel 352K Sep 19 16:53 /usr/lib/libmcrypt. 4.4.8.dylib* lrwxr-xr-x 1 root wheel 21B Sep 19 16:53 /usr/lib/libmcrypt. 4.dylib@ -libmcrypt.4.4.8.dylib lrwxr-xr-x 1 root wheel 21B Sep 19 16:53 /usr/lib/
0
8421
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8325
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.