Solved

Password Encryption

Posted on 1998-01-18
9
459 Views
Last Modified: 2008-03-03
Hi,

    Can anyone help me as to how to use the unix "crypt"
command in my password ????

    All I want to do is encrypt a password and then
decrypt it whenever necessary. Does anyone know what I
can use for this simple routine. Is there anything Simple
available on the web ???

   I will appreciate any help.

Thank You
0
Comment
Question by:singhtaj
9 Comments
 
LVL 2

Expert Comment

by:e4monsch
ID: 1257009
There is a program available called Crack 4.0 (or 5.0) for Unix. This program allows you to crack passwords. It is very good and is used by system adminstrators worldwide for verifying Unix security. You can find it on http://www.shareware.com in the section Unix Most Popular.

By the way. Unix passwords cannot be decrypted due to a trap-door algorithm during encryption. Unix test passwords in the crypted state: You enter the password, it gets encrypted and is then compared with the crypted password in the password file.

There for when you crack password you test a large set of passwords(dictionaries) by crypting and comparing it with the crypted entry in the passfile.

If you have further questions feel free to ask further questions.

Regards Ian
0
 
LVL 2

Expert Comment

by:e4monsch
ID: 1257010
By the way: Crack 5.0 is available in Source code. So you can look into how it's done.
0
 

Author Comment

by:singhtaj
ID: 1257011
Are you sure its under shareware.com, because I am unable
to find it.
Can you give me the exact site please.
Thanks

0
 
LVL 2

Expert Comment

by:e4monsch
ID: 1257012
http://search.shareware.com/code/engine/File?archive=linux&file=system%2fadmin%2fcrack_41%2etgz&size=401169

There is a new version available, but haven't found it on shareware.com

0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 2

Expert Comment

by:e4monsch
ID: 1257013
0
 

Author Comment

by:singhtaj
ID: 1257014
Crack looks like very complicated.

Is there anything simpler out there...


0
 

Expert Comment

by:staggart
ID: 1257015
I think I can help you, but I am unclear on what you are trying to do.  Do you want a program or a C function call to do the encryption?  Are you trying to encrypt a password, or a file with a given password?

As was mentioned in previous respoense to your question, you cannot decrypt passwords.  What you do is encrypt a password, then later, encrypt "test" passwords and see if they match the previously encrypted password - i.e., you never can see the original password in "clear" text - you can only test against the already encrypted one.

Email me at taggart@outdoingit.com if you want to try to clarify things more.

Scott  
0
 
LVL 3

Accepted Solution

by:
matth012098 earned 50 total points
ID: 1257016
I dont know how unix crypt works, but you can encrypt a password in many simple ways, I would do use something simple like

Suggestion 1

1. For each letter pick a random number between 1 and 7.
2. Rotate the bits of the character left or right by the random number
3. Store the random number then the character for each character

Then when you want to decrypt the password reverse the bitwise rotation for each character.

Its simple but effective.

Suggestion 2

1. Take the first character and mask the bottom 3 bits.
2. take the value between 0 and 7 and rotate the bits of the next character left/right by that value.

etc.. etc..

0
 
LVL 84

Expert Comment

by:ozo
ID: 1257017
#include <crypt.h>
#include <stdio.h>
char s64[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
main(){
  char key[10];
  char salt[3];
  char pass[14];
  srandom(time(0)+getpid());
  salt[0]=s64[random()&63];
  salt[1]=s64[random()&63];
  printf("enter password: ");
  fgets(key,9,stdin);
  strcpy(pass,crypt(key,salt));
  printf("crypt(%s,%s)=%s\n",key,salt,pass);

  while( 1 ){
   printf("enter guess: ");
   fgets(key,9,stdin);
   if( strcmp(pass,crypt(key,pass)) == 0 ){
     printf("Correct\n");
     exit(0);
   }else{
     printf("Wrong\n");
   }
  }
}

0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Estimate porting issues. 9 118
Trouble linking program with -lcrypt 3 141
how to understand recursion 12 218
How to programmatically differentiate between C and Java 10 188
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
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…
The goal of this video is to provide viewers with basic examples to understand recursion 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.

943 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

6 Experts available now in Live!

Get 1:1 Help Now