Changeset 112

Show
Ignore:
Timestamp:
2007-12-21 21:33:25 (1 year ago)
Author:
hannes
Message:

instead of just setting one hash in the settings template in the hope it'll be available, the installer now defines a whole list of hashes to try in that order to present a sensible default choice

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/install.php

    r109 r112  
    5959// define next page number 
    6060$nextpage = $page + 1; 
     61 
     62// since this is important define the order in which the password hashes should be suggested 
     63$hashes_default = Array(); 
     64$hashes_default[0] = 'sha512'; 
     65$hashes_default[1] = 'ripemd320'; 
     66$hashes_default[2] = 'sha384'; 
     67$hashes_default[3] = 'ripemd256'; 
     68$hashes_default[4] = 'sha256'; 
     69$hashes_default[5] = 'ripemd160'; 
     70$hashes_default[6] = 'ripemd128'; 
     71$hashes_default[7] = 'sha1'; 
     72// available 
     73$hashes = hash_algos(); 
     74for ($i = 7; $i <= 0; $i--) { 
     75    if (in_array($hashes_default[$i], $hashes)) { 
     76        // use this hash as default 
     77        $SETTINGS['hash'] = $hashes_default[$i]; 
     78    } 
     79} 
    6180 
    6281// unlike all the other pages, this installer is a little simpler and prints output directly 
     
    465484                    <select name="hash"> 
    466485        '); 
    467         $_hashes = hash_algos(); 
    468         foreach ($_hashes as $_hash) { 
     486        foreach ($hashes as $_hash) { 
    469487            print('<option value="' . $_hash . '"'); 
    470488            if ($SETTINGS['hash'] == $_hash) {