Solved

Password Encryption

Posted on 1998-01-18
9
460 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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
 
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

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.

Question has a verified solution.

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

Suggested Solutions

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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 structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

810 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