Page 114 - Data Structures Handout_Neat
P. 114
9.6.2 Password Storage and Security
In security systems, passwords are not stored directly. Instead, they are hashed. When
a user enters a password, the system hashes it and compares it with the stored hash. This
prevents attackers from reading actual passwords if the database is compromised.
(Here we explain conceptually, since secure password hashing in C++ requires external
libraries like OpenSSL. For textbook purposes, we demonstrate a simple hash function for
illustration.)
9.6.3 Caching and Memory Management
Operating systems and web browsers use hashing to manage caches. For example, a
URL can be hashed to determine where its cached content should be stored. This allows quick
retrieval without scanning the entire cache.
Example: Simple Cache System in C++
114

