changed deprecated crypto usage and optimizes binary xor