Hash@1
Node Hash@1
calculates cryptographic hash values from input data using various hash algorithms. It supports multiple hash algorithms including MD5 and SHA variants, and can process both string and Base64 encoded input data.
Adapter Prerequisites
- General availability: All adapters support this node type.
Node Configuration
For fields path
, targetPath
, targetValueWriteMode
, and targetValueKind
, see Overview.
transformations:
- type: Hash@1
path: $.users[*] # Path to objects containing data to hash
sourcePath: $.email # Path to value to hash
targetPath: $.emailHash # Path where hash value will be stored
algorithm: Sha256 # Hash algorithm to use
inputFormat: String # Input format: String or Base64
Parameters
Required Parameters
Parameter | Type | Description |
---|---|---|
path | string | JSONPath to objects containing the data to hash |
sourcePath | string | Relative path to the value within each object to hash |
targetPath | string | Relative path where the hash value will be stored |
algorithm | enum | Hash algorithm to use for calculation |
Optional Parameters
Parameter | Type | Default | Description |
---|---|---|---|
inputFormat | enum | String | Input format: String for UTF-8 text or Base64 |
Hash Algorithms
The node supports the following cryptographic hash algorithms:
Algorithm | Description | Hash Length | Output Example |
---|---|---|---|
Md5 | MD5 (128-bit hash) | 32 chars | 5d41402abc4b2a76b9719d911017c592 |
Sha1 | SHA-1 (160-bit hash) | 40 chars | aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d |
Sha256 | SHA-256 (256-bit hash) | 64 chars | e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
Sha384 | SHA-384 (384-bit hash) | 96 chars | 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274... |
Sha512 | SHA-512 (512-bit hash) | 128 chars | cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47... |
Input Formats
String Format
- Input is treated as UTF-8 encoded text
- Default format for most use cases
- Handles all Unicode characters properly
Base64 Format
- Input is treated as Base64 encoded data
- Base64 string is decoded to bytes before hashing
- Useful for hashing binary data stored as Base64
Hash Output
- Format: Lowercase hexadecimal string
- Character Set:
0-9
anda-f
- Consistency: Same input always produces the same hash
- No Collision Handling: Different inputs may theoretically produce same hash (very rare)
Examples
Example 1: Hash Email Addresses
Create SHA256 hashes of user email addresses:
transformations:
- type: Hash@1
path: $.users[*]
sourcePath: $.email
targetPath: $.emailHash
algorithm: Sha256
inputFormat: String
Input:
{
"users": [
{ "id": 1, "email": "john@example.com" },
{ "id": 2, "email": "jane@company.org" },
{ "id": 3, "email": "bob@test.net" }
]
}
Output:
{
"users": [
{ "id": 1, "email": "john@example.com", "emailHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" },
{ "id": 2, "email": "jane@company.org", "emailHash": "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3" },
{ "id": 3, "email": "bob@test.net", "emailHash": "e258d248fda94c63753607f7c4494ee0fcbe92f1a76bfdac795c9d84101eb317" }
]
}
Example 2: Hash Passwords with Different Algorithms
Hash passwords using different algorithms for comparison:
transformations:
- type: Hash@1
path: $.credentials[*]
sourcePath: $.password
targetPath: $.md5Hash
algorithm: Md5
inputFormat: String
- type: Hash@1
path: $.credentials[*]
sourcePath: $.password
targetPath: $.sha256Hash
algorithm: Sha256
inputFormat: String
Input:
{
"credentials": [
{ "username": "admin", "password": "secretPassword123" },
{ "username": "user", "password": "myPassword456" }
]
}
Output:
{
"credentials": [
{
"username": "admin",
"password": "secretPassword123",
"md5Hash": "e99a18c428cb38d5f260853678922e03",
"sha256Hash": "2c70e12b7a0646f92279f427c7b38e7334d8e5389cff167a1dc30e73f826b683"
},
{
"username": "user",
"password": "myPassword456",
"md5Hash": "d8578edf8458ce06fbc5bb76a58c5ca4",
"sha256Hash": "b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb9"
}
]
}
Example 3: Hash Base64 Encoded Data
Hash content that is stored as Base64:
transformations:
- type: Hash@1
path: $.files[*]
sourcePath: $.base64Content
targetPath: $.contentHash
algorithm: Sha256
inputFormat: Base64
Input:
{
"files": [
{ "name": "document.txt", "base64Content": "SGVsbG8gV29ybGQh" },
{ "name": "data.bin", "base64Content": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==" }
]
}
Output:
{
"files": [
{ "name": "document.txt", "base64Content": "SGVsbG8gV29ybGQh", "contentHash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e" },
{ "name": "data.bin", "base64Content": "iVBORw0KGgo...", "contentHash": "a3a5e715f0cc574a73c3f9bebb6bc58b32a30682ab1c3cb52cad8b4b969dfa69" }
]
}
Example 4: Create Unique Identifiers
Generate unique IDs by hashing combined data:
transformations:
- type: Hash@1
path: $.orders[*]
sourcePath: $.combinedKey
targetPath: $.uniqueId
algorithm: Sha1
inputFormat: String
Input:
{
"orders": [
{ "customer": "CUST001", "date": "2023-10-15", "combinedKey": "CUST001-2023-10-15-ORD001" },
{ "customer": "CUST002", "date": "2023-10-16", "combinedKey": "CUST002-2023-10-16-ORD002" }
]
}
Output:
{
"orders": [
{ "customer": "CUST001", "date": "2023-10-15", "combinedKey": "CUST001-2023-10-15-ORD001", "uniqueId": "1a79a4d60de6718e8e5b326e338ae533c8e55c5b" },
{ "customer": "CUST002", "date": "2023-10-16", "combinedKey": "CUST002-2023-10-16-ORD002", "uniqueId": "6dcd4ce23d88e2ee9568ba546c007c63d9131c1b" }
]
}
Example 5: Hash for Data Integrity
Create checksums for data integrity verification:
transformations:
- type: Hash@1
path: $.records[*]
sourcePath: $.data
targetPath: $.checksum
algorithm: Sha512
inputFormat: String
Input:
{
"records": [
{ "id": 1, "data": "Important data that needs integrity verification" },
{ "id": 2, "data": "Another critical piece of information" }
]
}
Output:
{
"records": [
{ "id": 1, "data": "Important data that needs integrity verification", "checksum": "a42c10e7023c0d955b49f6c729f6b7a4c1ca8b3d5a2b1c88d2e5f6b8c3d1f5e2..." },
{ "id": 2, "data": "Another critical piece of information", "checksum": "b83c45f9123d0e866c59f7d839f7c8b5d2db9c4e6b3c2d99e3f6g9c4e2f6g3..." }
]
}
Example 6: Hash for Cache Keys
Generate cache keys from request parameters:
transformations:
- type: Hash@1
path: $.requests[*]
sourcePath: $.cacheKey
targetPath: $.hashedCacheKey
algorithm: Sha256
inputFormat: String
Input:
{
"requests": [
{ "endpoint": "/api/users", "params": "page=1&limit=50", "cacheKey": "/api/users?page=1&limit=50" },
{ "endpoint": "/api/orders", "params": "status=active", "cacheKey": "/api/orders?status=active" }
]
}
Output:
{
"requests": [
{ "endpoint": "/api/users", "params": "page=1&limit=50", "cacheKey": "/api/users?page=1&limit=50", "hashedCacheKey": "3b7e72f5c8d9a1b4e6f8a2c5d7e9f1b3c4d6e8f0a1b3c5d7e9f1b3c5d7e9f1b3" },
{ "endpoint": "/api/orders", "params": "status=active", "cacheKey": "/api/orders?status=active", "hashedCacheKey": "7f9e82d5b3a1c4e6f8a0b2c4d6e8f1a3b5c7d9e1f3a5b7c9e1f3a5b7c9e1f3a5" }
]
}
Example 7: Multiple Hash Algorithms
Calculate multiple hashes for comparison or different purposes:
transformations:
- type: Hash@1
path: $.documents[*]
sourcePath: $.content
targetPath: $.quickHash
algorithm: Md5
inputFormat: String
- type: Hash@1
path: $.documents[*]
sourcePath: $.content
targetPath: $.secureHash
algorithm: Sha256
inputFormat: String
Input:
{
"documents": [
{ "title": "Report 1", "content": "This is the content of the first report" },
{ "title": "Report 2", "content": "This is the content of the second report" }
]
}
Output:
{
"documents": [
{
"title": "Report 1",
"content": "This is the content of the first report",
"quickHash": "8b1a9953c4611296a827abf8c47804d7",
"secureHash": "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2"
},
{
"title": "Report 2",
"content": "This is the content of the second report",
"quickHash": "3c59dc048e8850243be8079a5c74d079",
"secureHash": "b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78"
}
]
}
Use Cases
- Data Integrity: Create checksums to verify data hasn't been corrupted
- Unique Identifiers: Generate consistent unique IDs from data combinations
- Cache Keys: Create hash-based cache keys for efficient caching systems
- Password Storage: Hash passwords for secure storage (use strong algorithms)
- Duplicate Detection: Identify duplicate content by comparing hashes
- Digital Fingerprinting: Create content fingerprints for tracking and identification
- Security Operations: Support authentication and verification workflows
- Data Anonymization: Create anonymized identifiers while preserving uniqueness
Security Considerations
Algorithm Strength
- MD5: Cryptographically broken, avoid for security purposes
- SHA-1: Deprecated for cryptographic use, avoid for security
- SHA-256/384/512: Currently secure and recommended for cryptographic applications
Best Practices
- Use SHA-256 or higher for security-sensitive applications
- Salt passwords before hashing (add random data)
- Don't rely on hashing alone for data security
- Consider key derivation functions (PBKDF2, scrypt, Argon2) for password hashing
Data Privacy
- Hashing is not encryption - cannot retrieve original data
- Rainbow table attacks possible for common inputs
- Be cautious with sensitive data - consider additional protection
Error Handling
The node will throw errors when:
- The input data context is null
- Source values are null (strict null checking)
- Base64 decoding fails for invalid Base64 input
- JSONPath expressions are invalid
- Unsupported hash algorithm is specified
Behavior Notes
- Null Intolerance: Unlike other nodes, this node throws exceptions for null input values
- Consistent Output: Same input always produces the same hash value
- Case Sensitive: Input strings are case-sensitive for hash calculation
- UTF-8 Encoding: String inputs are converted to UTF-8 bytes before hashing
- Lowercase Output: Hash values are always returned in lowercase hexadecimal format
- Memory Efficient: Uses streaming hash calculation for large inputs
Performance Notes
- Algorithm Performance: MD5 fastest, SHA-512 slowest, SHA-256 good balance
- Input Size: Larger inputs take longer to hash
- Memory Usage: Hash calculation uses minimal memory regardless of input size
- CPU Intensive: Hash calculation is CPU-bound operation
Related Nodes
- Base64Encode@1: Encode data to Base64 before hashing
- Base64Decode@1: Decode Base64 data for verification
- TransformString@1: Manipulate strings before hashing
- SetPrimitiveValue@1: Set hash values in data structures