Work around some circular imports.

Move pulse hashing into PatternUtils as it's a helper.