Solved

decoder encoder

Posted on 1998-02-12
9
341 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 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
 

Author Comment

by:latino
ID: 1257226
Still evaluating your answer ready thanks
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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…
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.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now