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.
            9,706
            questions
        
        
            1929
            votes
        
        
            30
            answers
        
        
            1.4m
            views
        
    How to convert decimal to hexadecimal in JavaScript
                How do you convert decimal values to their hexadecimal equivalent in JavaScript?
            
        
       
    
            1649
            votes
        
        
            53
            answers
        
        
            1.2m
            views
        
    How do you convert a byte array to a hexadecimal string, and vice versa?
                How can you convert a byte array to a hexadecimal string and vice versa?
            
        
       
    
            1446
            votes
        
        
            8
            answers
        
        
            1.3m
            views
        
    Hex transparency in colors [duplicate]
                I'm working on implementing a widget transparency option for my app widget although I'm having some trouble getting the hex color values right. Being completely new to hex color transparency I ...
            
        
       
    
            986
            votes
        
        
            10
            answers
        
        
            1.4m
            views
        
    Convert hex string to integer in Python
                How do I convert a hex string to an integer?
"0xffff"   ⟶   65535
"ffff"     ⟶   65535
            
        
       
    
            822
            votes
        
        
            34
            answers
        
        
            1.0m
            views
        
    Java: convert a byte array to a hex string?
                I have a byte array filled with hex numbers and printing it the easy way is pretty pointless because there are many unprintable elements. What I need is the exact hexcode in the form of: 3a5f771c
            
        
       
    
            822
            votes
        
        
            61
            answers
        
        
            821k
            views
        
    RGB to hex and hex to RGB
                How to convert colors in RGB format to hex format and vice versa?
