7.2 Function

Many operators in programming are functions. For example, in C, *, /, + and - are typical functions. There are other functions in the math library, such as sin, cos and etc. All of these functions parallel the mathematical definition of functions.

However, a function as in ``a subroutine that has a return value'', is not necessarily a function. Whether a subroutine is truly a function depends the implementation.

The concept of mathematical functions, including injection, surjection and bijection, is important in many fields. For example, knowing that MD5 is not injective, we can deduce that more than one strings can generate the same MD5 hash. This, in return, is used to crack passwords by creating a dictionary of strings and MD5 hashes. If the hash value of a password is known, then it is, theoretically and now practically, possible to find a password string that generates the same hash value.

In the past, the MD5 hash values of passwords are not guarded based on the assumption that it is not reversible. Well, it is still not reversible algorithmically, but we can now look up a table of MD5 hash values, and find a ``congruent'' string that generates the same MD5 hash, which effectively cracks the protection offered by such passwords.

The fact that MD5 is surjective detered people from the lookup approach because there are so many possible hash values. However, With fast computers working as clusters, it is now feasible to generate and maintain a dictionary from MD5 hash values to equivalent strings.

Copyright © 2006-10-28 by Tak Auyeung