feat(hashlib): tune typedefs and const correctness

Provide digest_size and digest_type.

digest() and hexdigest() must not affect the state of the hasher.

Make hash objects equality comparable.