Solved

decoder encoder

Posted on 1998-02-12
9
361 Views
Last Modified: 2012-05-04
encoder decorer in C language
0
Comment
Question by:latino
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 3

Expert Comment

by:q2guo
ID: 1257223
What's you question?
0
 
LVL 1

Expert Comment

by:jasonf
ID: 1257224
Do you mean you want to emulate a TTL 2 to 4 line decoder/encoder, for example, in software?  If so, how many lines (eg. 2 to 4, 3 to 8, etc.) and do you want to have an enable signal (like a TTL part)?
0
 
LVL 2

Accepted Solution

by:
Ready4Dis earned 50 total points
ID: 1257225
Here is an encrypter/decrypter...
#include <conio.h>
#include <stdio.h>
#include <string.h>

main (int arg, char *argv[])
{
      int does,add,times;
      char temp,key,*did;
      FILE *in,*out;
      if (arg<4) {
            printf("Use: Crypt -E/-D Infile Outfile\n");
            printf("-E   Encrypt/-D   Decrypt");
            return -1;
      }
      if (!strcmpi(argv[1],"-E")) does=1;
      if (!strcmpi(argv[1],"-D")) does=2;
      printf("What is the four key password: ");
      times=0;
      while (times<2) {
            key=getche();
            times++;
            add+=key;
      }
      times=0;
      while (times<2) {
            key=getche();
            times++;
            add-=key;
      }
      if (does==2) add=-add;
      times=0;
      clrscr();
      in=fopen(argv[2],"rb");
      out=fopen(argv[3],"wb");
      if (does==2) printf("File: ");
      while (!feof(in)){
            temp=fgetc(in);
            times++;
            if (feof(in)) {
            if (does==2) did="Decrypting";
            else did="Encrypting";
            printf("\n");
            printf("Done %s %s\n",did,argv[2]);
            printf("Size: %d -Bytes",times-1);
            return 0;
            }
            temp+=add;
            fputc(temp,out);
            if (does==2) printf("%c",temp);
      }
      return 0;
}
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:latino
ID: 1257226
Still evaluating your answer ready thanks
0
 
LVL 84

Expert Comment

by:ozo
ID: 1257227
You should know that it's pretty easy to crack that encryption.
0
 
LVL 2

Expert Comment

by:Ready4Dis
ID: 1257228
Yes, it's easy, but it is just s simple example for him to learn from, not the source to a government agency's encryption program.
0
 
LVL 2

Expert Comment

by:Ready4Dis
ID: 1257229
Yes, it's easy, but it is just s simple example for him to learn from, not the source to a government agency's encryption program.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1257230
Nothing wrong with that, as long as you understand it.
0
 

Author Comment

by:latino
ID: 1257231
thks all!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question