From 22ade138c4e83b7c0b0c702c38c0ca00a9948d4b Mon Sep 17 00:00:00 2001 From: bryan Date: Wed, 26 Aug 2026 15:16:23 +0200 Subject: 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. --- README | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 README (limited to 'README') 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. -- cgit v1.2.3