A less hacky test for buffer equality: compare lengths then go byte-by-byte.