Dan Melomedman dan-erlang@REDACTED
Wed Feb 19 18:29:25 CET 2003

Matthias Lang wrote:
> Dan Melomedman writes:
>  > Hi. I need to bxor other datatypes than integers. What's the
>  > recommended way of doing something like this? Thanks.
> It depends on what you want to do and how fast you want to do it and
> how long you want to spend programming it. 

It doesn't need to be fast, and I don't want to spend too much time
programming just to be able to XOR. So I am hoping there's an easy way.

> A simple byte-wise approach to XOR-ing the binary Bin with a constant is:
>   list_to_binary( [X bxor 123 || X <- binary_to_list(Bin)] )

I think initially I'd like to be able to XOR two binaries. Or two lists.
What if the sizes of the two binaries differ? Will I need to pad one of
them to the size of the other? Thanks much.

More information about the erlang-questions mailing list