Given is a system, which does provide only implementations of fast hash algorithms (MD5, SHA1, SHA-256, SHA-512). There is no implementation of PBKDF2, bcrypt or scrypt available. The system does provide a generateDigest(algo, input) and generateMac(algo, salt, input) function. The system has also the ability to securely store a private key for the MAC-function. Due to some language restrictions, it is undesirable to implement one of the key derivation functions.

Despite its lack of an adequate key derivation function, the system should be used to generate hashes for given passwords and store them.

I wonder if it would be possible to do some simple key stretching by repeatedly calling generateMac() with the HMAC_SHA512 algorithm:

algo = 'HMAC_SHA512'

for (i = 0; i++; i < ROUNDS) {
input = generateMac(algo, salt, input)
}


From a naive point of view, this does look like a feasible solution to slow down attacks on the hashes. But i do lack the experience and knowledge, if it would be a right way of doing it cyptographically.

-
Replace system with a better system –  Jack Jan 29 at 0:28