Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Hashes are one way encryption. You're not supposed to be able to decrypt the password. </p> <p>Basic operations for passwords:</p> <ol> <li><p>The customer signs up for an account and enters a password. The system adds a salt, encrypts the password and stores the resulting password hash in the database.</p></li> <li><p>The customer logs in, enters the password. The system adds a salt, encrypts the password and compares the generated password hash with the stored password hash. When the hashes are equal, the login system knows the customer knows the password without actually knowing the password itself.</p></li> </ol> <p>So, if one system uses SHA1 and another uses old, expired MD5, the only way you can get the password back into the system is to have the customer reenter the password so the new hash algorithm gets invoked and the new hash gets stored.</p> <p>You have the Enterprise source code, write a module that uses the Enterprise hashing function to store and compare the passwords and you'll have CE with an updated, security enhanced method to store passwords and should be able to bring the password hashes over from the old site.</p> <p><strong>Some additional information:</strong></p> <p>The encryption method used is found in the Mage_Core_Model_Encryption class.</p> <p>Three functions of interest are:</p> <ol> <li><code>public function hash($data)</code></li> <li><code>public function getHash($password, $salt = false)</code></li> <li><code>public function validateHash($password, $hash)</code></li> </ol> <p><strong>Function Code From 1.7.x.x</strong></p> <p>></p> <pre><code>public function hash($data) { return md5($data); } </code></pre> <p>></p> <pre><code>public function getHash($password, $salt = false) { if (is_integer($salt)) { $salt = $this-&gt;_helper-&gt;getRandomString($salt); } return $salt === false ? $this-&gt;hash($password) : $this-&gt;hash($salt . $password) . ':' . $salt; } </code></pre> <p>></p> <pre><code>public function validateHash($password, $hash) { $hashArr = explode(':', $hash); switch (count($hashArr)) { case 1: return $this-&gt;hash($password) === $hash; case 2: return $this-&gt;hash($hashArr[1] . $password) === $hashArr[0]; } Mage::throwException('Invalid hash.'); } </code></pre> <p>It appears that both CE and Enterprise use the same routines, <strong>you will have to check that out as you have the Enterprise code</strong>.</p> <p>Changing the Encryption Key in your app/etc/local.xml file to match the key in your Enterprise version and then importing the Enterprise data into the CE datapbase will allow access to encrypted data. Passwords, though are stored as hashes (see above function blocks) and non-reversible due to that. The pertinent section in local.xml where the encryption key is stored:</p> <pre><code>&lt;crypt&gt; &lt;key&gt;&lt; ![CDATA[-encryption-key-here-]]&gt;&lt;/key&gt; &lt;/crypt&gt; </code></pre>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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