• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

.htpasswd generator

Explorer ,
Sep 28, 2006 Sep 28, 2006

Copy link to clipboard

Copied

Hello All,

I was woundering if any one could point me in the correct direction, how would you go about encrypting passwords using coldfusion to work in the .htaccess .htpasswd format used commonly with apachie web servers.

I have the script for it on my PHP server but am woundering how to do it with a cold fussion page
PHP script below

<?php
// Password to be encrypted for a .htpasswd file
$clearTextPassword = 'passwordhere';

// Encrypt password
$password = crypt($clearTextPassword, base64_encode($clearTextPassword));

// Print encrypted password
echo $password;
?>

I understand whats going on here just am not sure how to do the same thing in coldfussion, sorry my coldfussion knoledge is patchy.

Kind Regards Guy

TOPICS
Advanced techniques

Views

474

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Sep 28, 2006 Sep 28, 2006

Copy link to clipboard

Copied

The hash () function provides superior security.

Question: Do you need to interoperate with a php system or generate hashes that are identical to the php code posted?
That could get tricky because crypt uses unix DES for the default hash.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 02, 2006 Oct 02, 2006

Copy link to clipboard

Copied

LATEST
not sure about replicating it, but it you're using a linux server you can always rely in the htpasswd binary. See attached code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation