Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
d4679838
Commit
d4679838
authored
Jul 28, 2015
by
alexpott
Browse files
Issue
#2541318
by dawehner: Get rid of strtr in Crypt
parent
6e95f006
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Component/Utility/Crypt.php
View file @
d4679838
...
...
@@ -106,7 +106,7 @@ public static function hmacBase64($data, $key) {
$hmac
=
base64_encode
(
hash_hmac
(
'sha256'
,
$data
,
$key
,
TRUE
));
// Modify the hmac so it's safe to use in URLs.
return
str
tr
(
$hmac
,
array
(
'+'
=>
'-'
,
'/'
=>
'_'
,
'='
=>
''
)
);
return
str
_replace
([
'+'
,
'/'
,
'='
],
[
'-'
,
'_'
,
''
],
$hmac
);
}
/**
...
...
@@ -122,7 +122,7 @@ public static function hmacBase64($data, $key) {
public
static
function
hashBase64
(
$data
)
{
$hash
=
base64_encode
(
hash
(
'sha256'
,
$data
,
TRUE
));
// Modify the hash so it's safe to use in URLs.
return
str
tr
(
$hash
,
array
(
'+'
=>
'-'
,
'/'
=>
'_'
,
'='
=>
''
)
);
return
str
_replace
([
'+'
,
'/'
,
'='
],
[
'-'
,
'_'
,
''
],
$hash
);
}
/**
...
...
@@ -137,7 +137,7 @@ public static function hashBase64($data) {
* @see \Drupal\Component\Utility\Crypt::randomBytes()
*/
public
static
function
randomBytesBase64
(
$count
=
32
)
{
return
str
tr
(
base64_encode
(
static
::
randomBytes
(
$count
)),
array
(
'+'
=>
'-'
,
'/'
=>
'_'
,
'='
=>
''
));
return
str
_replace
([
'+'
,
'/'
,
'='
],
[
'-'
,
'_'
,
''
],
base64_encode
(
static
::
randomBytes
(
$count
)
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment