Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 471
  • Last Modified:

Password Encryption

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
singhtaj
Asked:
singhtaj
1 Solution
 
e4monschCommented:
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
 
e4monschCommented:
By the way: Crack 5.0 is available in Source code. So you can look into how it's done.
0
 
singhtajAuthor Commented:
Are you sure its under shareware.com, because I am unable
to find it.
Can you give me the exact site please.
Thanks

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
e4monschCommented:
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
 
singhtajAuthor Commented:
Crack looks like very complicated.

Is there anything simpler out there...


0
 
staggartCommented:
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
 
matth012098Commented:
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
 
ozoCommented:
#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

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now