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.

Filter by
Sorted by
Tagged with
-1 votes
0 answers
28 views

converting hex string to bytes and sending it through serial (python)

I'm having trouble sending 6 hex values (example: 02 00 0a 51 03 60) as bytes through usb with python. I need this to open locks by sending commands to a control board by usb. I've managed to get this ...
VtheWizard's user avatar
0 votes
0 answers
23 views

How to connect input connectors from the outside?

I am quite new to Modelica, so perhaps my question is a basic one. I do have a model for a combustion chamber, with 3 ports (or connectors): 1- AirPort (which provides the model with the Medium (in ...
AaronModelica's user avatar
0 votes
0 answers
37 views

Reading hex data from a .bin file returns FFs at the start of the string

I am trying to read the HEX data of a .bin file to a string. At the start of the string there is a bunch of FFs and after that the actual data starts. I want to only read the data that the .bin file ...
Shmurkio's user avatar
0 votes
1 answer
115 views

Why do string-to-int functions (e.g. strtol(), atoi(), sscanf()) keep returning 0 when given array of hex values?

Problem: I am making a file interpretation program that needs to read/write Hexadecimal values. At times, there will be a section of hexadecimal that needs to be read as one long hex value, rather ...
Primitive's user avatar
  • 101
-1 votes
0 answers
40 views

how to create psbtBid(hex) to buy NFT ordinals (unisat)

on unisat (selling NFTs) I can’t implement the purchase of NFTs in python. Problem: I don't understand how to create psbtBid(HEX). Also, in order to understand what it consists of, I tried to decipher ...
mihasi's user avatar
  • 1
1 vote
5 answers
219 views

Generating hex value depending on size of size_t

I'm trying to generate a value denoting an invalid address. On 32-bit platforms, I want the value 0xaaaaaaaa. On 64-bit platforms, I want 0xaaaaaaaaaaaaaaaa. Is there a way to do this without using ...
cleong's user avatar
  • 7,328
2 votes
0 answers
26 views

How does U16 function of pwn (CTF) library works?

I am trying to solve uni challenge in Python, the challenge is located in CTF server (using pwn library to connect). I can interact with the server by sending keys, for example: 1-help, 2-read info ...
Mariia Kloss's user avatar
0 votes
0 answers
34 views

Hex value converts to wrong code in Python

I'm trying to use Python to send Byte stream commands to an RFID Module. The device requires an example command: b'\xa0\x06\x01\x72' When I save this and print it to the console, it shows instead as: ...
Paul Bernard's user avatar
0 votes
0 answers
16 views

How do I represent a 32 bit binary by using 8 characters?

I'm looking at memory addresses which are 32 bits. How do I represent them using 8 digits/characters - such as '0x12345678'? How many bits does each character represent? What is this system called? ...
winterlyrock's user avatar
0 votes
1 answer
56 views

Doubts for beginners in Python. How do I convert an array with hexadecimal values ​to bytes?

# Recebe o número de 4 dígitos como input number = input("Digite o número da Conta com 4 dígitos: ") # Converte cada caracter em uma string e armazena em um array number_array = list(number)...
dev-python's user avatar
0 votes
0 answers
42 views

MD5 output different after the first round

I am testing the MD5 algorithm, and the code is as follows: int main(int argc, char **argv) { char *msg; size_t len; int i; uint8_t result[16]; uint8_t buf[16]; msg = "...
rocky's user avatar
  • 1
0 votes
0 answers
57 views

Python write() not writing the full string

So I made a script where you put hex data in for something like an image or an audio file inside a variable and it then copies it into its own file (self extracts). However it doesn't work with a file ...
YupYupTRP's user avatar
0 votes
1 answer
79 views

how to convert string of unicode to string of hexa in c++

I have this sample of code, which aims to write some data in a stream so I later can read it again. std::ostringstream oss; int a = 10; oss.write((char*)&a, sizeof(int)); a = 5; oss.write((char*)&...
LPo's user avatar
  • 67
0 votes
2 answers
158 views

mod of two big hex numbers in c++ [duplicate]

i have two large hex numbers each one at least 70 digits (in decimal) and i am trying to calculate the value hex_a%hex_b: string hex_a="1133A5DCDEF3216A63EB879A82F5A1DC4490CCF6412492CF1B242DB&...
A D's user avatar
  • 33
-1 votes
1 answer
50 views

Converting large integer (uint64+) into hex

While importing things into bigquery my hex strings got converted into float. I understand I need to fix the import but I'd like to do a best effort recovery of some of the data. I'm trying my best to ...
yingw's user avatar
  • 194
0 votes
1 answer
37 views

Convert HEX string that contains ASCII characters

I'm having trouble with decoding data (or maybe encoding on send) from scapy. I'm attempting to send some UDP HEX data with scapy then decode it back to the original form, but the HEX string received ...
B3st0fth3w0rst's user avatar
1 vote
1 answer
131 views

Convert .GRF to Image File in Java

I have a Java program that takes a ZPL Graphic Hexcode (.GRF) as input and should generate a JPG or PNG image from it. I have a rough approach, but it doesnt quite work as expected and I dont think ...
malz's user avatar
  • 89
0 votes
1 answer
23 views

Charset Conversion € \x80

I'm sure I'm missing something obvious here but I have a string that at a certain point has the € and I know that this means the next section repeats 128 times or if the character is 7 then it repeats ...
Hilton Siegert's user avatar
2 votes
1 answer
94 views

Why does PRIx64 print "lx" instead of 16 hex chars?

We've run into an issue at work where we were not able to use the "portable" types from <inttypes.h> (PRIx64) to correctly print a 64-bit unsigned integer in hexadecimal format. ...
DarkFranX's user avatar
  • 460
-1 votes
0 answers
23 views

BYTES to FLOAT in BigQuery

I'm working on a project where I have a field containing values in BYTES format, for example, field.value = 'AA=='. I need to convert these values to numbers. How can I achieve this in BigQuery ?Could ...
Taher Zoghlami's user avatar
2 votes
3 answers
79 views

How to output a hex value but not as a string or int in Python?

I have a function (not my own) that needs a hex value in the format 0x****** for a color value. The function that I have takes RGB values and converts them into hex, but outputs it as a string. Is ...
Crashzen's user avatar
1 vote
4 answers
202 views

How to convert a hex string to decimal in c

So I have been learning the C Programming Language by Kernighan and Ritchie. In chapter two, exercise 2.3 the htoi function which converts a string of hexadecimal digits to equivalent integer value ...
devMe's user avatar
  • 166
0 votes
0 answers
21 views

Recoloring 16x16 Sprites to Nearest Color in Custom Palette

I have a folder containing a collection of 16x16 pixel sprites, and I'd like to recolor each sprite by replacing its colors with the nearest matching color from a custom palette I obtained from https:/...
Yung_Coco's user avatar
2 votes
3 answers
106 views

How to write standard output in hexadecimal of a pointer address using write()

In a task I need to print the address of a pointer in hexadecimal into the standard output. The issue is that I am only allowed to include unistd.h so no printf is allowed. I have tried to cast it ...
arzel's user avatar
  • 35
0 votes
2 answers
37 views

How to join two Hex values c1 and 32 to get decimal of 49458?

im back and have made some progress :) im trying to join two hex values for example: c1 and 32. In decimal it should be 49458 this is my python code thus far. ComPort = serial.Serial("COM3",...
KurtA's user avatar
  • 43
0 votes
3 answers
91 views

Need more performant hex2bytes bytes2hex encoding/decoding

I write an encryption library which uses AES256 CBC based on openssl (libcrypto.so). My library is written in C++ (C++11, actually) Profiling with valgrind shows, that the encryption/decryption is ...
svebert's user avatar
  • 239
0 votes
0 answers
16 views

Is there a way to define template with optional structure for hex editor?

In my work, I often need to look at messages in binary format from various devices. So I decided to look for a program that can show raw binary data and parsed data representation of it. Also, it ...
Kirill Moskalew's user avatar
0 votes
2 answers
137 views

print as HEX (0x) or Decimal depending on value without if statements - how to?

I am trying to print an integer and its formatting should be %d decimal unless its of value FFFF in which case it should be printed as 0xFFFF. I am unable to do so without unnecessary if and else ...
Madhu Narayanan's user avatar
0 votes
1 answer
39 views

How to parse 6-digit hexadecimal integer from String in dart?

I can't find a way to parse a string like '0xFFBBD1F0' to the integer 0xFFBBD1F0. Actually I just need to create a Color having only '0xFFBBD1F0' string. I needed to create a Color from String I got ...
SinBar Art's user avatar
0 votes
2 answers
56 views

I need to create function which take value from string and edit numbers

I have this string 03.00.20.80.0F.00.00.68.98.01. last two bytes 98.01. have information about temperature. I need to create JavaScript function which convert two last bytes from hexadecimal number ...
Marek Prachař's user avatar
1 vote
2 answers
128 views

Hexstring to img conversion

I'm using an arduino board to take a picture and it returns a HEX string. I've tried numpy, openCV, binascii and others but i'm not able to convert and save this image in RGB like a picture. I get an &...
Gdy's user avatar
  • 13
1 vote
1 answer
40 views

How do you set new values to every address you find in gdb with "find" at once?

Is there some loop syntax I could use? I'm searching for values at addresses with the find command, but rather than manually changing the values at each address it finds one at a time, I'd like to ...
Nathan Moyer's user avatar
-1 votes
1 answer
53 views

Using HEX values in a Case statement

Hi I am trying to use a remote for a project I am doing. I have input the remote HEX values within the case statement, however I am getting an error that states 'error: duplicate case value'. I am ...
matt_soton's user avatar
1 vote
1 answer
103 views

Reading HEX formatted private key back into OpenSSL

I generate an ED25519 key-pair: $ openssl genpkey -algorithm ed25519 | openssl pkey -text -----BEGIN PRIVATE KEY----- MC4CAQAwBQYDK2VwBCIEIEp53xeY8qoDU5mi2h7O//pJnI5CXWHWI9SVhgjKq1kt -----END PRIVATE ...
user569825's user avatar
  • 2,381
0 votes
1 answer
88 views

Condition as sum of hexadecimal numbers in old Pascal code

I've got a very old Pascal program. At the top of the unit is a set of constants looking like: feature1 = $01; feature2 = $02; feature3 = $04; feature4 = $08; feature5 = $10; In database there is ...
KarolC's user avatar
  • 41
0 votes
1 answer
91 views

Problem with freeing up memory (for a class containing a custom vector)

#include "../include/Hex.hpp" int main() { Vector<unsigned char> a{'1', '2', '3', '4'}; Vector<unsigned char> b = a; b.resize(2); a.resize(6); a = b; } If I'...
Aleksandr Dots's user avatar
0 votes
2 answers
82 views

Convert values inside bracket into binary forms by using python

there's a sample input file as follows(input1.txt) (For your information, 4'hF means its value is 15 by decimal and it is binary 4 bits and its value is 1111 as binary per each bit. So, 4'hF is same ...
kts's user avatar
  • 107
0 votes
3 answers
71 views

JAVA: The input is hexadecimal numbers in string representation, for example "0xaf12". The task is to add the value of this number to the array (int)

The problem is that there is no way I can take the int value of this hexadecimal number and put it there in its hexadecimal form. But, if I convert it to a decimal value, then all values starting from ...
Timofey's user avatar
0 votes
1 answer
58 views

Mac absolute time from Hex

I'm trying to convert a time stamp from an iPhone database that's stored in Hex as part of a Python script. I have searched online and been unable to find how it's done. An example of the time stamps: ...
Crtaylor26's user avatar
1 vote
1 answer
59 views

Wrong emoji unicode

When I want to convert this emoji: 😶‍🌫️ I get only a part of the wanted unicode: U+1f636 instead of U+1F636U+200DU+1F32BU+FE0F I tried using String.prototype.codePointAt(0).toString(16) But it give ...
Shire Dev's user avatar
-1 votes
1 answer
52 views

12 bit 2's complement of hexadecimal (0DE and EDA)

I'm working on DPS310 pressure sensor using STM32F042F4P6, in which to calibrate the temperature, temperature coefficient is to be read (which is in 2's complement of 12 bit), I successfully read both ...
Anubhav Shriwastava's user avatar
0 votes
0 answers
29 views

My Convert_to_Hex function in C modifies previously converted variables [duplicate]

I have three char arrays each filled with 32 chars. I'm trying to convert each of them to HEX and store them in a 64 byte char array. The first char array, ai_values_temp get converted normally and ...
Murad Bashirli's user avatar
0 votes
0 answers
17 views

How to deal with 4 bit 7 segment display drivers making a decimal counter?

I need to make a 7 digit TTL pulse counter. Lets not focus on the details, but my exact problem is how to deal with the hex to decimal conversion in 7 segment display drivers. Every 7 sd drivers IC ...
Vilius Žalėnas's user avatar
0 votes
0 answers
8 views

Byte array conversion clarification? [duplicate]

I am trying to create byte array of three bytes. data = 0xee55 bi = bytearray(3) bi[0] = 0x01 # register for speed bi[1] = data & 0xFF # first byte of speed data bi[2] = (data >> 8) & ...
petrbon's user avatar
1 vote
2 answers
144 views

Converting a decimal to binary in C

Edit: Sorry for the weird format, I'm still new to Stackoverflow but here is the actual main method that is supposed to be printing out the conversions. I've left out the hexadecimal part in the main ...
s1mple's user avatar
  • 11
0 votes
2 answers
27 views

Python how to write in binary mode a list of hexadecimals?

I have a string of hex representations of text that I need to write to a file. toWrite = "020203480A" with open("example.bin", "w") as file: file.write(chr(int(...
mine_greg's user avatar
2 votes
2 answers
63 views

Parsing a long hex string into individual bytes and store it in std::vector<unit_8>

Iam trying to split a long hex string into individual bytes and store it in an integer vector using a CPP program. For example, my input string will like 09e1c5f70a65ac519458e7e53f36 and my expected ...
Vijayakumar Sargunam's user avatar
-1 votes
3 answers
33 views

Merge of 8-bits data into 16-bits giving wrong result for a specific number all the time

I'm getting some 8 bit data from a sensor and trying to merge it into 16 bits. But my code on stm32, doesn't work on 0x63 and 0x91 values. All the other values working except these. Result is 0x6291. ...
Elecrain's user avatar
0 votes
1 answer
55 views

How to get data in hexadecimal format using Perl and the Google::ProtocolBuffers module

It is necessary to read data in hex format #!/usr/bin/perl -w use Google::ProtocolBuffers; use File::Slurp qw(read_file write_file); Google::ProtocolBuffers->parse(" message TestMessage {...
glen danzig's user avatar
0 votes
1 answer
85 views

Reading data from electricity meter with Rs485

I want to read the data from the electrical meter I bought via RS485. In principle, I can receive it with 300 baud rate, but I cannot receive it with 9600 baud rate. I need to try hex codes with ...
Ferhat's user avatar
  • 1

1
2 3 4 5
194