Module: Cryptools::BitOperations

Defined in:
lib/cryptools.rb

Class Method Summary collapse

Class Method Details

.xor_bytes(bytes1, bytes2) ⇒ Object

Raises:



46
47
48
49
50
# 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