summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorbryan <bryan@veltar.systems>2026-08-26 15:16:23 +0200
committerbryan <bryan@veltar.systems>2026-08-26 15:16:23 +0200
commit22ade138c4e83b7c0b0c702c38c0ca00a9948d4b (patch)
treef78768a69dded978be14aa4290b198903b27f4c0 /README
parentdfce501af03595a8fb5083fbc43b48d729ae9551 (diff)
downloadrg-22ade138c4e83b7c0b0c702c38c0ca00a9948d4b.tar.gz
rg-22ade138c4e83b7c0b0c702c38c0ca00a9948d4b.zip
Replace the placeholder with a suckless C rg.
rg prints n cryptographically random strings of length l, matching rg.veltar.systems. Bytes come from getrandom(2) on Linux and rand_s on Windows. make selects clang and .exe when OS=Windows_NT.
Diffstat (limited to 'README')
-rw-r--r--README73
1 files changed, 73 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..d470444
--- /dev/null
+++ b/README
@@ -0,0 +1,73 @@
+rg - random string generator
+============================
+rg prints cryptographically random alphanumeric strings. It is a
+suckless rewrite of rg.veltar.systems as a small C program that
+builds on Linux and Windows.
+
+ rg [-v] [-n n] [-l l]
+
+n number of strings (default 6, min 1, max 1000)
+l length of each string (default 10, min 1, max 256)
+
+
+Requirements
+------------
+A C99 compiler.
+
+Linux: libc with getrandom(2) (glibc 2.25+).
+Windows: a compiler with rand_s (MSVC, clang targeting MSVC, or
+MinGW-w64).
+
+
+Installation
+------------
+Edit config.mk to match your local setup. Edit config.def.h for the
+alphabet and limits.
+
+Linux:
+
+ make clean install
+
+Windows (GNU make + clang, from this tree):
+
+ make
+
+The Windows bits of config.mk are selected when OS=Windows_NT.
+Otherwise set CC, EXE=.exe, and CPPFLAGS by hand as commented there.
+
+
+Running without make
+--------------------
+ cp config.def.h config.h
+
+Linux:
+
+ cc -std=c99 -D_DEFAULT_SOURCE -o rg rg.c
+
+Windows (clang / MSVC CRT):
+
+ clang -std=c99 -D_CRT_RAND_S -o rg.exe rg.c
+
+Windows (MinGW-w64):
+
+ gcc -std=c99 -D_CRT_RAND_S -o rg.exe rg.c
+
+
+Usage
+-----
+ rg
+ rg -n 6 -l 10
+ rg -n 1 -l 32
+
+
+Configuration
+-------------
+Copy config.def.h to config.h (make does this) and edit. Do not
+edit rg.c for configuration.
+
+
+Remarks
+-------
+The original page at rg.veltar.systems used n % alphabet.length on
+raw 32-bit draws, which is slightly biased. This program rejects
+values in the incomplete last bucket so each symbol is equiprobable.