Questions tagged [hex]

Hexadecimal (also base 16, or hex) is the base-16 positional numeral system, using the 16 symbols 0–9 and A‒F.

hex
Filter by
Sorted by
Tagged with
1 vote
3 answers
4k views

C++ convert integer to hex string for Color in Graphicsmagick

How can i convert an integer ranging from 0 to 255 to a string with exactly two chars, containg the hexadecimal representation of the number? Example input: 180 output: "B4" My goal is to set the ...
Alp's user avatar
  • 29.5k
1 vote
1 answer
225 views

Avoid hexadecimal characters before parsing XML

How to Avoid hexadecimal characters before parsing XML?
Mselmi Ali's user avatar
0 votes
1 answer
109 views

how make Hexa must be 2 Digit on NSData

I try use encrypt aes on iphone and success, but the result i want on nsdata must be 2 digit hexa, i try to print the result of cipher whit this code : unsigned char ciphertext[16]; .... ... ... ... ...
user752846's user avatar
9 votes
5 answers
13k views

Converting a binary value to hexadecimal in Ruby

I have a situation where I need to convert a binary value to hex in Ruby. My situation is as follows: When bin = "0000111", my output should be: hex = "07". When bin = "010001111", my output should ...
sundar's user avatar
  • 389
1 vote
3 answers
2k views

UIColor from hex string representation

