Re: cypher tools preview, unsigned 32bits
- Posted by Davi Figueiredo <davitf at USA.NET> Apr 19, 1999
- 669 views
>My question: is there a way to perform bitwise operations >on 32bit UNSIGNED integers(actually a sequence of integers)? I wrote some functions to do that some time ago, when I was creating some encryption routines myself, but they handled only atoms (not sequences). But it is not difficult to create one that would work also with sequences. Here is a routine that would XOR the elements of a sequence with the elements of other one, and return unsigned values (untested code): function unsigned_xor(object a1,object a2) object result result=3Dxor_bits(a1,a2) result=3Dresult+((result<0)*#100000000) return result end function It is easy to change it to perform other operations (and, or, not). If you want to perform these operations only to atoms, and not to sequences, this one should be faster (also untested): function uxor(atom a1,atom a2) atom result result=3Dxor_bits(a1,a2) if result<0 then result=3Dresult+#100000000 end if return result end function I hope it helps. I am looking forward to seeing your toolkit, as I am interested in cryptography too. Regards, Davi T. Figueiredo davitf at usa.net ____________________________________________________________________ Get free e-mail and a permanent address at http://www.amexmail.com/?A=3D1=