home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / sci / crypt / 7181 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.7 KB  |  62 lines

  1. Newsgroups: sci.crypt
  2. Path: sparky!uunet!munnari.oz.au!sgiblab!darwin.sura.net!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!aun.uninett.no!ugle.unit.no!alf.uib.no!hsr.no!frank
  3. From: frank@hsr.no (Frank A Stevenson)
  4. Subject: Re: Toggle rot-13 decode..
  5. Message-ID: <1993Jan27.094456.10542@hsr.no>
  6. Sender: news@hsr.no
  7. Organization: Rogaland University Centre
  8. References:  <C1Ho7r.J1M@eis.calstate.edu>
  9. Date: Wed, 27 Jan 1993 09:44:56 GMT
  10. Lines: 50
  11.  
  12. In article <C1Ho7r.J1M@eis.calstate.edu>, ribarbe@eis.calstate.edu (Richard Eldon Barber) writes:
  13. > This system has an option:
  14. >         %, ^X   Toggle rot-13 decoding for this article
  15. > when viewing a piece of news.  Is this encryption?  Are there programs
  16. > available for macintosh or pc's to encode?
  17. > email ribarbe@eis.calstate.edu
  18. > ---rick
  19.  
  20.     ROT-13 encryption, is encryption, but it is designed to be secure against
  21. people not wanting to read the encrypted message. (i.e. NOT secure)
  22.  
  23. Here is a small c-source that reads from standard input and writes the encrypted
  24. text to standard out. Note the cipher is symmetrical and the same routine will
  25. thus encipher and decipher a text
  26.  
  27. examples of usagege (UNIX)
  28.  
  29. %rot <infile >outfile
  30. %
  31.  
  32. The source should be easy to modify, so it will work under other modes of
  33. operation.
  34.  
  35. ----------------------------------------------------
  36. #include<stdio.h>
  37.  
  38. main()
  39. {
  40. char ch;
  41. int i;
  42.  
  43. while(1) {
  44.    ch=getchar();
  45.    if (ch==EOF) return(0);
  46.    if (islower(ch)) {
  47.       i=(int)ch;
  48.       i=i+13;
  49.       if (i>122) i=i-26;
  50.       ch=(char)i;
  51.       }
  52.    if (isupper(ch)) {
  53.       ch=ch+13;
  54.       if (ch>'Z') ch=ch-26;
  55.       }
  56.    putchar(ch);
  57.    }
  58. }
  59. ---------------------------------------------------
  60.  
  61. ><>
  62.