Skip to content

Commit f27cfee

Browse files
authored
Update examples using md5(...) to use hash('md5', ...) (#3619)
1 parent a9c0102 commit f27cfee

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

reference/mcrypt/functions/mcrypt-module-open.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@
117117
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_DEV_RANDOM);
118118
$ks = mcrypt_enc_get_key_size($td);
119119
120-
/* Create key */
121-
$key = substr(md5('very secret key'), 0, $ks);
120+
/* Create key (example only: MD5 is not a good hash algorithm for this) */
121+
$key = substr(hash('md5', 'very secret key'), 0, $ks);
122122
123123
/* Intialize encryption */
124124
mcrypt_generic_init($td, $key, $iv);

reference/pdo_sqlite/PDO/sqliteCreateFunction.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
<?php
147147
function md5_and_reverse($string)
148148
{
149-
return strrev(md5($string));
149+
return strrev(hash('md5', $string));
150150
}
151151
152152
$db = new PDO('sqlite:sqlitedb');

reference/radius/constants.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ $challenge = mt_rand();
317317
$ident = 1;
318318
319319
// Add the Chap-Password attribute.
320-
$cp = md5(pack('Ca*', $ident, $password.$challenge), true);
320+
$cp = hash('md5', pack('Ca*', $ident, $password.$challenge), true);
321321
radius_put_attr($radh, RADIUS_CHAP_PASSWORD, pack('C', $ident).$cp);
322322
323323
// Add the Chap-Challenge attribute.

reference/radius/functions/radius-put-attr.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<?php
8686
mt_srand(time());
8787
$chall = mt_rand();
88-
$chapval = md5(pack('Ca*',1 , 'sepp' . $chall));
88+
$chapval = hash('md5', pack('Ca*',1 , 'sepp' . $chall));
8989
$pass = pack('CH*', 1, $chapval);
9090
if (!radius_put_attr($res, RADIUS_CHAP_PASSWORD, $pass)) {
9191
echo 'RadiusError:' . radius_strerror($res). "\n<br />";

reference/sqlite3/sqlite3/createfunction.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
<![CDATA[
133133
<?php
134134
function my_udf_md5($string) {
135-
return md5($string);
135+
return hash('md5', $string);
136136
}
137137
138138
$db = new SQLite3('mysqlitedb.db');

0 commit comments

Comments
 (0)