What are the top two algorithms for encrypting passwords securely?

Planning to enhance password security by storing passwords with 2 different hashes. The goal is to minimize collisions and boost overall security level. First question: Is this strategy worth the effort given that collisions are already quite rare? Second question: Which combination of hashing algorithms would work best for this purpose? Would using sha-1 and sha-256 result in more collisions compared to a mix of sha-256 and another unrelated algorithm like blowfish?

Answer №1

So let me make sure I got this right - you're looking to save the hashed password twice using two distinct hashing algorithms in your database, is that correct? To achieve this, all you need to do is utilize two hash algorithms that generate varying lengths of output. This ensures there will be no possibility of collision between the two separate hashes.

For example, you could consider using sha1 and md5 which both offer differing lengths of output.

Answer №2

My suggestion is to go with sha1 and not stress about collisions. The probability of a sha1 collision is extremely low (10^-45), as discussed in this article Probability of SHA1 collisions. Unless you are expecting a massive number of users, collisions should not be a concern.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What could be the reason I received a warning in my PHP code?

Seeking assistance with a PHP script I have created. It is throwing an error and I am unable to pinpoint the mistake. Here are the warning messages I am encountering: Warning: mysql_query(): Access denied for user ''@'localhost' (usin ...

What is the best approach to refreshing a particular div with the contents of a view file?

I have a block of code in PHP/Symfony that looks like this: <div id='content'> <?php include_partial( 'course/content.php', array("param1" => "1", "param2" => "2") ); ?> </div> Now, I am interested in updatin ...

Convert a multi-dimensional array into a "flat" structure while preserving array keys and values

I have a complex array structure with X number of dimensions. Here is an example of the array: Array ( [system] => Array ( [step_x_y] => Array ( [0] => Schnitt %1 von %2 [1] => Trin %1 af ...

Tips for Eliminating the (") Character from a String

I am looking to eliminate the character ( " ) from a String. Although str_replace works perfectly for some strings, it is not working for the following string and displays a syntax error. $string = 'dfghhhhfgh 0201-228 8"X1" 'G&apo ...

The for loop stops executing once it has finished iterating through the script

I'm working on a PHP script that includes a for loop. The loop is supposed to run through the code once and then exit, but I've encountered an issue where it continues looping until I manually stop it. Here is my code: <?php session_start(); ...

Exploring the capabilities of JSONmodel by attempting to retrieve data from a server onto an iOS device

I've been working on integrating JSONmodel to retrieve data from my server to my iOS device. I have set up all the classes properly, but for some reason, it returns null after calling the URL. feed = [[Feeds alloc] initFromURLWithString:@"http://http ...

Secure shell access to Amazon EC2 using PHP

When I try to run a PHP script connecting from my local Ubuntu Linux machine to an EC2 instance using SSH, it executes fine when run from the terminal and writes the tailed entries in a file. However, when I try to run it from a browser, I encounter the fo ...

Retrieve validation errors in Laravel 5.4 and return them as JSON

Here is my AJAX request: $("#btnSave").click(function() { var Url = 'http://localhost/Projetos-Laravel/Sibcomweb/public/panel/client/save'; var Dados = $('#FormClient').serialize(); $.ajax({ type:'POST& ...

Use a PHP form to send an email with HTML formatting, rather than plain text

I am facing an issue with sending emails from a web form. The received email needs to be displayed as HTML and not text. function createMailBodyLine ( $title, $value ) { $value = nl2br(htmlspecialchars($value)); return "<tr> ...

Retrieve user information after logging into TWITTER

Hello, I am looking for a way to retrieve user details such as ID, Name, and Screen Name after the user has logged in to my application. Once the user enters their login details, I need to be able to fetch these details in real-time and store them in a da ...

Update user login status in database following a forced browser closure or expiration of session

I have a user login data in MySQL, where users are only allowed to login once per session. The logout button works fine, but if the user closes the browser // user_table in MySQL user_id user_username user_password is_login 1 ...

sending an array from one CodeIgniter view to another view via Ajax

In the following code segments of my application, myArray is an array where each element contains a few objects that I need to use in a second view. When I use alert(myJSON);, I am able to see the array in the alert window. However, when the view loads, i ...

Just made the switch to MAMP 3 and now my database files seem to have disappeared

After upgrading to MAMP 3, I seem to have lost all my database files. When I launch the servers and try to access my websites, it initiates a fresh WordPress install. Although I can see the database files in the directory, they are not loading in phpmyadmi ...

Converting jQuery ajax success response data into a PHP variable: A step-by-step guide

When sending data to a php page for processing using jQuery and ajax, I receive a response in the form of: success: function(data){ mydata = data; } The data retrieved is a URL represented as mydata = https://myurl.com. Now, I want to assign this data to ...

Syntax for ``if`` and ``elseif`` statements allows

Having some issues with the code above, most likely due to a beginner mistake. The if/elseif/if conditions seem to be working fine without content but are failing when test statements are added. Wondering if there might be a syntax subtlety that I am ove ...

There has been no change in Vue2 compatibility with Laravel 5.4

I'm currently experimenting with Vue within a Laravel project. However, I've encountered an issue where after modifying the example.vue file and adding it to the view, the changes are not reflected in the view. The code snippet below showcases th ...

Finding keywords in a string present within an array: A step-by-step guide

In my scenario, I am dealing with a string that has a maximum of 200 characters and an array containing 4000 elements. Each element in the array is unique and may consist of up to three words. The main objective is to extract all keywords from the string ...

Utilizing Laravel Eloquent to perform substring queries in SQL

Struggling with my SQL query in Laravel 8. I'm aiming to extract the first character from the column name, but only for distinct values. These characters will be linked to glossary definitions. $chars = DB::table('parts') ->di ...

Displaying product ratings in the review summary in Magento

I am in the process of revamping the review summary section on the product page to display a comprehensive list of reviews as well as an interactive form for adding new reviews. While the form is functioning properly, I'm encountering issues with the ...

Accessing a public variable from one class in PHP from another class

I've encountered an issue where I am attempting to access a public variable from one class in another class, but it returns as a blank array. The code snippet that I'm currently working on is as follows: Class One: class fruits { public $ID = ...