Revert "rm html stuff from repo, changes too often. enhanced pcpstream"

This reverts commit 82b05b768e.
This commit is contained in:
TLINDEN
2014-02-21 20:35:10 +01:00
parent 82b05b768e
commit fe1ea9cb76
6 changed files with 21 additions and 145 deletions

View File

@@ -9,8 +9,8 @@ int main() {
FILE *out, *in;
unsigned char clear[8] = "ABCDEFGH";
unsigned char key[8] = "IxD8Lq1K";
unsigned char crypt[11] = {0};
int blocks = 24;
unsigned char crypt[8] = {0};
int blocks = 8;
int i = 0;
if((out = fopen("teststream.out", "wb+")) == NULL) {
@@ -18,7 +18,6 @@ int main() {
return 1;
}
Pcpstream *pout = ps_new_file(out);
ps_armor(pout);
/* "encrypt" a couple of times into the file */
for(i=0; i<blocks; i++) {
@@ -35,15 +34,14 @@ int main() {
return 1;
}
Pcpstream *pin = ps_new_file(in);
ps_determine(pin);
/* we'll use this stream to put the "decrypted" data in.
note, that this could be a file as well. */
Pcpstream *pclear = ps_new_outbuffer();
/* read and "decrypt" */
for(i=0; i<blocks; i++) {
ps_read(pin, crypt, 10);
ps_read(pin, crypt, 8);
_xorbuf(key, crypt, 8);
ps_write(pclear, crypt, 8);
}
@@ -56,7 +54,6 @@ int main() {
/* and verify if it's "decrypted" (re-use crypt) */
for(i=0; i<blocks; i++) {
buffer_get_chunk(result, crypt, 8);
_dump("chunk", crypt, 8);
if(memcmp(crypt, clear, 8) != 0) {
fprintf(stderr, "Oops, block %d doesn't match\n", i);
goto error;