Hash Task¶
Overview¶
The Hash Task generates cryptographic hash values from text using industry-standard algorithms (SHA-512, SHA-256, SHA-1, or MD5). Hashes are one-way functions that convert data into fixed-length strings, perfect for data integrity checks, cache keys, API signatures, and deduplication.
When to use this task:
- Generate unique identifiers from data
- Verify data integrity and detect tampering
- Create API signatures for authentication
- Generate cache keys from request parameters
- Deduplicate content by comparing hashes
- Create idempotency keys for APIs
- Generate consistent IDs from variable inputs
Key Features:
- Four hash algorithms (SHA-512, SHA-256, SHA-1, MD5)
- One-way cryptographic function
- Deterministic (same input = same hash)
- Fast computation
- Hexadecimal output
- Variable support
- Collision resistant (SHA-256+)
Quick Start¶
1. Add Hash task
2. Select algorithm (SHA-256 recommended)
3. Enter text to hash
4. Returns hexadecimal hash string
5. Save
Configuration¶
Hash Algorithm¶
SHA-512 (recommended for security)
SHA-256 (standard, widely used)
SHA-1 (legacy, not for security)
MD5 (checksums only, not secure)
Input Text¶
Input: Hello World
Input: {{task_55001_email}}{{task_55001_timestamp}}
Input: {{task_46001_request_body}}
Any text, including variables from previous tasks.
Output Fields¶
| Field | Description | Example |
|---|---|---|
task_33001_run | Success status | true |
task_33001_run_text | Result message | Successfully hashed. |
task_33001_hash | Generated hash (hex) | a591a6d40bf420404a011... |
Hash Algorithm Comparison¶
| Algorithm | Length | Use Case | Security |
|---|---|---|---|
| SHA-512 | 128 hex chars | Maximum security, sensitive data | ✓✓✓ Excellent |
| SHA-256 | 64 hex chars | Standard security, most common | ✓✓✓ Excellent |
| SHA-1 | 40 hex chars | Legacy systems only | ⚠️ Deprecated |
| MD5 | 32 hex chars | Checksums, non-security uses | ❌ Broken |
Recommendation: Use SHA-256 for most cases, SHA-512 for maximum security.
Real-World Examples¶
Example 1: API Request Idempotency Keys¶
Scenario: Prevent duplicate API requests by generating idempotency keys from request data
Workflow: 1. Webhook In - API request received 2. Merge Data - Combine key request fields 3. Hash - Generate idempotency key 4. MySQL Query - Check if key exists 5. If Task - Process or reject 6. Webhook Out - Send response
Merge Request Data:
Map:
customer_id: {{task_46001_customer_id}}
order_items: {{task_46001_items}}
total_amount: {{task_46001_total}}
timestamp_day: {{task_46001_date}}
Combined: {{task_46001_customer_id}}-{{task_46001_items}}-{{task_46001_total}}-{{task_46001_date}}
Generate Idempotency Key:
Check for Duplicate:
SELECT COUNT(*) as count, response_data
FROM api_requests
WHERE idempotency_key = '{{task_33001_hash}}'
AND created_at > DATE_SUB(NOW(), INTERVAL 24 HOUR)
Process or Return Cached:
Condition: {{task_43001_count}} = 0
True: Process new request
False: Return cached response from {{task_43001_response_data}}
Store Request:
INSERT INTO api_requests
(idempotency_key, customer_id, request_data, response_data, created_at)
VALUES ('{{task_33001_hash}}',
'{{task_46001_customer_id}}',
'{{task_46001_body}}',
'{{task_18001_response}}',
NOW())
Example 2: Content Deduplication System¶
Scenario: Detect duplicate content submissions using hash comparison
Workflow: 1. Form Submission - Content submission 2. Hash - Hash content body 3. MySQL Query - Search for matching hash 4. If Task - Check if duplicate 5. Email - Notify submitter 6. MySQL Query - Store or link to existing
Hash Content:
Algorithm: SHA-256
Input: {{task_55001_title}}{{task_55001_body}}{{task_55001_author}}
# Combine key fields that define uniqueness
Search for Duplicate:
SELECT content_id, title, author, created_at, url
FROM content_library
WHERE content_hash = '{{task_33001_hash}}'
LIMIT 1
Check Result:
Duplicate Email:
To: {{task_55001_email}}
Subject: Duplicate Content Detected
Hi {{task_55001_author}},
We found that this content already exists in our system:
Your Submission: "{{task_55001_title}}"
Matches Existing: "{{task_43001_title}}"
Created: {{task_43001_created_at}}
URL: {{task_43001_url}}
Content Hash: {{task_33001_hash}}
Please review or submit different content.
Store New Content:
INSERT INTO content_library
(title, body, author, content_hash, created_at)
VALUES ('{{task_55001_title}}',
'{{task_55001_body}}',
'{{task_55001_author}}',
'{{task_33001_hash}}',
NOW())
Example 3: Webhook Signature Verification¶
Scenario: Verify webhook authenticity using hash-based signatures
Workflow: 1. Webhook In - Webhook received 2. Merge Data - Combine payload + secret 3. Hash - Generate expected signature 4. If Task - Compare signatures 5. Process webhook or reject
Combine Payload with Secret:
Map:
payload: {{task_46001_body}}
secret: {{env_webhook_secret}}
Combined: {{task_46001_body}}{{env_webhook_secret}}
Generate Expected Signature:
Compare Signatures:
Condition: {{task_33001_hash}} = {{task_46001_signature_header}}
True: Valid webhook, process
False: Invalid signature, reject
Reject Invalid:
Return 401 Unauthorized
Body:
{
"error": "Invalid signature",
"expected": "{{task_33001_hash}}",
"received": "{{task_46001_signature_header}}"
}
Process Valid Webhook:
Webhook authenticated successfully.
Expected: {{task_33001_hash}}
Received: {{task_46001_signature_header}}
Status: MATCH ✓
Proceed with webhook processing...
Example 4: Intelligent Cache Key Generation¶
Scenario: Generate consistent cache keys from API request parameters
Workflow: 1. Webhook In - API request 2. Merge Data - Normalize parameters 3. Hash - Generate cache key 4. MySQL Query - Check cache 5. If Task - Return cached or compute 6. MySQL Query - Store result
Normalize Parameters:
Map:
endpoint: {{task_46001_endpoint}}
method: {{task_46001_method}}
user_id: {{task_46001_user_id}}
params_sorted: {{task_46001_query_params_sorted}}
# Sort parameters to ensure same order
Combined: {{endpoint}}-{{method}}-{{user_id}}-{{params_sorted}}
Generate Cache Key:
Check Cache:
SELECT response_data, expires_at
FROM api_cache
WHERE cache_key = '{{task_33001_hash}}'
AND expires_at > NOW()
LIMIT 1
Return Cached or Compute:
Condition: {{task_43001_row_count}} > 0
True: Return {{task_43001_response_data}}
False: Compute and cache
Store in Cache:
INSERT INTO api_cache
(cache_key, response_data, expires_at, created_at)
VALUES ('{{task_33001_hash}}',
'{{task_18001_response}}',
DATE_ADD(NOW(), INTERVAL 1 HOUR),
NOW())
ON DUPLICATE KEY UPDATE
response_data = '{{task_18001_response}}',
expires_at = DATE_ADD(NOW(), INTERVAL 1 HOUR)
Example 5: File Integrity Verification¶
Scenario: Verify downloaded file hasn't been tampered with
Workflow: 1. Webhook In - Download notification 2. Files - Download file 3. Hash - Hash file content 4. If Task - Compare with expected hash 5. Email - Alert on mismatch 6. MySQL Query - Log verification
Hash Downloaded File:
Compare Hashes:
Condition: {{task_33001_hash}} = {{task_46001_expected_hash}}
True: File integrity verified ✓
False: FILE TAMPERED - SECURITY ALERT!
Security Alert (Mismatch):
To: security@company.com
Subject: 🚨 FILE INTEGRITY CHECK FAILED
SECURITY ALERT - Potential File Tampering Detected
File: {{task_46001_filename}}
Source: {{task_46001_source_url}}
Downloaded: {{current_timestamp}}
Expected Hash (SHA-256): {{task_46001_expected_hash}}
Actual Hash (SHA-256): {{task_33001_hash}}
STATUS: HASHES DO NOT MATCH
This file may have been tampered with or corrupted.
DO NOT USE this file until verified.
[View Details] [Quarantine File]
Log Verification:
INSERT INTO file_integrity_log
(filename, source_url, expected_hash, actual_hash, match_status, verified_at)
VALUES ('{{task_46001_filename}}',
'{{task_46001_source_url}}',
'{{task_46001_expected_hash}}',
'{{task_33001_hash}}',
{{task_33001_hash == task_46001_expected_hash}},
NOW())
Success Notification:
File integrity verified successfully.
File: {{task_46001_filename}}
Hash: {{task_33001_hash}}
Status: ✓ VERIFIED
File is safe to use.
Best Practices¶
Algorithm Selection¶
- SHA-256 - Default choice for most use cases
- SHA-512 - When maximum security required
- SHA-1 - Only for legacy system compatibility
- MD5 - Only for non-security checksums
Security Considerations¶
✓ DO use for:
- Data integrity verification
- Idempotency keys
- Cache keys
- Content deduplication
- API signatures (with secret)
❌ DON'T use for:
- Direct password storage (use bcrypt/argon2)
- Encryption (hash is one-way)
- Sensitive data exposure (hash is deterministic)
Input Preparation¶
- Normalize data - Remove whitespace, consistent formatting
- Sort parameters - Ensure consistent order
- Include context - Add secrets for signatures
- Document format - Specify what's being hashed
Collision Handling¶
- SHA-256/512: Virtually impossible to find collisions
- SHA-1: Known collision attacks exist
- MD5: Collisions easily generated
- Always use SHA-256+ for security-sensitive applications
Troubleshooting¶
Different Hash Each Time¶
Issue: Same input produces different hashes
Causes: - Input includes timestamp or random data - Variable not properly resolved - Extra whitespace or formatting
Solution:
# Include only stable data
Wrong: {{task_46001_data}}{{current_timestamp}}
Right: {{task_46001_data}}
# Debug input
Code Task: return {input_debug: input.task_46001_data};
Hash Comparison Fails¶
Issue: Hashes don't match when they should
Causes: - Case sensitivity in input - Extra whitespace - Different encoding - Variable order changed
Solution:
# Normalize before hashing
Formatter: LOWERCASE {{input}}
Find Replace: Remove extra spaces
# Use same input format
Document expected format clearly
Security Concerns¶
Issue: Need to hash passwords
Solution:
❌ Don't use Hash task for passwords
✓ Use proper password hashing:
- bcrypt
- argon2
- PBKDF2 with salt
Hash task is for data integrity, not password storage.
Frequently Asked Questions¶
Can I reverse a hash?¶
No, hashes are one-way functions. Cannot retrieve original input from hash.
Are hashes unique?¶
Practically yes for SHA-256/512. Collisions are mathematically possible but virtually impossible to find.
Can I use this for passwords?¶
No, use dedicated password hashing libraries (bcrypt, argon2) that include salting and key stretching.
What's the difference between SHA-256 and SHA-512?¶
SHA-512 is more secure (longer hash) but slower. SHA-256 is industry standard and sufficient for most uses.
Can I hash files?¶
Yes, provide file content as input. For large files, consider using Code task with streaming hashing.
Is MD5 secure?¶
No, MD5 is cryptographically broken. Use only for non-security checksums. Never for passwords or integrity verification.
Do I need a secret key?¶
Not for basic hashing. For API signatures (HMAC), combine data with secret before hashing.
Related Tasks¶
- Variable - Store hash for later comparison
- If Task - Compare hashes to verify integrity
- Merge Data - Combine data before hashing
- Code Task - Complex hashing logic or HMAC
- MySQL Query - Store and lookup hashes
- Webhook Out - Include hash in API requests