home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.wanted
- Path: sparky!uunet!spsgate!mogate!newsgate!chdasic.sps.mot.com!dichter
- From: dichter@chdasic.sps.mot.com (Carl Dichter)
- Subject: Re: ROT13 Encryption
- Message-ID: <1992Sep9.175552.18632@newsgate.sps.mot.com>
- Sender: usenet@newsgate.sps.mot.com
- Nntp-Posting-Host: 223.197.55.10
- Organization: SPS
- References: <139@rd821.UUCP>
- Date: Wed, 9 Sep 1992 17:55:52 GMT
- Lines: 42
-
- In article <139@rd821.UUCP>, a036450@rd821.UUCP (Bob Goldrich) writes:
- |> Could someone give me the basics on ROT13 encryption. Is there
- |> source code available anywhere? If so, where?
- |> -Bob Goldrich a036450@rd821.gleason.com
-
- ROT13 is a very basic encryption (as someone points out in another post)
- and I don't recommend it for anything important. But, if you still want it,
- here's a little c program I wrote as a pipe:
- --------------- rot13.c -----------------------
- #include <ctype.h>
- main()
- {
- char buf[256+1], c;
- int i, was_lower = 0;
-
- while(gets(buf)) {
- for(i=0; buf[i]; i++) {
- c = buf[i];
- if(isalpha(c)) {
- if(islower(c)) {
- c = toupper(c);
- was_lower++;
- }
- else
- was_lower = 0;
- c -= 13;
- if(c < 'A') {
- c += 26;
- }
- if( was_lower && isupper(c))
- c = tolower(c);
- }
- putchar(c);
- }
- putchar('\n');
- }
- }
-
- ----------------------
- Carl R. Dichter "iwannanugui"
- Motorola ASIC Division
- email: dichter@chdasic.sps.mot.com
-