Questions tagged [crypt]

crypt() is Unix C library function used for hashing passwords. It is also found in PHP, Perl, Python and various other languages.

crypt(3) is a Unix C library function used for hashing passwords. The crypt() function takes in a password and an optional salt string (chosen randomly if not supplied), and calculates a cryptographic message digest based on them. The digest includes the salt used to generate it, so that, when the user re-enters their password, the digest can be recalculated and compared with the previously stored value.

Despite its name, the crypt(3) function cannot actually be used to encrypt data; the transformation it implements is deliberately non-reversible, so that its output cannot be decrypted to recover the original password.

The "traditional" hashing algorithm used by the original Unix crypt(3) was based on a modified version of the DES block cipher, and only supported passwords of up to 8 characters, with 7 bits per character, and a two-character salt with 6 bits per character. This algorithm is nowadays considered insecure due to its limited keyspace and high speed, which allow an attacker using modern computers to test all possible passwords by brute force in a relatively short time. Nonetheless, most crypt(3) implementations still include it for the sake of backwards compatibility.

Most modern crypt(3) implementations include various alternative hashing algorithms, which typically support arbitrarily long passphrases, longer salts and adjustable iteration counts to deliberately slow down the digest calculation for key stretching. One well known example of such an algorithm is , which is based on the Blowfish cipher.

Functions similar in name and purpose to (and possibly implemented by) the Unix crypt(3) function are also found in several high-level languages, including PHP, Perl and Python.

The crypt(3) function should not be confused with the Unix command line utility crypt(1), which is an obsolete and insecure file encryption utility. For a modern replacement, see .

553 questions
1
vote
1 answer

How do I hash my password correctly using perl?

I have tried to hash my password with perl when adding a user using a script but when I try to switch to that user, it says the password is incorrect. Here is what I wrote: hidden=$(perl -e 'print crypt($pass, "salt"),"\n") useradd -m -p $hidden -d…
Anda
  • 670
  • 7
  • 7
1
vote
2 answers

Flutter: Application stucks while is encrypting

I have a problem encrypting and decrypting my video file and it encrypting video file. there is no any error. but it stucks while is encrypting and decrypting video files. I use asynchronous method. but it still stucks. my code…
FesaTR
  • 47
  • 6
1
vote
1 answer

What's the size of a HMACSHA2 hash in Crypt::PBKDF2 in Perl?

I want to store password hashes in a database. Hashes will be generated with my $PBKDF2 = Crypt::PBKDF2->new( hash_class => 'HMACSHA2', hash_args => { sha_size => 512, }, iterations => 10000, salt_len => 10, ); In the…
Skeeve
  • 7,188
  • 2
  • 16
  • 26
1
vote
0 answers

Is it possible to port or migrate tripcodes from one server to another?

Specifically, I'm looking to determine if tripcodes for users on 4chan could have been migrated to 8chan, and then to 8kun. My (limited) understanding of this mechanism is that each server creates its own unique hash table and therefore DES Crypt(3)…
Rodney G
  • 11
  • 2
1
vote
0 answers

How to extract the private key and Certificate from pfx?

I'm trying to read the private key and the certificate of a .PFX file. I need both to Sign a message using the MimeSign method of this Unit (https://github.com/cybexr/Delphi-unit-OpenSSL/blob/master/OpenSSLUtils.pas). I'm using this code procedure…
Diego_F
  • 131
  • 6
1
vote
2 answers

Destroying luks header on dm-crypt linux

I am trying to destroy the luks header on one of my logical volume data1, I am still able to read the file inside data1 after I delete the luks header. I suppose it should not be the case right? Can someone help me in understanding this case? lsblk…
James Sapam
  • 16,036
  • 12
  • 50
  • 73
1
vote
1 answer

crypt module not outputting a SHA512 hash as expected

I'm currently using the crypt module in Python to try and create a SHA512 hash in the following manner. When I run the following line of code from this SO post: >>> import crypt >>> crypt.crypt('password', '$6$' + 'salt1234') Instead of seeing the…
ptk
  • 6,835
  • 14
  • 45
  • 91
1
vote
1 answer

php async crypt

I'm looking for an asynchronous crypt algorithm to digitally sign a string with php and verify the signature by using a mobile app (mostly ios or android). What could be the most simple and effective way to do so? Can I trust RSA or it is slow and…
Luciano Mammino
  • 798
  • 8
  • 23
1
vote
3 answers

Java AES encryption issue

Every time the encryption values changed by using AES, let anyone investigate the below code and let me know the issue code: private static final String secretKeys = "58BA833E57A51CBF9BF8BAB696BF9" public static String encrypt() throws Exception { …
Prabu
  • 3,550
  • 9
  • 44
  • 85
1
vote
2 answers

C not allocating memory for new char array

I don't see how the following code works w.r.t. the char array cd2 being overwritten. I am trying to just allocate space for two strings and then to populate them with the results of the crypt function. I am not sure how big a part crypt plays here…
uh_big_mike_boi
  • 3,350
  • 4
  • 33
  • 64
1
vote
1 answer

How to send vector in cbc for decipher?

I'm expecting to cipher a string, from a client side (using aes-256-cbc and a secret password already known by both server & client). And then I'd like to decipher it (on the server side). I have code that does work just fine (functionally…
1
vote
2 answers

What is the difference between crypt in unistd.h and crypt.h?

Background crypt has two definitions, from the docs, One of them uses unistd.h #define _XOPEN_SOURCE /* See feature_test_macros(7) */ #include This is defined as #ifdef __USE_MISC extern char *crypt (const char *__key, const char…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
1
vote
2 answers

crypt module not found (python3.7)

I'm using python 3.7,the crypt module that used to be built-in python 2.x, now i can't seem to find it. I tried https://docs.python.org/3/library/crypt.html but it's source code uses _crypt which also i can't download any help is…
wishmaster
  • 1,437
  • 1
  • 10
  • 19
1
vote
0 answers

Password guesser, why isn't my password guess similar to the actual hashed password?

I've been working on a password guessing program, and now I've been trying to figure out how to make it guess a password that's hashed. My problem is that the output of my guessed password is nothing similar to the hashed password. I was wondering…
kveola92
  • 69
  • 4
1
vote
1 answer

How to make ldap evaluate clear text password vs DES stored password

I use openldap slapd 2.4.40 and postgresql9.2.23 as back-sql on CentoS 6.9 user and password for LDAP uid and userPassword are stored in postgresql by DES encoding. Original clear text is JacicFk5 DES encoded/encrypted text is IfjFxsltK/MPE which…
user1345414
  • 3,745
  • 9
  • 36
  • 56