// This function is defined as follow : // Func (S, i) = HMAC(S || i) | HMAC2(S || i) | ... | HMAC(iterations) (S || i) // where i is the block number. private byte[] Func() { byte[] INT_block = Int(m_block); m_HMACSHA512.TransformBlock(m_salt, 0, m_salt.Length, m_salt, 0); m_HMACSHA512.TransformFinalBlock(INT_block, 0, INT_block.Length); byte[] temp = m_HMACSHA512.Hash; m_HMACSHA512.Initialize(); byte[] ret = temp; for (int i = 2; i <= m_iterations; i++) { temp = m_HMACSHA512.ComputeHash(temp); for (int j = 0; j < BlockSize; j++) { ret[j] ^= temp[j]; } } // increment the block count. m_block++; return(ret); }