--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mLib/alloc.h>
+#include <mLib/base64.h>
+#include <mLib/dstr.h>
+#include <mLib/quis.h>
+#include <mLib/report.h>
+
+#include <catacomb/rand.h>
+#include <catacomb/noise.h>
+
+int main(int argc, char *argv[])
+{
+ dstr d = DSTR_INIT;
+ base64_ctx b;
+ char *p;
+ size_t n;
+
+ ego(argv[0]);
+ if (argc > 2) {
+ pquis(stderr, "Usage: $ [BITS]\n");
+ exit(EXIT_FAILURE);
+ }
+ n = argc == 2 ? atoi(argv[1]) : 128;
+ if (!n || n % 8) die(EXIT_FAILURE, "bad bit count");
+ n >>= 3;
+ p = xmalloc(n);
+ rand_noisesrc(RAND_GLOBAL, &noise_source);
+ rand_seed(RAND_GLOBAL, 160);
+ rand_get(RAND_GLOBAL, p, n);
+ base64_init(&b);
+ b.maxline = 0;
+ b.indent = "";
+ base64_encode(&b, p, n, &d);
+ base64_encode(&b, 0, 0, &d);
+ printf("%s\n", d.buf);
+ return (0);
+}