any snippet to get from: NSString *_s = @"#000000"; to: [UIColor blackColor]; any help is highly appreciated, just been messing around with an ugly code to do this :(
David Homes's user avatar
  • 2,734
0 votes
1 answer
828 views

How to encode in base 64 and hex?

I read following two lines in the book : The Web Application Hacker’s Hand- book. For example, the Base64-encoded form of The Web Application Hacker’s Hand- book is: ...
narayanpatra's user avatar
  • 5,653
1 vote
1 answer
108 views

Are there any developers here who do logic operations on hex in their head?

Are there any developers here who do logic operations on hex in their head? If so, how did you internalise this ability. Do you still mentally convert to binary as part of the process? Thanks, ...
fadedbee's user avatar
  • 43.8k
0 votes
2 answers
601 views

C# read in file using hex prints FFFFFF

very confused by this, when I read in a file using the code below when it gets to the end it prints out FFFFFF, could anyone explain this to me the text file only has numbers and letters in it? Any ...
Simon's user avatar
  • 111
9 votes
4 answers
20k views

Writing a while loop in assembly

I'm trying to write a while loop in assembly with a 6502 processor and I cannot figure out how to write the hexadecimal code. I've seen examples written using the shorthand where there is a label for ...
jnhyf's user avatar
  • 91
0 votes
2 answers
1k views

Comparing a sequence of n characters in a hex-value

I'm basicly trying to compare a token(string) with a hex-datatype! Example: #include<stdio.h> #include<string.h> int main(int argc, char *argv[]) { char* token ="Hello"; int ...
Big Dude's user avatar
  • 264
0 votes
1 answer
477 views

C# skip hex charcters

I'm using C# to read a file and I need to (sometimes) skip several bytes before outputting the next byte. For instance: 31 32 33 34 35 36 37 38 39 I wanted to skip the first two (or any given ...
Simon's user avatar
  • 111
1 vote
1 answer
8k views

C# read file as hex one byte at a time [duplicate]

Possible Duplicate: Read hex in C# using IO Hi, I'm new to C# from Java and I have been stuck for the last two hours on something simple, or what should be so was wondering if someone would help ...
Simon's user avatar
  • 111
6 votes
1 answer
5k views

How to convert RGB to HTML color?

Please can you tell me how I can convert an RGB UIColor to a Hexadecimal HTML color code string?
max_'s user avatar
  • 24.3k
1 vote
1 answer
5k views

How to convert hexadecimal string to decimal?

I would appreciate it if you could tell me how I can convert hexadecimal letters within an NSString, e.g. @"50A6C2", to decimals using Objective-C. Thanks in advance.
max_'s user avatar
  • 24.3k
75 votes
8 answers
144k views

How to get the background color code of an element in hex?

How do I get the background color code of an element? console.log($(".div").css("background-color")); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></...
Run's user avatar
  • 56.1k
3 votes
5 answers
47k views

Python - Decimal to Hex, Reverse byte order, Hex to Decimal

I've been reading up a lot on stuct.pack and hex and the like. I am trying to convert a decimal to hexidecimal with 2-bytes. Reverse the hex bit order, then convert it back into decimal. I'm trying ...
Jim's user avatar
  • 613
0 votes
4 answers
684 views

What does return 0xfe + ceil(x) return?

As I understand, C should convert 0xfe to -2, so the return ought to be ceil(x) - 2 - but the function seems to return neither of those. What should int m(double x){return 0xfe + ceil(x)} return? ...
ina's user avatar
  • 19.4k
3 votes
1 answer
7k views

Unsigned Char Array to Hex Representation NSString

I have an unsigned char array and I want to convert it to hex NSString, currently I do it in the following way: unsigned char result[16]; // Fill the array NSString *myHexString = [NSString ...
MByD's user avatar
  • 137k
0 votes
1 answer
603 views

Ruby: Print un-printable data string

If I have a variable, x, that will sometime be a normal printable string, and sometimes be some random hex data (including unprintable chars), how can I reliably print that will space padding? ex: ...
wuntee's user avatar
  • 12.3k
0 votes
3 answers
761 views

Extracting "plaintext" header from HEX file using Perl

Have a file that appears to have plaintext headers in them that I would like to extract and convert to plaintext. Using HEXedit, this is what I'm seeing, which is in a file: 3a40 - 31 65 33 38 00 00 ...
blunders's user avatar
  • 3,649
0 votes
2 answers
3k views

search in HEX for specific bytes

I have a buffer[] including HEX bytes and I want to search this buffer to find specific bytes. For example: My buffer has 4096 bytes and I want to search in this if the bytes 45 34 67 23 (together) ...
nomercy's user avatar
  • 21
2 votes
3 answers
1k views

What is 0x30 when defining a color?

I saw an example online: private int[] colors = new int[] { 0x30F8F8F8, 0x30EAEAEA }; I am not sure what the first chars represent, but the last 6 look like hex numbers. Is this correct?
Sheehan Alam's user avatar
  • 60.5k
4 votes
2 answers
18k views

How to convert a hex string to an unsigned long?

I have following hex value CString str; str = T("FFF000"); How to convert this in to an unsigned long?
Vikram Ranabhatt's user avatar
1 vote
3 answers
3k views

Converting Decimal to Hexadecimal and Octal

Show how to write a constant in C, whose decimal value is 65 as a. a hexadecimal constant 65/16 = 1 r1 1/16 = 0 r1 Hexadecimal constant = 11 b. an octal constant (in C) 65/8 = 8 r1 8/8 = 1 r0 1/8 = 0 ...
raphnguyen's user avatar
  • 3,615
1 vote
2 answers
1k views

Implementing A* on a triangular/hexagonal Grid with negative Coordinates

Following the apparent tradition of of using this question as the basis of new questions I too have a problem I am looking to solve as elegantly as possible: I have implemented a hexagonal map as ...
Jesse Purdy's user avatar
5 votes
1 answer
2k views

PowerShell's Write-Output, echo and output redirection insert excessive characters into output

The story I'm writing a program that outputs a sequence of hex digits like does xxd -ps command. This output is intended to be converted into a binary file, e.g. with xxd -ps -r. When I try to invoke ...
ilyaigpetrov's user avatar
  • 3,785
4 votes
3 answers
4k views

Exploits in Python - manipulating hex strings

I'm quite new to python and trying to port a simple exploit I've written for a stack overflow (just a nop sled, shell code and return address). This isn't for nefarious purposes but rather for a ...
Mike B.'s user avatar
  • 123
3 votes
2 answers
533 views

Dotnet Hex string to Java

Have a problem, much like this post: How to read a .NET Guid into a Java UUID. Except, from a remote svc I get a hex str formatted like this: ABCDEFGH-IJKL-MNOP-QRST-123456. I need to match the ...
Karoy's user avatar
  • 193
0 votes
4 answers
2k views

Mangled Hex message via socket

I am trying to pass a hex message from a C server to a Java client. The communication works. But the hex value that I get on Java client seems to be appended with "ff". Why is this happening? At the ...
pimmling's user avatar
  • 493
37 votes
6 answers
139k views

Hexadecimal to Integer in Java

I am trying to convert a String hexadecimal to an integer. The string hexadecimal was calculated from a hash function (sha-1). I get this error : java.lang.NumberFormatException. I guess it doesn't ...
Dimitri's user avatar
  • 8,212
5 votes
3 answers
12k views

Finding number of samples in .wav file and Hex Editor

Need help with Hex Editor and audio files.I am having trouble figuring out the formula to get the number of samples in my .wav files. I downloaded StripWav which tells me the number of samples in the ...
james's user avatar
  • 2,633
3 votes
1 answer
5k views

MySQL output hex string as UTF-8

This works UTF8 create temporary table test (x char(1) not null) charset=utf8; insert into test select x'c3a9'; select hex(x), x from test; drop table test; outputs +--------+---+ | hex(x) | x | +--...
700 Software's user avatar
  • 86.5k
0 votes
2 answers
2k views

Convert String to Byte(0x??)

I've made a window form application that send keys but in order to send keys I do this: To send 'A' I have to write down MyFunction(0x41). 0x41 is a byte. I can get the 41 as a string, but how do I ...
Or Betzalel's user avatar
  • 2,537
5 votes
4 answers
5k views

Python3 - parsing jpeg dimension info

I'm trying to write a python function to parse the width and height from a jpeg file. The code I currently have looks like this import struct image = open('images/image.jpg','rb') image.seek(199) #...
Tired Tove's user avatar
0 votes
1 answer
1k views

convert URL's hex digits into a string

I need to convert a url with hex digits to its equivelant string so that I can parse the query for e.g. http://www.google.com/#sclient=psy&hl=en&source=hp&q=c%23+windows+service+timer&...
michelle's user avatar
  • 2,769
5 votes
1 answer
3k views

How is this data from a magnetic card encoded?

I have some information about magnetic cards that control the building access, and need to reverse engineer the way the software stores data on the cards to make something with more features. (We have ...
Frederic's user avatar
10 votes
6 answers
50k views

Are hexadecimal numbers ever negative?

Are hexadecimal numbers ever negative? If yes then how? For binary you would have signed and unsigned. How would one represent them in Hex? I need this for a hex routine I am about to embark upon.
phoenix's user avatar
  • 3,551
1 vote
2 answers
308 views

Modify env variable name inside a library with hex editor?

Is it possible to modify an environmental variable's name inside a library with some sort of editor. I'm thinking maybe a hex editor ? I wish to modify the name but without altering its length: ...
Fuller Jacobs's user avatar
1 vote
1 answer
2k views

c : parse hex number inside long string

I am parsing an XML file using libxml2, and I need to pull out a hex number from an xml attribute. Now, lib2xml doesn't give a null terminated string for the attribute, just pointers to the beginning ...
Jacko's user avatar
  • 13k
-1 votes
1 answer
1k views

Tools to convert between assembly and hex in windows?

Can cl.exe or link.exe do the job?
compile-fan's user avatar
  • 17.3k
2 votes
4 answers
1k views

Ruby: Replace certain characters in an ascii range with their hex representations

I need to replace certain ascii characters like @ and & with their hex representations for a URL which would be 40 and 26 respectively. How can I do this in ruby? there are also some characters ...
Recursion's user avatar
  • 2,983
1 vote
2 answers
528 views

convert strange hex phone number to normal digits

I have a phone number represented as: AA A3 AA A1 A3 A7 A9 A7 A4 A9 and I want to convert it to normal digits: 0301379749?
Merni's user avatar
  • 2,852
0 votes
3 answers
2k views

3-bit encoding = Octal; 4-bit encoding = Hexadecimal; 5-bit encoding =?

Is there an encoding that uses 5 bits as one group to encode a binary data? A-Z contain 26 chars and 0-9 contain 10 chars. There are totally 36 chars which are sufficient for a 5-bit encoding (32 ...
Alex Yeung's user avatar
  • 2,505
56 votes
25 answers
296k views

Python convert decimal to hex

I have a function here that converts decimal to hex but it prints it in reverse order. How would I fix it? def ChangeHex(n): if (n < 0): print(0) elif (n<=1): print(n) ...
Eric's user avatar
  • 1,221
19 votes
4 answers
23k views

Char to Hex in javascript

Could anyone guide me on how to convert char to hex in javascript? For example: "入力されたデータは範囲外です。" to "\u5165\u529B\u3055\u308C\u305F\u30C7\u30FC\u30BF\u306F\u7BC4\u56F2\u5916\u3067\u3059\u3002" ...
user626818's user avatar
  • 1,338
5 votes
3 answers
8k views

Converting hex value in char array to an integer value

I have a hex value stored in a two byte array: unsigned char hex[2] = {0x02, 0x00}; How can I convert this to a decimal value?
tgai's user avatar
  • 1,115
0 votes
2 answers
2k views

python recursively convert decimal to hex

How would you recursively or iteratively change a decimal to hexadecimal? I wrote a sample program that does not really work: def ChangeHex(n): if (n < 0): print(0) elif (n<=1):...
Eric's user avatar
  • 1,221
0 votes
1 answer
2k views

C# Convert Integer To Hex?

I am using the Cosmos template to build a c# os. I need to write my own method that will convert a int value to a 2 byte use hex value. I can't use any prebuilt functions (like ToString("X") or String....
Grunt's user avatar
  • 173
7 votes
2 answers
16k views

Translating a String containing a binary value to Hex

I am trying to translate a String that contains a binary value (e.g. 000010001010011) to it's Hex value.(453) I've been trying several options, but mostly I get a converted value of each individual ...
N-Aero's user avatar
  • 73
0 votes
2 answers
7k views

How to convert char[] array of hex characters to a byte array of values? [duplicate]

Possible Duplicate: Hex to char array in C I have a char[10] array that contains hex characters, and I'd like to end up with a byte[5] array of the values of those characters. In general, how ...
Loki's user avatar
  • 6,253

1
178 179
180
181 182
195