aboutsummaryrefslogtreecommitdiffhomepage
path: root/misc/random_printable_bytes.php
diff options
context:
space:
mode:
authorwinter2024-12-16 20:27:01 +0000
committerwinter2024-12-16 20:41:33 +0000
commit68c7e68b3f90fd980661774fdb2bb2d6140a34d0 (patch)
tree7993de39c7c637369bdbfb22e265319b43fcbf33 /misc/random_printable_bytes.php
parent2f4c1de3509141880df019ef1a6cc65981b3f6ea (diff)
implement the other side of auth (hopefully?)
also mostly untested for the same reason as last time
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