Code Snippets

  

C# Source Code


Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 117,270 C# Programmers for FREE! Ask your question and get quick answers from experts. There are 1,817 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!




One way hash using CAPICOM

This is a snippet for applying a one way hash to a string using the CAPICOM.dll.

Submitted By: PsychoCoder
Actions:
Rating:
Views: 606

Language: C#

Last Modified: May 12, 2008
Instructions: Will need to add a reference to CAPICOM.dll
Pass the method your string and it will return the hashed version

Snippet


  1. /// <summary>
  2. /// method to hash the users password using CAPICOM.dll
  3. /// </summary>
  4. /// <returns></returns>
  5. public string HashStringCAMICOM(string str)
  6. {
  7.    
  8.     //create our SHA1 provider
  9.      CAPICOM.HashedData sha = new CAPICOM.HashedData();
  10.      sha.Algorithm = CAPICOM_HASH_ALGORITHM.CAPICOM_HASH_ALGORITHM_SHA1;
  11.     //hash the value
  12.      sha.Hash(str);
  13.     //return the hashed value
  14.      return sha.Value;
  15. }

Copy & Paste


Comments


There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month