Example class diagram

For the class diagram and the code example, let's imagine that we are writing a library that hashes passwords. In practice, storing passwords in plain text is something that should be avoided. This is what our library will help our users to do. There are many different hashing algorithms that can be used. Some are SHA-1, MD5, and SHA-256. We want to be able to support at least these and have the possibility to add new ones easily. There are different hashing strategies—you can hash multiple times, combine different hashes, add salt to the passwords, and so on. These strategies make our passwords harder to guess using rainbow tables, for example. For this example, we will show hashing with salt and simple hashing with ...

Get Scala Design Patterns - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.