Search code examples
c#visual-studiomd5cryptsharp

Cryptsharp C# Visual Studio 2022 no definition


I've tried to run

string cryptedPassword = Crypter.MD5.Crypt(Passwort, new CrypterOptions()
         {
            {CrypterOption.Variant, MD5CrypterVariant.Apache}
         });

from the cryptsharp documentation

But I don't seem to be able to run it.

Passwort is a random 5 char string

I have this code:

using System; using CryptSharp;
using System.IO;
using System.Security.Cryptography;

but keep running into errors:

Crypter has no definition for MD5
MD5CrypterVariant not available

What am I missing ?

Thanks in advance


Solution

  • If you want to use MD5 crypt algorithms, we need to install the following NuGet packages. https://www.nuget.org/packages/CryptSharpOfficial/

    enter image description here

    Here is my code:

    enter image description here

    If there are still errors, you can try to reinstall the NuGet packages.