Why forensics preserves evidence in Cybersecurity - Performance Analysis
When digital forensics preserves evidence, it must carefully handle data to keep it unchanged.
We want to understand how the effort to preserve evidence grows as the amount of data increases.
Analyze the time complexity of the following forensic evidence preservation steps.
// Pseudocode for preserving digital evidence
function preserveEvidence(dataSet) {
for (file of dataSet) {
createHash(file) // Calculate hash to verify integrity
copyFileToSecureStorage(file) // Make exact copy
}
verifyAllHashes(dataSet) // Check all hashes match originals
}
This code copies each file, creates a hash to ensure it is unchanged, and then verifies all hashes.
Look for repeated actions that take most time.
- Primary operation: Loop over each file to hash and copy it.
- How many times: Once for every file in the data set.
As the number of files grows, the work grows too.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | About 10 hash and copy actions |
| 100 | About 100 hash and copy actions |
| 1000 | About 1000 hash and copy actions |
Pattern observation: The effort grows directly with the number of files.
Time Complexity: O(n)
This means the time to preserve evidence grows in a straight line as more files are handled.
[X] Wrong: "Preserving evidence takes the same time no matter how many files there are."
[OK] Correct: Each file must be copied and checked, so more files mean more work and more time.
Understanding how evidence preservation scales helps you explain careful handling of data in real investigations.
"What if we added a step that compares every file to every other file? How would the time complexity change?"