How can I check that password is correct if I add random salt?

How can I check that password is correct if I add random salt?

I'm trying to secure my c# app. I know that we MUST store password hash and salt in DB. So my question:&nbsp;<strong>How I can compare that password is correct if I use Random salt?</strong>&nbsp;(Random salt gives random values each time). I also have the code below

I'm trying to secure my c# app. I know that we MUST store password hash and salt in DB. So my question: How I can compare that password is correct if I use Random salt? (Random salt gives random values each time). I also have the code below

 public static string HashPassword(string p, string s)
    {
        var combinedPassword = String.Concat(p, s);
        var sha256 = new SHA512Managed();
        var bytes = UTF8Encoding.UTF8.GetBytes(combinedPassword);
        var hash = sha256.ComputeHash(bytes);
        return Convert.ToBase64String(hash);
    }

public static String GetRandomSalt()
{
    var random = new RNGCryptoServiceProvider();
    var salt = new Byte[1024];
    random.GetBytes(salt);
    return Convert.ToBase64String(salt);
}

I am open to other suggestions in general.

c-sharp database

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

C. C++. C#. 차이점 알려드림. 5분 순삭. Explain C.C++.C#. Like I'm Five

C. C++. C#. 차이점 알려드림. 5분 순삭. Explain C.C++.C#. Like I'm Five. 아시죠? C는 C++.C# 줄인말이 아니라는거?

Learn how to perform CRUD operations using C Sharp

QuickStart: CRUD Operations in C Sharp. Learn how to perform CRUD operations using C Sharp for MongoDB databases.

Loops in C++ | For, While, and Do While Loops in C++

In this Video We are going to see how to use Loops in C++. We will see How to use For, While, and Do While Loops in C++.

Using isdigit() in C/C++

In this article, we'll take a look at using the isdigit() function in C/C++. This is a very simple way to check if any value is a digit or not. Let's look

C++ Tutorial for Beginners 19 - C++ Structures | Struct declaration | C++ Data Structures

Welcome to this course on C++ Tutorial for Beginners. In this video we will see How to use C++ Structures.