hex

Parse HEX ASCII into numbers?

I have a H/W device that normally uses a serial port for an interface, sending and receiving binary messages to a PC UI program. I've added an Ethernet port and small TCP/IP stack with a small web server that I want to use to replace the serial port UI with a web browser UI. The messages are mostly request/response sort of things, but f...

storing hexadecimal in a variable (Dim xx as "Hex") in vb.net

As the title says how can I store a hexadecimal number in a variable without it becoming a decimal. Or do I have to store it as either a string or integer? ...

All Possible combination for an HEX Value from a given set of chars

Hi all, I am new to python and programming, I am looking for a code, or a sample code that can have a predefined set of hex values and that can find the 3 used values within to generate a certain value. lets say I have a value of : 0x50158A51 this is a 4 byte (32 bit) hex value now i need to find the values which when added or subt...

Show Hexadecimal Numbers Of a File

I want to build a bash program that can read a file, like a *.bin and print all its hexadecimal numbers, as 'hex' editors do. Where I can start? ...

Print Hexadecimal Numbers Of a File At C And C++

I'm now developing a home project, but before I start, I need to know how can I printcout the content of a file(*.bin as example) in hexadecimal? I like to learn, then a good tutorial is very nice too ;-) Remember that I need to develop this, without using external applications, because this home project is to learn more about hexadeci...

Substituting 0A For \n

I'm at the time beginning the development of a simple hex editor(that only reads at the time). I want to substitute OA for "\n", I'm trying with this code: #include <iostream> #include <fstream> #include <iomanip> using namespace std; int main() { ifstream infile; int crtchar = (int)infile.get(); infile.open("test.txt", ifstre...

Best/Easiest Language To Work With Disassembling

I'm now thinking to develop a disassembler, but as I know that it's very hard to build a disassembler I want to know the best/easiest language to turn my dream into a reality, also, a tutorial suggestion is very nice too ;-) ...

How can I implement a color search for an image gallery?

I'm working on a simple image gallery project and I'd like to implement the ability to search based on a color hex code. So if someone enters 'ff1212' into the search, it will display only those images that contain that particular shade of red. I've seen a website that has a search that works the way I want: http://cssline.com (the AJAX ...

Converting a Char to Its Int Representation

I don't see this an option in things like sprintf(). How would I convert the letter F to 255? Basically the reverse operation of conversion using the %x format in sprintf? I am assuming this is something simple I'm missing. ...

What text encoding scheme do you use when you have binary data that you need to send over an ascii channel?

If you have binary data that you need to encode, what encoding scheme do you use? I know about: Hex encoding. Very simple, but quite verbose, expands one byte to two. Base 64. Most common, not so verbose, expands three bytes to four. Base 85. Not common, less verbose again, expands four bytes to five. Are there any other encoding sc...

How to swap adjacent bytes in a string of hex bytes (with or without regular expressions)

Given the string (or any length string with an even-number of word pairs): "12345678" How would I swap adjacent "words"? The result I want is "34127856" As well as, when that's done I need to swap the longs. The result I want is: "78563412" ...

DOS command to format string to hex value

Is it possible to format a string to a hex value using DOS command? I'm trying to pass a hex value to my program from command line but it takes that complete value a a string and not as hex value? ...

RGB gradient based on percentage of file loaded

I'm working on my first Flash project, and for my preloader I'd like to do a really simple gradient based on the percentage loaded. The preloader says "77% loaded...", where the number 77 is a dynamic text instance called percentLoaded. I'd like the textColor of percentLoaded to change on a gradient from #000000 to #FFFFFF, in gray-sca...

Any reason to use hex notation for null pointers?

I'm currently improving the part of our COM component that logs all external calls into a file. For pointers we write something like (IInterface*)0x12345678 with the value being equal to the actual address. Currently no difference is made for null pointers - they are displayed as 0x0 which IMO is suboptimal and inelegant. Changing this ...

Python: strange numbers being pulled from binary file /confusion with hex and decimals

This might be extremely trivial, and if so I apologise, but I'm getting really confused with the outputs I'm getting: hex? decimal? what? Here's an example, and what it returns: >>> print 'Rx State: ADC Clk=', ADC_Clock_MHz,'MHz DDC Clk=', DDC_Clock_kHz,'kHz Temperature=', Temperature,'C' Rx State: ADC Clk= [1079246848L, 0L] MHz DDC Cl...

In C#, how do I convert an array of bytes into a string of hex numbers?

In C#, what is the tidiest way to convert an array of bytes into a string of hex numbers? ...

Encrypt a hex string in java.

I would like to ask for any suggestions about my problem. I need to encrypt a hexadecimal string. I must not to use the built-in functions of java because it doesn't work in my server. In short, I have to hard code an algorithm or any means of encrypting the message. Anyone who could help me with this? thanks a lot! here is the code. p...

Actionscript Build Hex String

Hi all, basically i want to build a colour hex value using 3 decimal values. for clarities sake, the 3 decimals i have are 255 254 253 and i want to generate the hex string: 0xFFFEFD how would i do that? ...

Convert integer to byte

Hi there. I have program in C#. I want to convert an int to HEX and after that convert it to a byte. But there is a problem in the 3rd line: int i = 10; string str = i.ToString("X"); byte b = Convert.ToByte(str); Please help me. ...

Do I need to encode encrypted bytes before sending?

Do I need to encode my encrypted bytes when sending it through java data streams for instant messaging? Sending encrypted bytes don't look very safe to me. If so, should I use Hex or Base64 encoding? Thanks ...