Commit d4679838 authored by alexpott's avatar alexpott

Issue #2541318 by dawehner: Get rid of strtr in Crypt

parent 6e95f006
......@@ -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 strtr($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 strtr($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 strtr(base64_encode(static::randomBytes($count)), array('+' => '-', '/' => '_', '=' => ''));
return str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(static::randomBytes($count)));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment