Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

decoder encoder

Posted on 1998-02-12
9
Medium Priority
?
370 Views
Last Modified: 2012-05-04
encoder decorer in C language
0
Comment
Question by:latino
  • 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 150 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

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

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 85

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

972 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