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

MD5-based password algorithm in Python

I try to call API that specifically uses MD5 hash in one of the steps. In the documentation they specifically show example reference that generates MD5 in the following way $ openssl passwd -1 -salt stack overflow $1$stack$MVcBmQ3RlrBu5Xoj74NBA0 or…
Rostfrei
  • 454
  • 6
  • 12
1
vote
0 answers

How to decrypt a file at a time that has been encrypted in chunks (AES GCM)

for AES GCM encryption, I use the standard crypto/cipher package, the file arrives over the network in chunk of 5 megabytes, each chunk is encrypted with one key and one nonce. The encrypted chunk is added to the shared file. You need to be able to…
1
vote
0 answers

How do I use the crypt function in a where in a laravel query?

I need to use the crypt function in a query in laravel. It is a system of saving passwords, and the user and password are encrypted by Crypt::encrypt, I would like to know if it is possible to decrypt in a query to do the search per user too,…
1
vote
1 answer

The crypt module is not supported on Windows

from crypt import methods from distutils.log import debug from flask import Flask, render_template, request, url_for, redirect from flask_sqlalchemy import SQLAlchemy from datetime import datetime app =…
Punda
  • 31
  • 4
1
vote
1 answer

crypt(param_1,local_88) function in C Secure?

Security scan tool reported C's crypt(param_1,local_88) as dangerous function. Searching in google couldn't find any solid information on crypt except someone mentioned it uses DES which is 64 bit (not 3DES) encryption. Any input is appreciated.
Ray_R
  • 13
  • 2
1
vote
1 answer

Javascript implementation of sha256_crypt

I am looking to create/use a javascript implementation of passlib.hash.sha256_crypt where I can specify a salt and password and receive a hash that is in the $5${salt}${checksum} format. However all of the javascript implementations I have seen…
Bijan
  • 7,737
  • 18
  • 89
  • 149
1
vote
1 answer

ModuleNotFoundError: No module named '_crypt'

I'm trying to use Flask and started with first example, while running the below code from crypt import methods from flask import Flask app = Flask(__name__) @app.route('/', methods=['GET']) def hello_world(): return "Hello world" if…
user18848025
  • 39
  • 1
  • 7
1
vote
3 answers

Find salt in the blowfish encrypted hash

This is kind of very basic question. I have searched for help regarding this but couldn't find any concrete answer to it. Therefore i am asking it specifically here. The use case is, i want to find the weak password referring to the list of hashes…
Mrun
  • 71
  • 1
  • 1
  • 5
1
vote
0 answers

Wrong AES key length using Crypt::JWT

I'm attempting to generate a JWE with (5 parts) using Crypt::JWT. It's my first foray into perl. Following the example from the documentation: use Crypt::JWT qw(encode_jwt); my $claims = { iss => 'some issuer', cd => 'some cd' } my $jws_token…
user88659
  • 23
  • 3
1
vote
1 answer

How to use crypt_gensalt() in crypt.h

According to crypt.h: extern char *crypt_gensalt (const char *__prefix, unsigned long __count, const char *__rbytes, int __nrbytes) I understand that __prefix is encryption type (i.e. $2a$, $5$, $6$,...). My guess is…
vcth4nh
  • 49
  • 5
1
vote
2 answers

PHP Bcrypt hashing

I want to use Blowfish hashing to hash password. crypt() does not support it in PHP versions prior to 5.3 My PHP version is 5.2.14. How can I use Blowfish hashing? Can I use PEAR's Crypt_Blowfish instead?
chnet
  • 1,993
  • 9
  • 36
  • 51
1
vote
1 answer

PHP CRYPT_BLOWFISH install

I want to use crypt() CRYPT_BLOWFISH hashing. Since PHP version is 5.2.14, CRYPT_BLOWFISH is 0. So, I install CRYPT_BLOWFISH using the following command: pear install Crypt_Blowfish-1.1.0RC2 It shows Crypt_Blowfish-1.1.0RC2 is installed. However,…
chnet
  • 1,993
  • 9
  • 36
  • 51
1
vote
1 answer

Question about Crypt::OpenSSL::RSA->verify method

My question is about this: https://metacpan.org/pod/Crypt::OpenSSL::RSA If there described method verify() fails, I do error handling like this: my $rsa_pub = Crypt::OpenSSL::RSA->new_public_key($x509PubKey); logm("exception: my err msg...") unless…
Vilius Gaidelis
  • 430
  • 5
  • 14
1
vote
1 answer

Laravel encrypt password before storing on DB and decrypt it to use on email settings

I followed this tutorial to create dynamic email settings stored on db. https://kayike.medium.com/enable-unique-and-dynamic-smtp-mail-settings-for-each-user-laravel-48e320d381ec The only problem is that the password is not encrypted. I would like to…
Swim89
  • 290
  • 8
  • 28
1
vote
1 answer

Error calling Sage Pay API with ColdFusion

Using ColdFusion, we're trying to process a customer payment by submitted details to Sage Pay. We're getting errors 500 and 5080 no matter what we submit. Our submitted crypt differs from the received version in a strange way: The first 1450…
Gary Basso
  • 11
  • 1