Hash Component Overview
📖 Introduction
cCryptoHash is a Windows CryptoAPI-based hash computation class that supports multiple hash algorithms including MD5, SHA1, SHA256, SHA384, and SHA512.
✨ Key Features
| Feature | Description |
|---|---|
| Multiple Algorithms | MD5, SHA1, SHA256, SHA384, SHA512 |
| Multiple Inputs | Supports strings, byte arrays, files |
| Multiple Outputs | Supports Hex strings, Base64, byte arrays |
| Chainable API | Fluent API design with method chaining |
| Auto CSP Selection | Automatically selects appropriate cryptographic service provider |
| Encoding Support | Supports UTF-8 and ANSI encoding |
🚀 Quick Start
Create Instance
vb
Dim Hash As New cCryptoHashSimple Hash Computation
vb
' Compute string hash (default SHA256)
Dim hashValue As String
hashValue = Hash.ComputeHash("Hello World")
Debug.Print hashValue ' 64-character hex stringChainable Call
vb
' Use chainable call
Dim result As String
result = Hash.Mode(HASH_ALG_SHA256) _
.DataString("Hello World") _
.ReturnHex()Compute File Hash
vb
' Compute file SHA256
Dim fileHash As String
fileHash = Hash.ComputeFileHash("C:\data.txt")📋 Supported Algorithms
| Algorithm | Enum Value | Output Length | Description |
|---|---|---|---|
| MD5 | HASH_ALG_MD5 | 128 bit (32 hex) | Not recommended for security |
| SHA1 | HASH_ALG_SHA1 | 160 bit (40 hex) | Being deprecated |
| SHA256 | HASH_ALG_SHA256 | 256 bit (64 hex) | Recommended |
| SHA384 | HASH_ALG_SHA384 | 384 bit (96 hex) | High security |
| SHA512 | HASH_ALG_SHA512 | 512 bit (128 hex) | Highest security |
🔗 Related Documentation
- methods.md - Methods detailed reference
Last Updated: 2026-05-17