---
title: Custom password calculation
related:
  - https://docs.kentico.com/13/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).

This page describes how to hash or encrypt user passwords in your own way. You can find more information in [Customizing providers](https://docs.kentico.com/13/custom-development/customizing-providers.md).

1. Open your solution in Visual Studio.
2. [Add a custom assembly](https://docs.kentico.com/13/custom-development/adding-custom-assemblies.md) (_Class Library_ project) with class discovery enabled to the solution (or reuse an existing custom assembly).
3. Reference the custom project from the Xperience administration project _(CMSApp_).
4. Create a new class within the custom project.
5. Set the class to inherit from the **UserInfoProvider** class.
6. Override the **GetPasswordHashInternal** method.
7. 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");
       }
   }

   ```
8. Deploy the custom project to your separate live site (MVC) application.

The system now uses the customized provider (MyUserInfoProvider) instead of the default one, and calls your override of the _GetPasswordHashInternal_ method.
