Questions tagged [byte]
A unit of information usually corresponding to 8 bits. This term is also most often used to indicate the smallest addressable unit of storage on a digital system.
7,816
questions
0
votes
1
answer
36
views
How to convert long hex string into byte array (0x69, 0x63, etc. etc.)
I have a long hex string (around 8000 bytes) that I want to convert into what I think is called a byte array. (Please be kind if I've got the name wrong.) In other words, the string begins
69636E etc.
...
1
vote
0
answers
32
views
Python bytes to dict with Node.js PSON-like pairs
I was rewriting some decode JS functions in python for base 64 strings from one web game and encountered this one:
const stateDecode = function(rawdata) {
let ISpsonpair = new PSON....
-1
votes
1
answer
85
views
Delphi - Sending Byte to DLL
I am attempting to work with an API and am communicating with this function:
BOOL SelectSpeed (int Device, byte SelectSpeed)
With the argument for SelectSpeed expected to be values such as 0x01 or ...
0
votes
0
answers
21
views
unpack requires a buffer of X bytes
field_names = []
for i in range(obj["fields_cnt"]):
print(i)
name_len = struct.unpack('H', f.read(2))[0]
print(type(name_len))
print(...
0
votes
0
answers
50
views
Is it correct to remove an escape key when decoding bytes?
I have the following small dataframe that I am passing through a decoder that decodes some byte values in the dataframe:
import pandas as pd
import numpy as np
dict = {'trade_qualifier' : [b'\x86', b' ...
-1
votes
1
answer
52
views
How to use bytes (encode/decode) in Protobuf (C++)?
Lets say I have a simple Protobuf message like:
syntax = "proto3";
package package;
message WriteBlock
{
uint32 address = 1;
uint32 size = 2;
bytes data = 3;
}
Now I create a ...
0
votes
1
answer
87
views
16 bit register converting to two 8 bytes using vb.net in visual studio
converting the 16 bit data to 8 bit and then reversing it back to 16 bits
Module Module1
Sub Main()
' Original 16-bit data
Dim originalValue As UShort = &HA91
' Split ...
0
votes
1
answer
42
views
How to convert string to byte string in python?
I want to convert a variable string in hex format to a byte string in python?
Example:
string = 'b36372908bd6f0b5898a38879c7d88436590c3e786568db84a3948408e81b4c6'
to byte string = b'\xb3cr\x90\x8b\...
-1
votes
0
answers
29
views
object repr : TypeError("a bytes-like object is required, not 'str'")
I'm on python3.12. While I run this tool: https://github.com/Lucifer1993/AngelSword
I get the following error.
How can I fix this error:
pegasus@pegasus:~/Documents/AngelSword$ python3 AngelSword.py
/...
0
votes
1
answer
56
views
Is there any way to construct a code object from a code string and assign it to an existing function using Python?
My problem is like this: I need to change how a function behave, but I can't access or change the file with which the function is located. I could import it though, and I would like to change the ...
0
votes
0
answers
27
views
Byte order from Modbus request
I'm trying to read out a Modbus register over TCP, which seems to be working fine, however the response and the byte order are not making sense to me. I'm using JavaScript and the jsModbus library to ...
-1
votes
1
answer
62
views
Why does b'\x30' show up as 0?
If I try to output print(b'\x30') it shows as 0. Similarly b'\x31' is displayed as 1, etc. I need this byte string (class ) to be displayed, but with ONLY one backslash.
I tried
s = br"\x30"
...
-5
votes
0
answers
36
views
What is the difference between single quote and double quote in GOlang? [duplicate]
This works where ch is a byte
return 'a' <=ch && ch <='z' || 'A' <=ch && ch <='Z' || ch =='_'
but this does not
return "a" <=ch && ch <="z&...
-1
votes
1
answer
43
views
Where to find jdk sources for JNI_CreateJavaVM?
I'm trying to understand better how jvm works, and I was trying to find the main function that really interested me - the JNI_CreateJavaVM function. I wonder how it parses java bytecode, but I can't ...
-1
votes
1
answer
66
views
XOR bytes in c#
I saw a neat way to swap 2 variables using XOR lately and decided to try that in c# with strings, and though I managed to do that I'm a little worried that I have to cast int into byte after the XOR ...