aboutsummaryrefslogtreecommitdiffstats
path: root/g10/g10.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/g10.c')
-rw-r--r--g10/g10.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/g10/g10.c b/g10/g10.c
index 99e5d6430..68a97974b 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -1879,17 +1879,33 @@ main( int argc, char **argv )
while( endless || count ) {
byte *p;
- size_t n = !endless && count < 100? count : 100;
+ /* Wee need a multiple of 3, so that in case of
+ armored output we get a correct string. No
+ linefolding is done, as it is best to levae this to
+ other tools */
+ size_t n = !endless && count < 99? count : 99;
p = get_random_bits( n*8, level, 0);
#ifdef HAVE_DOSISH_SYSTEM
setmode ( fileno(stdout), O_BINARY );
#endif
- fwrite( p, n, 1, stdout );
+ if (opt.armor) {
+ char *tmp = make_radix64_string (p, n);
+ fputs (tmp, stdout);
+ m_free (tmp);
+ if (n%3 == 1)
+ putchar ('=');
+ if (n%3)
+ putchar ('=');
+ } else {
+ fwrite( p, n, 1, stdout );
+ }
m_free(p);
if( !endless )
count -= n;
}
+ if (opt.armor)
+ putchar ('\n');
}
break;