Note that there are some explanatory texts on larger screens.

plurals
  1. POConvert SHA1 hex to base64 encoded (for Apache htpasswd) in PERL
    primarykey
    data
    text
    <p>I have a PHP application that has passwords stored in the database as the output of sha1($password), which is apparently the hex representation of the binary SHA1 hash. (as I understand it)</p> <p>I would like to convert that to a format that is compatible for Apache .htpassword files, which needs to be the base64 encoded binary value or the output of base64_encode(sha1($password, true)).</p> <p>I found this thread: <a href="https://stackoverflow.com/questions/2914504/convert-base64d-sha1-hashes-to-hex-hashes">Convert base64&#39;d SHA1 hashes to Hex hashes</a> ... which is doing the opposite of what I need to do, and it works great. I tried to change the ordering of the commands and use hex2bin instead of bin2hex, but that doesn't work:</p> <p>Fatal error: Call to undefined function hex2bin() in php shell code on line 1</p> <p>Apparently that is not available until PHP 5.4, and this server is still on 5.3.x <a href="http://php.net/manual/en/function.hex2bin.php" rel="nofollow noreferrer">http://php.net/manual/en/function.hex2bin.php</a></p> <p>Here is the <em>real</em> problem. I <em>actually</em> need it to convert in PERL, preferably only using <em>standard</em> built-in modules to keep everything simple. I am not sure why they are using perl for this step, but I am trying to edit one very small part of a larger application and don't want to change the whole thing yet :)</p> <p>To be clear, I am <strong>not</strong> trying to convert hex numbers to binary numbers. This is a hex representation of a binary value, stored in a perl "string" :)</p> <p>Thanks in advance, Tommy</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload