# Hashing and Validation

suggest changeMore information needed.

A cryptographic hash function is a member of a class of functions with three vital properties; consistency, uniqueness, and irreversibility.

**Consistency:** Given the same data, a hash function will always return the same value. That is, if X = Y, f(x) will always equal f(y) for hash function f.

**Uniqueness:** No two inputs to a hash function will ever result in the same output. That is, if X != Y, f(x) != f(y), for any values of X and Y.

**Irreversibility:** It is impractically difficult, if not impossible, to “reverse” a hash function. That is, given only f(X), there should be no way of finding the original X short of putting every possible value of X through the function f (brute-force). There should be no function f1 such that f1(f(X)) = X.

Many functions lack at least one of these attributes. For example, MD5 and SHA1 are known to have collisions, i.e. two inputs that have the same output, so they lack uniqueness. Some functions that are currently believed to be secure are SHA-256 and SHA-512.