refactored ETag middleware to generate digest using #each