Anti spam using a comment hash (2 posts)

This is strictly a proof of concept bit of code. When you attempt to post a comment, a check is made to see if the same comment already exists by calculating the hash of the comment body. This will catch comment flooding by spammers, as well as the accidental hitting of "say it" twice in a row. It will also prevent the "me too" comment. The reason the code is proof-of-concept is because its overhead can be a bit high. It calculates the hash of every single comment each and every time a new comment is posted. A better way of handling this is to compute the hash at posting time and store it in the "comments" table. Place these two lines in wp-comment-post.php just after the block of code for "simple flood protection":