473,786 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Apache MD5 algo in PHP

hi.

has anyone tryed to check .htpasswd passwords with php?
everythink works fine as long as they are encrypted with
the default CRYPT mode of apaches htpasswd.

crypt($pass, $htpass) === $htpass

but how to check MD5?
if you use ./htpasswd -m .htpasswd user
the password will be md5 encrypted.
php manual says that crypt supports md5 if the "salt" starts with $1$.

CRYPT_MD5 - MD5 encryption with a twelve character
salt starting with $1$

then i read the htpasswd manual:

-m Use Apache's modified MD5 algorithm for passwords.
The MD5 algorithm used by htpasswd is specific to the Apache
software; passwords encrypted using it will not be usable
with other Web servers.

great.
does anyone know if a apache md5 algorithm exists for php?

thanks alot, chris

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jul 17 '05 #1
4 9934
There is a md5() function in PHP, but as the people from Apache say that
their md5 algorithm is specific to Apache, you might expect that
md5($string) in php has a different output than Apache...but you might
be able to easily check that....I encrypt the password in the database
with md5 encryption.

Mark

Christian Meisinger wrote:
hi.

has anyone tryed to check .htpasswd passwords with php?
everythink works fine as long as they are encrypted with
the default CRYPT mode of apaches htpasswd.

crypt($pass, $htpass) === $htpass

but how to check MD5?
if you use ./htpasswd -m .htpasswd user
the password will be md5 encrypted.
php manual says that crypt supports md5 if the "salt" starts with $1$.

CRYPT_MD5 - MD5 encryption with a twelve character
salt starting with $1$

then i read the htpasswd manual:

-m Use Apache's modified MD5 algorithm for passwords.
The MD5 algorithm used by htpasswd is specific to the Apache
software; passwords encrypted using it will not be usable
with other Web servers.

great.
does anyone know if a apache md5 algorithm exists for php?

thanks alot, chris

Jul 17 '05 #2
On Wed, 17 Mar 2004 09:44:25 +0100, "Christian Meisinger"
<c.*********@li vingliquid.com> wrote:
has anyone tryed to check .htpasswd passwords with php?
everythink works fine as long as they are encrypted with
the default CRYPT mode of apaches htpasswd.

crypt($pass, $htpass) === $htpass

but how to check MD5?
if you use ./htpasswd -m .htpasswd user
the password will be md5 encrypted.
php manual says that crypt supports md5 if the "salt" starts with $1$.

CRYPT_MD5 - MD5 encryption with a twelve character
salt starting with $1$

then i read the htpasswd manual:

-m Use Apache's modified MD5 algorithm for passwords.
The MD5 algorithm used by htpasswd is specific to the Apache
software; passwords encrypted using it will not be usable
with other Web servers.

great.
does anyone know if a apache md5 algorithm exists for php?


Well - Apache is open source, so you can have a look at the code they use.

In the Apache source, have a look at apr_md5_encode in
srclib/apr-util/crypto/apr_md5.c .

It contains such gems of comments as:

/*
* Then something really weird...
*/

I don't know how much experience you have with C; you may be able to work
through the source and link against APR to get a small executable that does the
same as htpasswd. Or if you're particularly competent with C you could
translate the relevant parts to PHP; C and PHP share a fair amount of syntax.

Perhaps you could run htpasswd using exec(), getting it to write to a
temporary file of your choice, then read that file? I haven't traced it far
enough into what it actually writes to the file to say whether this will be a
workable approach, though.

--
Andy Hassall <an**@andyh.co. uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>
Jul 17 '05 #3
On Wed, 17 Mar 2004 10:54:10 +0100, Mark Kuiphuis
<maluka@remove_ this.koekeloeko e.nl> wrote:
There is a md5() function in PHP, but as the people from Apache say that
their md5 algorithm is specific to Apache, you might expect that
md5($string) in php has a different output than Apache...
and THATS exactly my problem :) as i wrote above...

so noone around here got a ready-out-of-the-box apache-md5 algo for php? ;)

but you might be able to easily check that....I encrypt the password in
the database with md5 encryption.

Mark

Jul 17 '05 #4
> Well - Apache is open source, so you can have a look at the code they
use.


i know and i did that already BUT my product is not open-source.
so what now?
can i convert (c -> php) this peace of code and use it in a
non-open-source project or not? i think not.
chris
Jul 17 '05 #5

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

Similar topics

10
4265
by: tgh003 | last post by:
So lets assume I have a list of tasks in db table (table looks like: ID, task, sort) And I want to reorder the task list without updating all the records in the table. I dont want to run a sql update stmt against every record to update the "sort" field. Any other easy way to do this? there has got to be a simple algo out there.
1
1776
by: MJ | last post by:
Hi I am searching for the algo book "The Algorithm Design Manual" by Steve S. Skiena If any one can tell me where can I get the free soft copy of this book It will be rally useful for me Regards MJ
4
2849
by: Sean Kelly | last post by:
The old one, not the .NET version. I don't see it listed, but since it's available under .NET I thought I'd ask. Also, there are some API calls which are supposedly not available under most Windows installations (CryptBinaryToString, for example). I don't suppose this has changed? Basically, I'm trying to replicate the functionality of some .NET crypto stuff in C++ and finding that some of the stuff I need isn't available. Sean
3
1653
by: autocomp | last post by:
Hi, Can someone tell me how to incorporate planner with calrender ... or just a calender algo...will help
3
1455
by: eight02645999 | last post by:
hi i need to do something like this eg given a number (as a string) = "123" there are a few combination i want to find with this string, ie "132","321","231","312" and "213". so there are 6 combinations altogether. i remember there's a formula for this, but forgot. Does python have any modules/functions to do this? thanks
5
2669
by: Marcus | last post by:
Hi, was wondering if anyone knows a good algo for rounding time to a desired interval. For instance, I have data set that is timestamped in second resolution and I need to modify that data to be timestamped for an x minute interval. So if time t = 93601, and x = 5 then t would be rounded up to 94000... if x were 1, t would equal 93700, etc. All time is integer based. Any help would be really appreciated.
1
2915
by: soyspinoza | last post by:
hello out there, does anyone know of a good C/C++ implementation of the hungarian algorithm, (i.e. munkres algo?) thanks,
4
1429
by: nishit.gupta | last post by:
finding a loop in a lisked list without modifying it. 1.reverse and check for beginning. 2.take two pointers, keep moving 1st by one and 2nd by two locations, if they meet loop exists. 3.store addresses in an array. is their any other possible solution???
3
2218
by: empiresolutions | last post by:
I am building a app that creates quizzes. This is how it goes - - Create Quiz - Provide up to 10 different types of Quiz Results - Give up to 50 Questions - Each Question has up to 10 possible Answers. - Each Answer is assigned a Weighted value.... for each type of Quiz Result. - Weighted values are in the range of -6, 0, +6. - Each Quiz will also apply the same Weight range for if a M/F is taking and what of 6 age groups the taker is...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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
9962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8992
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
7515
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
6748
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
4067
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
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.