Moved DigestManager to upper level.

Added appropriate tests.