Source code of Windows XP (NT5)
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.

38 lines
748 B

  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. int __cdecl main(int argc, char *argv[])
  11. {
  12. FILE * fpIn;
  13. FILE * fpOut;
  14. int iEncrypt=0;
  15. int iCh;
  16. if ( argc != 3 ) {
  17. fprintf(stderr, "usage: encrypt infile outfile\n");
  18. return(1);
  19. }
  20. if ( (fpIn=fopen(argv[1], "rb") ) == NULL) {
  21. fprintf(stderr, "cant open %s\n", argv[1]);
  22. return(1);
  23. }
  24. if ( (fpOut=fopen(argv[2], "wb") ) == NULL) {
  25. fprintf(stderr, "cant open %s\n", argv[2]);
  26. return(1);
  27. }
  28. while ( (iCh=getc(fpIn)) != EOF )
  29. putc((char) (((char) iCh) ^ (128 | (iEncrypt++ & 127))), fpOut);
  30. return(0);
  31. }