Skip to content

Commit b5f654a

Browse files
committed
Fixed the salt generation algorithm in remoting lib.
1 parent 4e7add4 commit b5f654a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

interface/lib/classes/remoting_lib.inc.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,10 @@ function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '
492492
$sql_insert_key .= "`$key`, ";
493493
if($field['encryption'] == 'CRYPT') {
494494
$salt="$1$";
495+
$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
495496
for ($n=0;$n<8;$n++) {
496-
$salt.=chr(mt_rand(64,126));
497+
//$salt.=chr(mt_rand(64,126));
498+
$salt.=$base64_alphabet[mt_rand(0,63)];
497499
}
498500
$salt.="$";
499501
// $salt = substr(md5(time()),0,2);
@@ -519,8 +521,10 @@ function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '
519521
if($field['formtype'] == 'PASSWORD') {
520522
if($field['encryption'] == 'CRYPT') {
521523
$salt="$1$";
524+
$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
522525
for ($n=0;$n<8;$n++) {
523-
$salt.=chr(mt_rand(64,126));
526+
//$salt.=chr(mt_rand(64,126));
527+
$salt.=$base64_alphabet[mt_rand(0,63)];
524528
}
525529
$salt.="$";
526530
// $salt = substr(md5(time()),0,2);

0 commit comments

Comments
 (0)