---
title: Custom password calculation
related:
  - https://docs.kentico.com/k12sp/custom-development/customizing-providers/registering-providers-using-assembly-attributes.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

If you want to calculate user passwords in your own way, follow this procedure. You can find more information in [Customizing providers](https://docs.kentico.com/k12sp/custom-development/customizing-providers.md).

1. Open your Kentico solution in Visual Studio.
2. Create a new _Class Library_ project in the Kentico solution  (or reuse an existing custom project).
3. Add references to the required Kentico libraries (DLLs) for the new project.
4. Reference the custom project from the Kentico web project _(CMSApp_ or _CMS)_.
5. Edit the project's **AssemblyInfo.cs** file (in the _Properties_ folder).
6. Add the **AssemblyDiscoverable** assembly attribute:

   ```csharp

   using CMS;

   [assembly:AssemblyDiscoverable]

   ```
7. Create a new class within the custom project.
8. Set the class to inherit from the **UserInfoProvider** class.
9. Override the **GetPasswordHashInternal** method.
10. Add the **RegisterCustomProvider** assembly attribute above the class declaration to register the provider.

    ```csharp

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;

    using CMS;
    using CMS.Helpers;
    using CMS.Membership;

    // Registers the custom provider
    [assembly: RegisterCustomProvider(typeof(MyUserInfoProvider))]

    /// <summary>
    /// Customized UserInfoProvider for password calculation.
    /// </summary>
    public class MyUserInfoProvider : UserInfoProvider
    {
        protected override string GetPasswordHashInternal(string password, string passwordFormat, string salt)
        {
            return SecurityHelper.GetSHA1Hash(password + "CustomSalt");
        }
    }

    ```
11. If you are utilizing the [MVC development model](https://docs.kentico.com/k12sp/developing-websites/mvc-development-overview.md), also deploy the custom project to your separate MVC application.

The system now uses the customized provider (MyUserInfoProvider) instead of the default one.
