Skip to content
Snippets Groups Projects
Commit d4679838 authored by Alex Pott's avatar Alex Pott
Browse files

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

parent 6e95f006
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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)));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment