Search for all files that have a specific string in an extended attribute?

I’m trying to write a script that will find all files in a folder (or multiple folders) that have the extended attribute com.apple.FinderInfo and where the content of that extended attribute is a specified string (the hex string returned from xattr -l -x filename).

The point of the script is that it will remove the extended attribute com.apple.FinderInfo if that attribute contains the hex string I’m looking for.

I see that the find command can return all files that have the extended attribute com.apple.FinderInfo, but I can’t find any simple method to find files in which that extended attribute has specific content. The only thing I can think of is to use the xattr command and grep the output for the string I’m looking for, but that would take an enormous amount of time when scanning an entire user folder.

Am I missing some obvious alternative?