Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
SHA-1 Hash Byte Array to String
C# code showing how to SHA-1 hash a byte array and return the result as an encoded string. // Create an instance of the Chilkat encryption class. Chilkat.Crypt2 crypt = new Chilkat.Crypt2(); // Any code begins the 30-day trial. crypt.UnlockComponent("30-day-trial"); // Set the hashing algorithm crypt.HashAlgorithm = "sha-1"; // Indicate that we want Base-64 output. crypt.EncodingMode = "base64"; // Generate some data to be hashed. byte[] inputByteData = new byte[10]; int i; for (i=0; i<10; i++) inputByteData[i] = (byte)(i); string hashStr = crypt.HashBytesENC(inputByteData); MessageBox.Show(hashStr); // Return the hash as a hexidecimalized string. crypt.EncodingMode = "hex"; hashStr = crypt.HashBytesENC(inputByteData); MessageBox.Show(hashStr); // Return the hash as a URL-Encoded string. crypt.EncodingMode = "url"; hashStr = crypt.HashBytesENC(inputByteData); MessageBox.Show(hashStr); Important: The download for this
example does not contain the ChilkatDotNet.dll which |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.