Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Digest-MD5 hash a string and encode the result as a URL-encoded string
This sample program demonstrates how to Digest-MD5 hash a string and encode the result as a URL-encoded string. // The Chilkat Encryption library is also available as an ActiveX component
// or .NET class with the identical set of methods and properties.
// Digest-MD5 hash to a URL-encode a string.
void CryptExample(void)
{
CkCrypt2 crypt;
// Any string passed to UnlockComponent automatically begins the 30-day trial.
crypt.UnlockComponent("30-day trial");
// Use the Digest-MD5 hash algorithm.
// Other hash algorithms: haval, md2, sha-1 (sha-256), sha-384,sha-512
crypt.put_HashAlgorithm("md5");
// Set the output string encoding to "URL"
// Other encoding modes: base64, hex, quoted-printable
crypt.put_EncodingMode("url");
CkString strHash;
crypt.HashStringENC("Hash this string",strHash);
printf("URL-encoded hash string: %s\n",strHash.getString());
// PRINTS:
// URL-encoded hash string: 7f0E%90%92%D7h%2C%2A%2Et%5Dt%AAk
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.