Key Stretching
Key Stretching
Key stretching is sometimes referred to as There are several ways to perform key
"key strengthening", although the latter term stretching. A cryptographic hash function or
originally referred to another technique with a block cipher may be repeatedly applied in
significantly different security and a loop (see pseudo code below). In
performance properties applications where the key is used for a
cipher, the key schedule (key set-up) in the
Key stretching techniques generally work as cipher may be modified so that it takes one
follows. The initial key is fed into an second to perform.
algorithm that, running on a given speed of
processor, takes a known constant time to A related technique, salting, protects against
apply. The algorithm is constructed so that time-memory tradeoff attacks and is often
the delay introduced is acceptable to most used in conjunction with key stretching.
users, say one second on a typical personal
computer. The output is the enhanced key. Hash based key stretching
The enhanced key should be of sufficient
size to make it unfeasible to break by brute Simple key stretching method:
force (e.g. at least 128 bits). The overall
algorithm used should be secure in the sense key = hash(password)
that there should be no known way of taking for 1 to 65000 do
a shortcut that would make it possible to key = hash(key)
calculate the enhanced key in less time (less
processor work) than by using the key Even better method with a salt. ("+" denotes
stretching algorithm itself. the operation of concatenation):