Menu

#1 Couldnt get hashes of some algorithms

open
nobody
5
2006-07-29
2006-07-29
Anonymous
No

I couldnt get the hashes with the next algorithms:
BlowFish, DES, LanMan

With LanMan i also got a Null Reference Exception.

The others algorithms work nice.

This is my test code:

CryptServiceProvider test = (new
CryptServiceProvider()).GetCryptServiceProvider(Algorithm.HashType.LM);
Console.WriteLine(test.Encrypt("david"));

BTW: Excellent work!

Discussion

  • slipvayne

    slipvayne - 2006-07-29

    Logged In: YES
    user_id=1520034

    CryptoServiceProvider class was implemented using a factory
    method pattern so the the correct implementation of that is:

    CryptServiceProvier ea = new CryptServiceProvier();

    HashAlgorithm eaea = ea.GetCryptServiceProvier(Algorithm.LM);

    Console.WriteLine(ea.Encrypt("david"));

    eaea = ea.GetCryptServiceProvider(Algorithm.NTLM);

    Console.WriteLine(ea.Encrypt("david));

    Also, you should remember that some algorithms like Blowfish
    or DES need a proper salt. The next version include a
    Password and salt generator for this problem.

     
  • Kristopher Thomas

    Was having the same problem using the 3.0 code. Unlike the other algorithms, for lanman it needs to be (Algorithm.LM | Algorithm.NTLM)

    Example:

    CryptAPI.CryptServiceProvider csp = new CryptAPI.CryptServiceProvider();
    CryptAPI.HashAlgorithm lm = csp.GetCryptServiceProvider(CryptAPI.Algorithm.LM | CryptAPI.Algorithm.NTLM);
    Console.WriteLine(lm.Encrypt("david");

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.