]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Diaspora plugin is almost there (for remote salmon slaps at least)
[quix0rs-gnu-social.git] / lib / util.php
index edada03864a37d1781f0a6b47ca0e2780210b08b..64733986d3db8a7fc23d20fdf1090caba0b06637 100644 (file)
@@ -1557,14 +1557,24 @@ function common_root_url($ssl=false)
 }
 
 /**
- * returns $bytes bytes of random data as a hexadecimal string
+ * returns $bytes bytes of raw random data
  */
-function common_random_hexstr($bytes)
+function common_random_rawstr($bytes)
 {
-    $str = @file_exists('/dev/urandom')
+    $rawstr = @file_exists('/dev/urandom')
             ? common_urandom($bytes)
             : common_mtrand($bytes);
 
+    return $rawstr;
+}
+
+/**
+ * returns $bytes bytes of random data as a hexadecimal string
+ */
+function common_random_hexstr($bytes)
+{
+    $str = common_random_rawstr($bytes);
+
     $hexstr = '';
     for ($i = 0; $i < $bytes; $i++) {
         $hexstr .= sprintf("%02x", ord($str[$i]));