Comparing two bytes [] for equality in Scala (checking binary image data)
I want to compare two (small) Byte[]
that contain a binary image representation. I don't want to use MD5 or SHA or whatever, because it doesn't make sense ... they just iterate over the array, calculate the checksum, etc. and there is no need.
There seems to be a super-easy way to iterate through two arrays a1
and a2
and compare them for equality, e.g .:
(a1, a2).forall(a, b => a == b)
But that doesn't work of course ...
+3
source to share