Answers.Body: <p>Any source of unknown data should be fine - I'd use a command like this just because it's quicker:</p>
  
  <pre><code>head -n 1000 /dev/urandom | md5sum
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-15T22:33:03.147Z
Answers.Text: NB: "it's quicker" isn't great criteria for cryptographic RNG - but I do think this will give you a very hard to predict key
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-15T22:17:54.890Z
Answers.LastActivityDate: 2015-06-15T22:17:54.890Z
Answers.UserDisplayName: Chris Burgess
Answers.Body: <p>There is no requirement to generate the SITE_KEY in the same way. (In fact, the algorithm changed in v4.6.3.) Rather, follow these requirements: </p>
  
  <ul>
  <li>Stick to alphanumerics </li>
  <li>Provide decent entropy (I think 90 bits would be decent, but there's no downside to going higher)</li>
  </ul>
  
  <p>For some better ways to generate a SITE_KEY:</p>
  
  <ul>
  <li>On Debian/Ubuntu-based systems, run: <code>sudo apt-get install makepasswd &amp;&amp; makepasswd  --chars=32</code> (~190 bits)</li>
  <li>Use <a href="https://github.com/civicrm/civicrm-buildkit/blob/master/bin/mkpasswd.php" rel="nofollow">mkpasswd.php</a> from <a href="https://github.com/civicrm/civicrm-buildkit" rel="nofollow">civicrm-buildkit</a>, eg: <code>mkpasswd.php 32</code> (~190 bits)</li>
  <li>Do something closer to v4.6's algorithm: <code>php -r 'echo md5(rand() . mt_rand() . rand() . uniqid("", TRUE) . "www.example.org") . "\n";'</code> (~128 bits)</li>
  </ul>
  
  <p><strong>Random Tip</strong>: If you use an authenticated SMTP service for mail delivery and you change the SITE_KEY, then you may need to re-enter the SMTP password.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-16T14:03:15.917Z
Answers.LastActivityDate: 2015-06-16T14:03:15.917Z
Answers.UserDisplayName: Tim Otten
Body: <p>One of my clients' webhosts posted the SITE_KEY of their site on a publicly accessible webpage.  How do I generate a new SITE_KEY with the same random process that generated the original?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-15T22:45:31.173Z
Comments.Text: Next: [What will happen when I change the SITE_KEY?](http://civicrm.stackexchange.com/questions/3250/what-are-the-implications-of-changing-the-site-key)
Comments.UserDisplayName: Chris Burgess
Tags: <civicrm.settings.php>
Title: Generating a new SITE_KEY
ThreadText: # Generating a new SITE_KEY
  
  (Asked by: username_0 on 2015-06-15)
  
  One of my clients' webhosts posted the SITE\_KEY of their site on a publicly accessible webpage. How do I generate a new SITE\_KEY with the same random process that generated the original?
  
  **Tags:** civicrm.settings.php
  
  > **Comments:**
  > **username_1**: Next: [What will happen when I change the SITE_KEY?](http://civicrm.stackexchange.com/questions/3250/what-are-the-implications-of-changing-the-site-key)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-06-15. Score: 4
  
  Any source of unknown data should be fine - I'd use a command like this just because it's quicker:
  head -n 1000 /dev/urandom | md5sum
  
  > **Comments:**
  > **username_1**: NB: "it's quicker" isn't great criteria for cryptographic RNG - but I do think this will give you a very hard to predict key  
  
  ---
  
  ### Answer by username_2 on 2015-06-16. Score: 2
  
  There is no requirement to generate the SITE\_KEY in the same way. (In fact, the algorithm changed in v4.6.3.) Rather, follow these requirements:
  
  * Stick to alphanumerics
  * Provide decent entropy (I think 90 bits would be decent, but there's no downside to going higher)
  
  For some better ways to generate a SITE\_KEY:
  
  * On Debian/Ubuntu-based systems, run: `sudo apt-get install makepasswd && makepasswd --chars=32` (~190 bits)
  * Use [mkpasswd.php](https://github.com/civicrm/civicrm-buildkit/blob/master/bin/mkpasswd.php) from [civicrm-buildkit](https://github.com/civicrm/civicrm-buildkit), eg: `mkpasswd.php 32` (~190 bits)
  * Do something closer to v4.6's algorithm: `php -r 'echo md5(rand() . mt_rand() . rand() . uniqid("", TRUE) . "www.example.org") . "\n";'` (~128 bits)
  
  **Random Tip**: If you use an authenticated SMTP service for mail delivery and you change the SITE\_KEY, then you may need to re-enter the SMTP password.
  
  
  ---
  
  