hexadecimal

Books on hexadecimal and binary systems

I have a basic understanding of hexadecimal and binary representations, which I'd like to improve. Can anyone recommend books that can help me along? Thanks. ...

Bit Flipping in Hex

I have an 8 digit hexadecimal number of which I need certain digits to be either 0 or f. Given the specific place of the digits is there a quick way to generate the hex number with those places "flipped" to f. For example: flip_digits(1) = 0x000000f flip_digits(1,2,4) = 0x0000f0ff flip_digits(1,7,8) = 0xff00000f I'm doing this on an...

How to replace HEX character in an xml document?

I'm trying to import an xml file into vb.net XmlDocument but am getting the error: '.', hexadecimal value 0x00, is an invalid character. Line 94, position 1. I'm wondering if there is a way to replace the hex character 0x00 The following are lines 92,93,94 the file ends on line 94 92 | </request> 93 |</rpc> <!-- XML Finishes he...

How can I give a color to imagecolorallocate?

I have a PHP variable which contains information about color. For example $text_color = "ff90f3". Now I want to give this color to imagecolorallocate. The imagecolorallocate works like that: imagecolorallocate($im, 0xFF, 0xFF, 0xFF); So, I am trying to do the following: $r_bg = bin2hex("0x".substr($text_color,0,2)); $g_bg = bin2hex("0...

Python iteration

I'm trying to do a simple script in Python that will print hex values and increment value like this: char = 0 char2 = 0 def doublehex(): global char,char2 for x in range(255): char = char + 1 a = str(chr(char)).encode("hex") for p in range(255): char2 = char2 + 1 b = str(chr(char...

how to convert hexadecimal to byte in php

I am very new to PHP I mean I want to create a byte array something like this byte array[] = { (byte) 0x9C, (byte) 0xA0}; how to do I do it in PHP any syntactical help highly apreciated. I mean how to create a byte array in php. Thanks in advance ...

Function that converts hex color values to an approximate color name?

I don't suppose anyone knows of a function (PHP, preferably) that can take a hex color code and give an approximate color name for that hex value. I don't need a solution with 100s of colors. Even if it just amounted to the colors white, black, red, green blue, brown orange and yellow, I'd be pretty well in shape. If you don't know of a...

Help with .wav hexadecimal...

Hello, I just want to find out -to expand my knowledge on hexadecimals... And I'm wondering how .wav files convert to hex... I have a hex editor, I open them and mess around with the hex: I understand that the first few are file extension and file bitrate etc. But I want to learn which hex values write a sound? Like what gives a sou...

From string to hex MD5 hash and back

I have this pseudo-code in java: bytes[] hash = MD5.hash("example"); String hexString = toHexString(hash); //This returns something like a0394dbe93f bytes[] hexBytes = hexString.getBytes("UTF-8"); Now, hexBytes[] and hash[] are different. I know I'm doing something wrong since hash.length() is 16 and hexBytes.length() is 32. Maybe...

How to sort by hexadecimals in xslt?

Hi, im trying to sort my transformed output by a element which contains a hex value. <xsl:sort select="Generation/Sirio/Code" data-type="number"/> Values are plain old Hex: 00 01 02 ... 0A ... FF but they are getting sorted like that: 0A FF 00 01 02, which indicates that the sorting method fails as soon as there are character involved...

converting hexadecimal , octal numbers into decimal form using python script

There are many inbulit functions like int(octal) which can be used to convert octal numbers into decimal numbers on command line but these doesn't work out in script . int(0671) returns 0671 in script, where as it represent decimal form of octal number on python command line. Help??? Thank You ...

Add two hexBinarys with XPATH 1.0

Hi, my xml document looks somewhat like that (Values are both xsl:hexBinary): <Offsets> <Offset> <Name>ErrorOffset</Name> <Value>DD</Value> </Offset> <Offset> <Name>OtherOffset</Name> <Value>FF</Value> </Offset> </Offsets> <Value> <Name>Error1</Name> <Code>0...

How to produce Capital hexadecimal digits with QString::arg() ? [QT]

Hi, I'm trying to create a QString which is a hexadecimal number with its letter digits in Capitals instead of small caps, how can it be done? QString( " %1" ).arg( 15, 1, 16 ) yields f and I'd like F ...

Converting a decimal value to a 32bit floating-point hexadecimal

For a simple utility I'm working on, I need a script that converts a given decimal value to a 32bit floating-point hexadecimal value. For example, I know 1 is 3F800000 and 100 is 42C80000, however I don't know how to return these results with any number. If somebody knows a simple formula or even a complex way to go about doing this, ple...

Using 3-digit color codes rather than 6-digit color codes in CSS

I recently went through my CSS file and switch all my 6-digit hexadecimal codes to simple 3-digit codes (for example, my #FDFEFF got shortened to #FFF). It renders pretty much the exact same color as before, it seems to me that the in between parts are fairly useless and removing them saved me an entire 300 bytes in my CSS file. Does it...

How do I convert a decimal integer into a single hexadecimal character? (C)

Hi, I am trying to convert a decimal integer into hexadecimal. I've done a lot of searching online, and have found many ways to do this. However, every way I found converts to a string; for example, I can convert 100 into "64". That isn't what I need to do. I want to be able to convert 100 into '0x64', which is an entirely different mat...

Formula For Calculating Opposite ("Difference") For Hexadecimal Color

how can i create an opposite of a hexadecimal color? for example, i'd like to convert 0x000000 (black) into 0xFFFFFF (white), or 0xFF0000 (red) into 0x00FFFF (cyan). those are rather basic colors, while variants of colors can have more complex hexadecimal values, such as 0x21B813 (greenish). are bitwise operators required for this? m...

What's the easiest way to convert Int32's bytes to String?

Dim intChunkId As Integer = &H4D546864 Dim strCunnkId As String = "MThd" Dim easiestWay = GetString(intChunkId) ...

Change the mbr signature with dd

Hi, I use the linux kernel module CONFIG_EDD. I would change the mbr_signature, I can do that with the tool hexedit but I have to integrate in a script. I use this command: dd if=/dev/mydev bs=4 count=1 skip=110 | hexdump -e '"0x%08x\n"' to recover it without using the file (/sys/firmware/edd/...) created by EDD. I wonder how ...

Create NSData object with hex data

Hi there, I have a hex set of data, ripped from a .plist save of an NSArray, that reads (for example) like this: 06000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000 00010000 08020100 00000000 e028f440 00008543 00809343 b0e22a00 that I would like to turn into an NSData object. What is the appropriate way to do this...