Chatsubo [(in)Security Dark] Labs

"... A consensual hallucination experienced daily by billions of legitimate operators, in every nation, by children being taught mathematical concepts... A graphic representation of data abstracted from banks of every computer in the human system. Unthinkable complexity. Lines of light ranged in the nonspace of the mind, clusters and constellations of data. Like city lights, receding into the distance... "
--
William Gibson.

jueves, 22 de abril de 2010

XOR Swap Algorithm

20 minutes before I got to work, I was tackling against a couple of Mexico City's traffic jams !! and then, I recalled a simple but pretty cool algorithm I used like 5 years ago to swap 2 different variables without using a temporary one. If you're new at programming, there exist a variety of such algorithms, more commonly referred as Sorting Algorithms, and most of them use a temporary variable in order to swap the values they have, so, if u want to optimize your c0de and n1nj4 skillz ;) take a look at this !..

This is the XOR Swap Algorithm, and instead I explain it... A picture is worth a thousand words ;) ...


As you can see, it's mathematically simple, and below you can see the c0de & screensh0t I took a few minutes before ...



Keep h4cking !!

1 comentario:

  1. Y dices que soy re mamon :p jeje

    "20 minutes before I got to work, I was tackling against a couple of Mexico City's traffic jams !! and then..."

    aqui esta la aplicacion, tambien lo puse en qsort

    http://math.co.ro/C/quickandslowsort.c

    Nos vemos en vegas! :D

    ResponderEliminar