34793fa5b393f265f3a9a652204eb9bf6593da2e
[yaffs-website] / src / Utility / Crypt.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\bootstrap\Utility\Crypt.
5  */
6
7 namespace Drupal\bootstrap\Utility;
8
9 /**
10  * Extends \Drupal\Component\Utility\Crypt.
11  *
12  * @ingroup utility
13  */
14 class Crypt extends \Drupal\Component\Utility\Crypt {
15
16   /**
17    * Generates a unique hash name.
18    *
19    * @param ...
20    *   All arguments passed will be serialized and used to generate the hash.
21    *
22    * @return string
23    *   The generated hash identifier.
24    */
25   public static function generateHash() {
26     $args = func_get_args();
27     $hash = '';
28     if (is_string($args[0])) {
29       $hash = $args[0] . ':';
30     }
31     elseif (is_array($args[0])) {
32       $hash = implode(':', $args[0]) . ':';
33     }
34     $hash .= self::hashBase64(serialize($args));
35     return $hash;
36   }
37 }