isazi’s home

A hacker does for love what others would not do for money

isazi’s home header image

ascii2hex

April 9th, 2007 · 1 Comment

A small utility for converting a string from ascii to hexadecimal (and vice versa).

Hello to everyone folks! ;)
Friday i was at Metro Olografix’s “Weekend of magic II” and we were talking; during the configuration of a wireless card of a guest there’s the need to convert a string from ascii to its hexadecimal value (don’t ask why), obviously it’s possible to do that with mind, or with pencil and paper, or with the bash printf or whatsoever :) but, hey, when magic is required, magic is provided!
So i’ve made this little piece of code, and of course i’ve decided to share it with the whole world (oh, what a good boy i am).
I’ve choosed to use CMake also this time, so the way is, like you can imagine:


isazi@data:~$ tar xzvf ascii2hex-0.1.tar.gz
ascii2hex/CMakeLists.txt
ascii2hex/main.c
isazi@data:~$ cd ascii2hex
isazi@data:~/ascii2hex$ cmake .

After some output you obtain a “ready to use” Makefile, just type make and there’ll be a nice executable named ascii2hex all for you; as you can see the tool it’s really easy to use:


isazi@data:~/ascii2hex$ ./ascii2hex -a einsturzende!
65696E737475727A656E646521
isazi@data:~/ascii2hex$ ./ascii2hex -h 65696E737475727A656E646521
einsturzende!

Download ascii2hex 0.1

Hope you enjoy that ;)
Bye

Tags: C · Code · English

1 response so far ↓

  • 1 Cube // Jun 2, 2008 at 10:24 pm

    Fantastic style of code !!!

Leave a Comment

  • RSS Shared news

  • Creative Commons license

    Metro Olografix

    hacker emblem