Results for “hash”
Small, practical examples. Search by task or narrow things down below.
Use a hash map for direct key lookup
C++: unordered_map provides key lookup without promising iteration order.
C++✓ Tested
Add a calculated property during selection
PowerShell: A calculated property can derive a value while retaining selected original properties.
PowerShell✓ Tested
Calculate a file’s SHA-256 digest
PowerShell: Get-FileHash hashes bytes without requiring the caller to load the whole file.
PowerShell✓ Tested
Construct a record with named properties
PowerShell: PSCustomObject gives downstream pipeline commands meaningful property names.
PowerShell✓ Tested
Find differences between two collections
PowerShell: Compare-Object marks reference-only values with a left arrow and difference-only values with a right arrow.
PowerShell✓ Tested
Merge configuration maps with override precedence
PowerShell: Copy defaults before applying override keys so the original remains unchanged.
PowerShell✓ Tested
Preserve key insertion order
PowerShell: An ordered dictionary enumerates keys in the order they were inserted.
PowerShell✓ Tested
Cache repeated pure function calls
Python: Use lru_cache to avoid recomputing results for identical hashable arguments.
Python✓ Tested
Calculate a SHA-256 checksum
Calculate a file checksum so you can compare it with a hash from a trusted source and detect changed contents.
checksum✓ Tested
Calculate a SHA-256 content digest
Java: Hash UTF-8 bytes and format the result as lowercase hexadecimal.
Java✓ Tested
Extract a basename without an external process
Bash Scripts: Double hash removes the longest matching prefix ending in a slash.
Bash Scripts✓ Tested
Invert a dictionary with unique values
Python: Swap keys and values when the values are hashable and unique.
Python✓ Tested