changed deprecated crypto usage and small optimization

changed deprecated crypto usage and also replaced binary_xor/2 with crypto:exor. crypto:exor is about six to seven times faster.