Все вопросы: [hex]
181 вопросов
encodeHexString objc. Должен ли я поддерживать шестнадцатеричные строки нечетной длины, и если да, то как?
Мне может чего-то не хватать в стандартных библиотеках, но я так не думаю.У меня текущая реализация: int char2hex(unsigned char c) { switch (c) { case '0' ... '9': return c - '0'; case 'a' ... 'f': return c - 'a' + 10; case 'A' ... 'F': ...
Хранение шестнадцатеричных значений как двоичных в MySQL
Я думал о том, как я храню пароли в своей базе данных: правильно подсоленные строки SHA1 в поле CHAR (40).Однако, поскольку символьные данные в нем фактически представляют собой шестнадцатеричное представление 160-битного числа, я подумал, что лучше было бы сохранить его как BINARY (20). CREA...
преобразовать десятичное число в шестнадцатеричный Python
Я создаю сервер на Python, мне нужно преобразовать десятичное значение в шестнадцатеричное следующим образом: допустим, что пакет начинается с 4 байтов, которые определяют длину пакета: 00 00 00 00 если len (packet) = 255, мы отправим: 00 00 00 и далее Моя проблема в том, что иногда размер...
Обнаружение символов Юникода в NSString на iPhone
Я работаю над приложением SMS для iPhone.Мне нужно определить, ввел ли пользователь какие-либо символы Юникода внутри NSString, которые они хотят отправить. Мне нужно это сделать, потому что символы Юникода занимают больше места в сообщении, а также потому, что мне нужно преобразовать их в их ...
В чем именно опасность использования магических значений отладки (таких как 0xDEADBEEF) в качестве литералов?
Само собой разумеется, что использование жестко запрограммированных шестнадцатеричных буквальных указателей - это катастрофа: int *i = 0xDEADBEEF; // god knows if that location is available Однако в чем именно опасность использования шестнадцатеричных литералов в качестве значений перем...
Обнаружение непечатаемых символов в JavaScript
Можно ли обнаруживать двоичные данные в JavaScript? Я хотел бы иметь возможность обнаруживать двоичные данные и преобразовывать их в шестнадцатеричный для облегчения чтения / отладки. После дополнительных исследований я понял, что обнаружение двоичных данных - неправильный вопрос, потому...
Почему это утверждение верно в PHP?
Я не понимаю, почему это выражение в PHP повторяет "whaaa?" - (0x0F | 0xF0) должно быть 0xFF нет? if((0x0FFFFFFF | 0xF0FFFFFF) != 0xFFFFFFFF) echo 'whaaa?';
Создание строки ISO-8859-1 из HEX-строки в Java, сдвиг битов
Я пытаюсь преобразовать HEX-последовательность в строку, закодированную в ISO-8859-1, UTF-8 или UTF-16BE.То есть у меня есть строка вида: "0422043504410442", которая представляет символы: "Test" в UTF-16BE. Для преобразования между двумя форматами я использовал следующий код: private stati...
формат шестнадцатеричного числа c ++
Я пытаюсь вывести шестнадцатеричное значение символа и красиво его отформатировать. Обязательно: 0x01 : value 0x1 Все, что я могу получить, это: 00x1 : value 0x1 // или 0x1, если я не использую iomanip Вот код, который у меня есть, ch был объявлен беззнаковым символом.Есть ли другой спос...
Convert a string with a hex representation of an IEEE-754 double into JavaScript numeric variable
Suppose I have a hex number "4072508200000000" and I want the floating point number that it represents (293.03173828125000) in IEEE-754 double format to be put into a JavaScript variable. I can think of a way that uses some masking and a call to pow(), but is there a simpler solution? A client-...
Convert hex to float
How to convert the following hex string to float (single precision 32-bit) in Python? "41973333" -> 1.88999996185302734375E1 "41995C29" -> 1.91700000762939453125E1 "470FC614" -> 3.6806078125E4
Read In Hex Values (C)
I am currently attempting to read in Hex values from a text file. There can be multiple lines of Hex's and each line can be as long as needed: f53d6d0568c7c7ce 1307a7a1c84058 b41af04b24f3eb83ce Currently, I put together a simple loop to read in the Hex values into an unsigned char lin...
Hex to char array in C
Given a string of hex values i.e. e.g. "0011223344" so that's 0x00, 0x11 etc. How do I add these values to a char array? Equivalent to say: char array[4] = { 0x00, 0x11 ... };
Problem (bug?) loading hexadecimal data into MATLAB
I'm trying to load the following ascii file into MATLAB using load() % some comment 1 0xc661 2 0xd661 3 0xe661 (This is actually a simplified file. The actual file I'm trying to load contains an undefined number of columns and an undefined number of comment lines at the beginning, which is wh...
How can I convert hex strings into numbers in Perl?
I recently wrote a script which parsed a text representation of a single binary byte month field. (Don't ask :-{ ) After fiddling with sprintf for a while I gave up and did this; our %months = qw / x01 1 x02 2 x03 3 x04 4 x05 5 x06 6 x07 7 ...
Common lisp integer to hex conversion
Is there a similar function to (parse-integer "ff" :radix 16) that will take me back the other way? If I have the int 255 how do I convert it to the string ff?
I don't understand how Assembly works with ASCII?
I have a program that's supposed to take values and print them back out. But when the user enters something like 12, (C in HEX) the program prints out some weird letter, that I think is the representation in ASCII. Is there a way to make it save those numbers as raw numbers? I'm doing the input a...
c why does this print a negative number?
I was expecting this to print a very large number and that same number -1 but it just prints -1 and -2, why is this? fprintf(stderr, "%d\n", 0xffffffff); fprintf(stderr, "%d\n", 0xfffffffe);
Search Hex substring in string
Well i got a socket that receives binary data and I got that data into an string, containing values and strings values too. (for example "0x04,h,o,m,e,....") How can i search for an hex substring into that string? I.e. i want to search "0x02,0x00,0x01,0x04". I'm asking for a c++ version of pyt...
Convert hexadecimal string with leading "0x" to signed short in C++?
I found the code to convert a hexadecimal string into a signed int using strtol, but I can't find something for a short int (2 bytes). Here' my piece of code : while (!sCurrentFile.eof() ) { getline (sCurrentFile,currentString); sOutputFile<<strtol(currentString.c_str(),NULL,16)<...
Encoding/decoding REST path parameters
I am trying to find the best way of getting round a design flaw in a web app I'm helping to support. One part of the service passes a parameter ("myparam") to a .jsp page, which in turn calls a REST service including our myparam as a path parameter. The design flaw bit is that myparam should be p...
convert to 3-digit hex color code
I've been using 3-digit hex color values in CSS for a long time: #fff, #999, #069, etc. I can see how the repeating letters/numbers are merged to create a 3-digit hex color code, but I don't fully understand the pattern to be able to write a converter in PHP. Is there documentation for this? Edi...
Is there a C# equivalent to Python's unhexlify?
Possible Duplicate: How to convert hex to a byte array? I'm searching for a python compatible method in C# to convert hex to binary. I've reversed a hash in Python by doing this: import sha import base64 import binascii hexvalue = "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8" binaryval =...
Convert hex to decimal in make script?
A make script is attempting to set a variable as follows: VER_DEC=$( perl -e "print hex(\"$(VER_HEX)\");" ) where VER_HEX happens to have a value of 0a. Perl seems to think that VER_HEX is zero, implying that the variable isn't set (but it is, according to a debug echo in the makefile). Does...
Convert hex to binary
I have ABC123EFFF. I want to have 001010101111000001001000111110111111111111 (i.e. binary repr. with, say, 42 digits and leading zeroes). How?
Method to convert from Hex to Integer in C, can't get lowercase!
Hey everyone, just a quick thing, I have the hex to integer working, but I need to get the numbers lowercase. Here's what I have, any ideas to get to get the A thru F case insensitive? int htoi(char f[]) { int z, n; n = 0; for (z = 0; f[z] >= '0' && f[z] <= 'F'; ++z)...
How to Parse Negative Long in Hex in Java
We have a J2ME application that needs to read hex numbers. The application is already too big for some phones so We try not to include any other codec or write our own function to do this. All the numbers are 64-bit signed integers in hex, when we use Long.ParseLong(hex, 16), it handles positive...
extratinf RGB components frm HEX digit in java
i have color= #12FFFF . that is color in this format where 12FFFF are hexadecima numbers.Now i want to get the each of indepenent R,G,B componetents in decimal. How do i do it in java?
What is the syntax to check for element present using Style in IE
I have the following line that works for Firefox assertTrue(!selenium.isElementPresent("//input[@name=\""+chosen.getField().getName()+"\" and contains(@style, \"color: rgb(255, 0, 0);\")]")); But Fails in IE. When i inspect the field in IE, i see the color style represented in hexadecimal. Ho...