For example, convert '#0080C0' to (0, 128, 192).
            
        
       
    
            708
            votes
        
        
            20
            answers
        
        
            681k
            views
        
    How do I get the color from a hexadecimal color code using .NET?
                How can I get a color from a hexadecimal color code (e.g. #FFDFD991)?
I am reading a file and am getting a hexadecimal color code. I need to create the corresponding System.Windows.Media.Color ...
            
        
       
    
            703
            votes
        
        
            23
            answers
        
        
            341k
            views
        
    Programmatically Lighten or Darken a hex color (or rgb, and blend colors)
                Here is a function I was working on to programmatically lighten or darken a hex color by a specific amount. Just pass in a string like "3F6D2A" for the color (col) and a base10 integer (amt) ...
            
        
       
    
            644
            votes
        
        
            33
            answers
        
        
            653k
            views
        
    How do I use hexadecimal color strings in Flutter?
                How do I convert a hexadecimal color string like #b74093 to a Color in Flutter?
I want to use a HEX color code in Dart.
            
        
       
    
            563
            votes
        
        
            12
            answers
        
        
            783k
            views
        
    Convert integer to hexadecimal and back again
                How can I convert the following?
2934 (integer)  to   B76 (hex)
Let me explain what I am trying to do. I have User IDs in my database that are stored as integers. Rather than having users reference ...
            
        
       
    
            549
            votes
        
        
            5
            answers
        
        
            396k
            views
        
    Why are hexadecimal numbers prefixed with 0x?
                Why are hexadecimal numbers prefixed as 0x?
 I understand the usage of the prefix but I don't understand the significance of why 0x was chosen.
            
        
       
    
            453
            votes
        
        
            25
            answers
        
        
            625k
            views
        
    Convert a string representation of a hex dump to a byte array using Java?
                I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array.
I couldn't have phrased it better than the person that posted the same question here.
But ...
            
        
       
    
            388
            votes
        
        
            4
            answers
        
        
            436k
            views
        
    Need a good hex editor for Linux [closed]
                I need a good hex editor for Linux, and by good I mean:
Fast
Has search/replace features
Can display data not only in hex, but also binary, octal, etc.
Can work with huge (> 1 GB) files without ...
            
        
       
    
            387
            votes
        
        
            9
            answers
        
        
            622k
            views
        
    What's the correct way to convert bytes to a hex string in Python 3?
                What's the correct way to convert bytes to a hex string in Python 3?
I see claims of a bytes.hex method, bytes.decode codecs, and have tried other possible functions of least astonishment without ...
            
        
       
    
            383
            votes
        
        
            19
            answers
        
        
            668k
            views
        
    byte[] to hex string [duplicate]
                How do I convert a byte[] to a string? Every time I attempt it, I get 
  System.Byte[] 
instead of the value.
Also, how do I get the value in Hex instead of a decimal?
            
        
       
    
            367
            votes
        
        
            16
            answers
        
        
            434k
            views
        
    How to get a Color from hexadecimal Color String
                I'd like to use a color from an hexa string such as "#FFFF0000" to (say) change the background color of a Layout.
Color.HSVToColor looks like a winner but it takes a float[] as a parameter.
Am I any ...
            
        
       
    
            346
            votes
        
        
            4
            answers
        
        
            701k
            views
        
    How can I convert a hex string to a byte array? [duplicate]
                Can we convert a hex string to a byte array using a built-in function in C# or do I have to make a custom method for this?
            
        
       
    
            305
            votes
        
        
            15
            answers
        
        
            859k
            views
        
    How to convert an int to a hex string?
                I want to take an integer (that will be <= 255), to a hex string representation
e.g.: I want to pass in 65 and get out '\x41', or 255 and get '\xff'.
I've tried doing this with the struct.pack('c'...
            
        
       
    
            271
            votes
        
        
            5
            answers
        
        
            907k
            views
        
    printf() formatting for hexadecimal
                Why, when printing a number in hexadecimal as an 8 digit number with leading zeros, does %#08X not display the same result as 0x%08X?
When I try to use the former, the 08 formatting flag is removed, ...
            
        
       
    
            245
            votes
        
        
            19
            answers
        
        
            190k
            views
        
    Create a hexadecimal colour based on a string with JavaScript
                I want to create a function that will accept any old string (will usually be a single word) and from that somehow generate a hexadecimal value between #000000 and #FFFFFF, so I can use it as a colour ...
            
        
       
    
            243
            votes
        
        
            13
            answers
        
        
            148k
            views
        
    How to convert a color integer to a hex String in Android?
                I have an integer that was generated from an android.graphics.Color.
It has a value of -16776961. How do I convert it into a hex string with the format #RRGGBB?
Simply put: I would like to output #...
            
        
       
    
            234
            votes
        
        
            9
            answers
        
        
            297k
            views
        
    How to create a hex dump of file containing only the hex characters without spaces in bash?
                How do I create an unmodified hex dump of a binary file in Linux using bash? The od and hexdump commands both insert spaces in the dump and this is not ideal.
Is there a way to simply write a long ...
            
        
       
    
            233
            votes
        
        
            10
            answers
        
        
            181k
            views
        
    Understanding colors on Android (six characters)
                I am trying to understand how colors work in Android. I have this color set as the background of my LinearLayout, and I get a background gray with some transparency:
<gradient android:startColor="#...
            
        
       
    
            220
            votes
        
        
            5
            answers
        
        
            152k
            views
        
    Converting an integer to a hexadecimal string in Ruby
                Is there a built in way to convert an integer in Ruby into its hexadecimal equivalent?
Something like the opposite of String#to_i:
"0A".to_i(16) #=>10
Like perhaps:
"0A".hex #=>10
I know ...
            
        
       
    
            215
            votes
        
        
            28
            answers
        
        
            525k
            views
        
    Integer to hex string in C++
                How do I convert an integer to a hex string in C++?
I can find some ways to do it, but they mostly seem targeted towards C. It doesn't seem there's a native way to do it in C++. It is a pretty simple ...
            
        
       
    
            209
            votes
        
        
            25
            answers
        
        
            209k
            views
        
    How to get hex color value rather than RGB value?
                Using the following jQuery will get the RGB value of an element's background color:
$('#selector').css('backgroundColor');
Is there a way to get the hex value rather than the RGB?
            
        
       
    
            203
            votes
        
        
            8
            answers
        
        
            758k
            views
        
    Transparent ARGB hex value
                The colors in this table is all not transparent. I guess the value for the A is set to FF.
What is the code for transparency? 
For example this color FFF0F8FF (AliceBlue), to a transparent code such ...
            
        
       
    
            201
            votes
        
        
            11
            answers
        
        
            395k
            views
        
    C++ cout hex values?
                I want to do:
int a = 255; 
cout << a;
and have it show FF in the output, how would I do this?
            
        
       
    
            199
            votes
        
        
            6
            answers
        
        
            223k
            views
        
    What's a good hex editor/viewer for the Mac? [closed]
                What's a good hex editor/viewer for the Mac? I've used xxd for viewing hexdumps, and I think it can be used in reverse to make edits. But what I really want is a real hex editor.
            
        
       
    
            198
            votes
        
        
            9
            answers
        
        
            630k
            views
        
    Convert from ASCII string encoded in Hex to plain ASCII?
                How can I convert from hex to plain ASCII in Python?
Note that, for example, I want to convert "0x7061756c" to "paul".
            
        
       
    
            190
            votes
        
        
            8
            answers
        
        
            235k
            views
        
    Hexadecimal To Decimal in Shell Script
                Can someone help me to convert a hexadecimal number to decimal number in a shell script?
E.g., I want to convert the hexadecimal number bfca3000 to decimal using a shell script. I basically want the ...
            
        
       
    
            188
            votes
        
        
            3
            answers
        
        
            490k
            views
        
    How do I convert hex to decimal in Python? [duplicate]
                I have some Perl code where the hex() function converts hex data to decimal. How can I do it on Python?
            
        
       
    
            181
            votes
        
        
            13
            answers
        
        
            514k
            views
        
    Print a string as hexadecimal bytes
                I have this string: Hello, World! and I want to print it using Python as '48:65:6c:6c:6f:2c:20:57:6f:72:6c:64:21'.
hex() works only for integers.
How can it be done?
            
        
       
    
            175
            votes
        
        
            20
            answers
        
        
            447k
            views
        
    How to convert numbers between hexadecimal and decimal
                How do you convert between hexadecimal numbers and decimal numbers in C#?
            
        
       
    
            173
            votes
        
        
            8
            answers
        
        
            99k
            views
        
    Visual Studio debugger - Displaying integer values in Hex
                I'm using Visual Studio 2008 and I have just noticed that the debugger is displaying integer values as Hex when I hover over variables and also in the immediate window.  I guess I must have hit a ...
            
        
       
    
            171
            votes
        
        
            28
            answers
        
        
            208k
            views
        
    In Java, how do I convert a byte array to a string of hex digits while keeping leading zeros? [duplicate]
                I'm working with some example java code for making md5 hashes. One part converts the results from bytes to a string of hex digits:
byte messageDigest[] = algorithm.digest();     
StringBuffer ...
            
        
       
    
            164
            votes
        
        
            10
            answers
        
        
            468k
            views
        
    C++ convert hex string to signed integer
                I want to convert a hex string to a 32 bit signed integer in C++.  
So, for example, I have the hex string "fffefffe".  The binary representation of this is 11111111111111101111111111111110.  The ...
            
        
       
    
            160
            votes
        
        
            17
            answers
        
        
            171k
            views
        
    Converting an RGB color tuple to a hexidecimal string
                I need to convert (0, 128, 64) to something like this "#008040". I'm not sure what to call the latter, making searching difficult.
            
        
       
    
            159
            votes
        
        
            5
            answers
        
        
            184k
            views
        
    What do numbers using 0x notation mean?
                What does a 0x prefix on a number mean?
const int shared_segment_size = 0x6400;
It's from a C program. I can't recall what it amounts to and particularly what the letter x means.
            
        
       
    
            154
            votes
        
        
            23
            answers
        
        
            505k
            views
        
    Convert hex to binary
                I have ABC123EFFF.
I want to have 001010101111000001001000111110111111111111 (i.e. binary repr. with, say, 42 digits and leading zeroes).
How?
            
        
       
    
            137
            votes
        
        
            9
            answers
        
        
            241k
            views
        
    Convert hex string to int
                I am trying to convert a string that is 8 characters long of hex code into an integer so that I can do int comparison instead of string comparisons over a lot of different values.
I know this is ...
            
        
       
    
            131
            votes
        
        
            13
            answers
        
        
            242k
            views
        
    Convert decimal to hexadecimal in UNIX shell script
                In a UNIX shell script, what can I use to convert decimal numbers into hexadecimal?  I thought od would do the trick, but it's not realizing I'm feeding it ASCII representations of numbers.
printf?  ...
            
        
       
    
            131
            votes
        
        
            8
            answers
        
        
            499k
            views
        
    Printing hexadecimal characters in C
                I'm trying to read in a line of characters, then print out the hexadecimal equivalent of the characters.
For example, if I have a string that is "0xc0 0xc0 abc123", where the first 2 characters are ...
            
        
       
    
            130
            votes
        
        
            5
            answers
        
        
            219k
            views
        
    How to create python bytes object from long hex string?
                I have a long sequence of hex digits in a string, such as 
  000000000000484240FA063DE5D0B744ADBED63A81FAEA390000C8428640A43D5005BD44
only much longer, several kilobytes.  Is there a builtin way to ...
            
        
       
    
            125
            votes
        
        
            23
            answers
        
        
            508k
            views
        
    Converting A String To Hexadecimal In Java
                I am trying to convert a string like "testing123" into hexadecimal form in java. I am currently using BlueJ. 
And to convert it back, is it the same thing except backward?
            
        
       
    
            119
            votes
        
        
            17
            answers
        
        
            128k
            views
        
    Convert hex color to RGB values in PHP
                What would be a good way to convert hex color values like #ffffff into the single RGB values 255 255 255 using PHP?
            
        
       
    
            119
            votes
        
        
            19
            answers
        
        
            316k
            views
        
    How do you convert a byte array to a hexadecimal string in C?
                I have:
uint8 buf[] = {0, 1, 10, 11};
I want to convert the byte array to a string such that I can print the string using printf:
printf("%s\n", str);
and get (the colons aren't necessary):
"00:...
            
        
       
    
            118
            votes
        
        
            9
            answers
        
        
            174k
            views
        
    Decorating Hex function to pad zeros
                I wrote this simple function:
def padded_hex(i, l):
    given_int = i
    given_len = l
    hex_result = hex(given_int)[2:] # remove '0x' from beginning of str
    num_hex_chars = len(hex_result)
   ...
            
        
       
    
            113
            votes
        
        
            6
            answers
        
        
            98k
            views
        
    How to convert an Int to Hex String in Swift
                In Obj-C I used to convert an unsigned integer n to a hex string with 
 NSString *st = [NSString stringWithFormat:@"%2X", n];
I tried for a long time to translate this into Swift language, but ...
            
        
       
    
            103
            votes
        
        
            12
            answers
        
        
            181k
            views
        
    What's 0xFF for in cv2.waitKey(1)?
                I'm trying understand what 0xFF does under the hood in the following code snippet:
if cv2.waitKey(0) & 0xFF == ord('q'):
    break
Any ideas?