aboutsummaryrefslogtreecommitdiffhomepage
path: root/misc/random_printable_bytes.php
diff options
context:
space:
mode:
Diffstat (limited to 'misc/random_printable_bytes.php')
-rw-r--r--misc/random_printable_bytes.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/misc/random_printable_bytes.php b/misc/random_printable_bytes.php
new file mode 100644
index 0000000..d2b8770
--- /dev/null
+++ b/misc/random_printable_bytes.php
@@ -0,0 +1,10 @@
+<?php
+
+/**
+ * Generates a cryptographically secure random printable string
+ * @return string
+ */
+function random_printable_bytes(): string {
+ // i think 128 bytes should be enough .. i hope so anyway
+ return base64_encode(random_bytes(128));
+} \ No newline at end of file