Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
789 B

5 years ago
  1. /* encrypt.c
  2. *
  3. * A dumb encryption/decryption algorithm -- for each character:
  4. *
  5. * chOut = (char) (*chIn ^ (128 | (iEncrypt++ & 127)));
  6. *
  7. * This program does both encryption and decryption.
  8. */
  9. #include <stdio.h>
  10. #ifndef WIN32
  11. #define _CRTAPI1
  12. #endif
  13. int _CRTAPI1 main(int argc, char *argv[])
  14. {
  15. FILE * fpIn;
  16. FILE * fpOut;
  17. int iEncrypt=0;
  18. int iCh;
  19. if ( argc != 3 ) {
  20. fprintf(stderr, "usage: encrypt infile outfile\n");
  21. return(1);
  22. }
  23. if ( (fpIn=fopen(argv[1], "rb") ) == NULL) {
  24. fprintf(stderr, "cant open %s\n", argv[1]);
  25. return(1);
  26. }
  27. if ( (fpOut=fopen(argv[2], "wb") ) == NULL) {
  28. fprintf(stderr, "cant open %s\n", argv[2]);
  29. return(1);
  30. }
  31. while ( (iCh=getc(fpIn)) != EOF )
  32. putc((char) (((char) iCh) ^ (128 | (iEncrypt++ & 127))), fpOut);
  33. return(0);
  34. }