Learn how to a build a cloud-first strategyRegister Now

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

Password Encryption


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

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.


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

singhtajAuthor Commented:
Crack looks like very complicated.

Is there anything simpler out there...

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.

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

#include <crypt.h>
#include <stdio.h>
char s64[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
  char key[10];
  char salt[3];
  char pass[14];
  printf("enter password: ");

  while( 1 ){
   printf("enter guess: ");
   if( strcmp(pass,crypt(key,pass)) == 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