Persits Software, Inc. Web Site
Main Menu:  Home |  Tasks |  Object Reference |  Crypto 101 |  FAQ |  Download & Buy |  Clients |  Live Demo |  Contact
 Navigator:  Home |  Object Reference |  CryptoHash Object
CryptoMessage CryptoKey 
  CryptoHash Object
The CryptoHash object provides one-way hash functionality. You can use it to compute MD2, MD4, MD5 and SHA hash functions of files and text strings.

Properties Methods
Value
AddText
AddFile
AddBinary
DeriveKey
Sign
VerifySignature
Reset

  CryptoHash Properties

Value As CryptoBlob (Read-Only)

Returns a CryptoBlob object containing the result of a one-way hash function.

  CryptoHash Methods


Sub AddText ( Text As String )
Adds Text to the hash object. This function can be called multiple times before the result hash value is retrieved via the Value property.

Usage:

Hash.AddText "my text"

Related Task: Protect a Password Database with a One-way Hash Function.


Sub AddFile ( Path As String )
Adds the content of a file specified by Path to the hash object. This function can be called multiple times before the result hash value is retrieved via the Value property.

Usage:

Hash.AddFile "c:\myfile.txt"

Related Task: Implement a File Identification System using the Hash.


Sub AddBinary ( Blob As CryptoBlob )
Adds the content of a blob specified by Blob to the hash object. This function can be called multiple times before the result hash value is retrieved via the Value property.

Usage:

Hash.AddBinary blob


Function DeriveKey ( Optional Algorithm = RC2, Optional BitSize = 0 ) As CryptoKey
Derives a symmetric cryptographic key from the hash. Algorithm specifies the encryption algorithm for the key being generated. BitSize specifies the key size. For the description of these arguments, see the comments to CryptoContext's GenerateKey method.

Return Value: a CryptoKey object containing the newly generated key.

Usage:

Set Key = Hash.DeriveKey


Function Sign ( KeyExchange As Boolean ) As CryptoBlob
Generates a digital signature by encrypting the underlying hash value with a private key pertaining to the context used to create this hash object. If KeyExchange is True, the key-exchange key will be used. Otherwise, the singature key will be used.

Return Value: a CryptoBlob object containing signature blob.

Usage:

Set Blob = Hash.Sign( True )

Related Task: Create and Verify Digital Signatures.


Function VerifySignature ( Signature As CryptoBlob, Key As CryptoKey ) As Boolean
Verifies the specified Signature blob by decrypting it with the specified public Key and comparing the decrypted value with the underlying hash Return Value: True if the signature is verified, False otherwise.

Usage:

If Hash.VerifySignature( Blob, Key ) Then ...

Related Task: Create and Verify Digital Signatures.
Related KB article: AspEncrypt fails to verify signatures generated by other packages.


Sub Reset
Clears the CryptoHash object so that a new hash can be computed.

Usage:

Hash.Reset


CryptoKey  CryptoMessage

Search this Site
  This site is owned and maintained by Persits Software, Inc. Copyright © 2000. All Rights Reserved.