[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Disguise_PGP_Ascii
-----BEGIN PGP SIGNED MESSAGE-----
It occurred to me that if we are going to be posting pgp'ed files to a
newsgroups it might be best to remove the PGP headers and make the
ciphertext look more text-like. So here is some code to do that, sort of.
Basically I kept it simple so it's easy to read.
To make this:
- -----BEGIN PGP MESSAGE-----
Version: 2.3a
pgAAANL6C1+DERhOIhjtLQnEA0GZOnXmXa7xSqPTdX1Retrkn+CnnqkBrdGXQ/sO
9Gl+k4MjG/8991Erhl+cay+SBSKS+YoGNp79mwEnvwHICq/WsMs6lTo6GudHku/e
9gnXVHkYg5/lYbAWFLRnIMDhGpeeUqCEoG5vlhl++JMwzgc/lqGCwZAeUd+q5UXG
bqm/sGAo80xtG2hs1LqLPP0lCoqSZ5cJkuNRJBgpm+r8P4PHijCLr9iAE4InFy+F
otm+Ut8SDYbt8OjR9WPig8V7aYdp8x0=
=i8Hu
- -----END PGP MESSAGE-----
turn into this:
- --- --BEG IN PGP M ESSAG E ---- -.. Ver s ion : 2.3a .. .. pgAAA N L
6C1+ DER hO IhjtL Qn E A0G ZO n X mXa7 x SqP TdX1 Retrk n+Cnn qk Br
dG XQ/sO ..9Gl +k4 MjG/8 9 91Er hl+ca y+SB SKS+ Yo GNp 79 m wEnv w
HICq /W sMs 6lT o 6GudH ku /e..9 gn XVHk Yg 5/lY bAW FLRn IMDh Gp e
eUq CEo G5 v lhl++ J M w zgc / lqGCw ZAe Ud+q5 UXG ..bq m/s GAo 80xt
G2 hs1Lq L PP0lC oqS Z5c JkuN RJBg pm+r8 P4P H ijC Lr9iA E4 InFy
+ F..ot m+U t8 SD Ybt8O jR 9WPig 8V 7 aYd p8x 0=..= i8 H u..--- --E ND
P GP ME S SAG E---- -..
type "st e < infile > outfile"
And to convert it back type "st d < infile > outfile"
ST.C:
#include <stdio.h>
#include <time.h>
#ifdef MSDOS || __OS2__
#include <stdlib.h> // for exit()
#endif
void
main(int argc, char **argv)
{
int i = 0, j = 0, k;
char c;
if (argc > 2)
fprintf(stderr, "\nUsage: %s [e|d] < infile > outfile\n", argv[0]), exit(1);
srand(time(0));
while (!feof(stdin)) {
if (toupper(*argv[1]) == 'E') {
k = rand() % 5;
for (i = 0; i < k + 1; i++, j++) {
if (!(j % 50)) putchar('\n');
c = getchar();
if (c == '\n') printf("..");
else putchar(c);
}
putchar(' ');
} else if (toupper(*argv[1]) == 'D') {
switch (c = getchar()) {
case ' ':
case '\n':
break;
case '.':
if (i == 1) putchar('\n');
i = !i;
break;
default:
putchar(c);
break;
}
} else
fprintf(stderr, "\nUsage: %s [e|d] < infile > outfile\n", \
argv[0]), exit(1);
}
}
-----BEGIN PGP SIGNATURE-----
Version: 2.3a
iQCcAgUBLdh1frhnz857T+PFAQH9RQQ2KC5uYfO8tLlq1X8PcmuJy0Akog84lyfK
sYEiiwMHJsNm6/isVWvihZHBct/DuBkqtNsWXzwxl1rxlVvjTjOMyyDioidbfqnb
IOWLXkY+/vzdvgxr/Z0tV31mwCVoCcHIMUeBZ9+PBCHt16YCEb7emPE0/QzLFWnB
VNUSkSW+hYtP8Ezg1UoS
=TESU
-----END PGP SIGNATURE-----