Added digest function