module Cryptools::BitOperations

Public Instance Methods

xor_bytes(bytes1, bytes2) click to toggle source
# File lib/cryptools.rb, line 46
def xor_bytes(bytes1, bytes2)
  raise CryptoolsError, 'inputs are not the same length.' if bytes1.length != bytes2.length 

  bytes1.zip(bytes2).map{|(a, b)| a ^ b}
end