hexadecimal

PHP and MySQL: Store and print hex char

I'm trying to store an hexadecimal value (\xC1) in MySql Database. When I print that with PHP, i get: xC1lcool instead of the right word. INSERT INTO veiculos VALUES (1, 'Ford', 'Ka RoCam Flex', 25850.00, 1998, 1999, 'Vermelho', 15000, '\xC1lcool;Gasolina;GNV', 'Ar-Condicionado;4 portas;Câmbio automático', 'imagem1.jpg;imagem2.jpg;im...

PHP: on 32 bit system INT_MAX displays wrong?

I was simply wishing to test for overflow on an integer, such as in C (well, if it were just over integer max anyway). When I looked to see if PHP was actually doing what I told it to, it seems it fails for some reason. Here are my tests of the problem: define('INT_MAX', 0x7FFFFFFF); print "In decimal: " . hexdec(INT_MAX) . "<br/>"; pri...

HexDec to Char to Password Unencrypt in PHP

Ok, so I'm trying to figure out how to go from hexadecimal encryption to string and back, but for some reason the when I encrypt, i'm not getting the same password that was passed in, but its close...weird right? I'm sure my syntax is wrong somewhere. Help? Here's a link to test a little random password. I've set 'pw' as the hexadeci...

Array to Hex Representation

I am writing a program that needs to take an array of size n and convert that into it's hex value as follows: int a[] = { 0, 1, 1, 0 }; I would like to take each value of the array to represent it as binary and convert it to a hex value. In this case: 0x6000000000000000; // 0110...0 it also has to be packed to the right with 0's t...

Deciphering HEX RGBA for MS-filters in CSS

I'm writing styles for a page where I'd like to use rgba colors on the background of some list items. I've used the CSS background property along with rgba(146,138,118,.4) to define my transparent background color. Now I'm trying to cover my bases with IE support by using the technique of an ms-filter as described in this article. (see ...

Can't seem to generate hex-encoded string from SHA256 digest in Java

Can't seem to figure out where Im going wrong here: private static String generateHashFromFile(String filePath) { try { final int BUFSZ = 32768; MessageDigest sha = MessageDigest.getInstance("SHA-256"); FileInputStream in = new FileInputStream(filePath); BufferedInputStream is = new BufferedInputStream(in, BUFSZ); byte...

Help with a Color Calculator in Java

I want to know how to paint the background based on the color of the hex value inputed by the user. I have this: import java.awt.*; import javax.swing.*; import java.awt.event.*; public class SimpleColorCalc extends JFrame implements Runnable { ColorPanel cp; JButton show; JTextField hexCode; public SimpleColorCalc() { ...

How do I get the hexadecimal representation of $foo in Perl?

Given the variable $foo containing binary data, how do I get the hexadecimal representation of $foo in Perl? ...

When would you use unpack('h*' ...) or pack('h*' ...)?

In Perl, pack and unpack have two templates for converting bytes to/from hex: h    A hex string (low nybble first). H    A hex string (high nybble first). This is best clarified with an example: use 5.010; # so I can use say my $buf = "\x12\x34\x56\x78"; say unpack('H*', $buf); # prints 12345678 say unpack('h*', $buf); # prints...

Get four 16bit numbers from a 64bit hex value

I have been through these related questions: http://stackoverflow.com/questions/74148/how-to-convert-numbers-between-hex-and-decimal-in-c http://stackoverflow.com/questions/487035/how-to-convert-64bit-long-data-type-to-16bit-data-type http://stackoverflow.com/questions/3500493/way-to-get-value-of-this-hex-number But I did not get an ...

working to Hex data using C++

need to help me for working hex string using c++ how to open file binary data hex line by line c++ how to split line using delimiter like 0x3D c++ how to store all lines in vector map except the line founded of search. ex. syntax file binary 32 32 32 32 32 32 30 3D 32 30 31 31 31 30 31 30 32 32 32 32 32 32 31 3D 32 30 31 31 31 30 ...

hexadecimals to integer.

I know how to convert hexadecimals to integers when i only have one hexadecimal character. but im getting a string of two characters. I'm converting both characters to hex with: String.Format("{0:x2}", (uint)System.Convert.ToUInt32(tmp.ToString())) so then lets say i have 01, and 3f as my two length characters. how am i supposed to ...

C# How to Format a Number to a Hexicadecimal with a Prefix '0x'

Hi, How to Format a Number to a Hexicadecimal with a Prefix '0x'? Such as: int space = 32; MessageBox.Show(space.ToString("'0x'X4")); // Output 0xX4 instead of 0x0020 I followed this link: Custom Numeric Format Strings http://msdn.microsoft.com/en-us/library/0c899ak8.aspx Literal string delimiter: Indicates that the enclosed charact...

Reading hexadecimal values in English

I've been reading hexadecimal on a digit by digit basis for many years and am now fed up with translating hex values for numbers requiring more than 16 bits into English. Does a more elegant form of translating hexadecimal to English exist? In English, a simple system exists for converting decimal values to English. Decimal 10 is Engli...

How to convert a decimal number to hex string in Perl?

For example I would like to convert 2001 into: "0x07", "0xD1" Thanks ...

Convert number into hex value in .net

Hi, i need to convert integer number to hex value that will look like this: 0x0201cb77192c851c When i do in C# string hex = int.ToString("x") it returns me this: 201cb77192c851c How can i achieve needed result? ...