Skip to main content
Filter by
Sorted by
Tagged with
5 votes
2 answers
101 views

Background I am trying to decode a bitstring from a QR-Code, where the data was encoded in numeric mode. According to this QR-Code tutorial: https://www.thonky.com/qr-code-tutorial/numeric-mode-...
Immanuel Neumann's user avatar
1 vote
0 answers
85 views

I'm using ProVerif 2.05 for modeling cryptographic protocols, but I'm running into errors when performing bitwise operations with the XOR function. The error tells me that I have a type mismatch when ...
kw33n's user avatar
  • 11
2 votes
3 answers
135 views

I am trying to return the result of casting a single precision float to an int just from its bit string. I correctly grab the sign bit, exponent and mantissa from the bit string but I am unsure how to ...
tothemax's user avatar
  • 115
-1 votes
1 answer
190 views

The question is, given two bitstrings A and B, determine whether you can reach B from A using the following operation: Choose two indices i,j such that the values at both indices are the same, and the ...
Joseph Bendy's user avatar
2 votes
1 answer
503 views

Given a string such as "0110", how do I convert this to a bitstring containing the binary values represented by the string? I checked the Base module, but it's based on RFC 4648 and is not ...
Adam Millerchip's user avatar
-2 votes
1 answer
70 views

I have a piece of hardware that for instance returns the "response" below. Per the instructions, I would like to separate the response to the 1st and last 4 bits. But the lower bit response ...
Deschutes's user avatar
2 votes
1 answer
47 views

I want my class to inherit the BitArray class but I'm running into a problem in the constructors. I have several positional and keyword arguments I want to use in the child but the first positional ...
bembrin's user avatar
  • 31
2 votes
2 answers
195 views

I receive serialized DDR data from a setup with 8 chips. Due to the way the readout is implemented in hardware, the data that is received by the computer has the following structure: bits 0 and 1 of ...
Christian Disch's user avatar
1 vote
2 answers
1k views

I am using bitstring to perform an xor operation on the ith bit of a string: string = bitstring(string ⊻ 1 <<i) However the result will be a string, so I cannot continue with other i. So I want ...
Nikola Tolzsek's user avatar
2 votes
4 answers
540 views

My problem is as follows. I am generating a random bitstring of size n, and need to iterate over the indices for which the random bit is 1. For example, if my random bitstring ends up being 00101, I ...
adrien_vdb's user avatar
1 vote
0 answers
36 views

Given x as searched integer and k as minimum zeros between 2 ones. Example: x := 7,k := 0 Binary represention: 111 x := 7,k := 1 Binary represention: 1010 x := 7,k := ?(>1) Binary represention: ? ...
TTho Einthausend's user avatar
0 votes
0 answers
48 views

create a circuit of 5 qubits qr = QuantumRegister(5, "qr") # quantum bit register cr = ClassicalRegister(5, "cr") # classical bit register circuit = QuantumCircuit(qr, cr) # all ...
owais ishtiaq's user avatar
1 vote
0 answers
43 views

I have created a sequence of bitstring. Now I want to calculate the identical bit positions all sequences one by one. I don't understand how to find it. S1: ...
owais ishtiaq's user avatar
1 vote
0 answers
3k views

I'm on Windows and working on a python file from a cloned gitHub repository. When trying to do import bitstring as bs I get this error: ModuleNotFoundError: No module named 'bitstring' But "pip ...
Alessandro's user avatar
0 votes
1 answer
444 views

How do I read a file and turn it to a RAW bit string? For example I open an image that is 512kb, It reads the file byte by byte, and it spits out the long bit string that is the file? I would like to ...
Pedro Paulino's user avatar
0 votes
2 answers
346 views

I would like to generate a set of randomly generated bit strings with a certain length N, but I would like to ensure that the sum of each bit string adds up to a certain number, say $k$. How would I ...
haggisman18's user avatar
5 votes
1 answer
151 views

If we have a given predicate p :: [Bool] -> Bool that take an infinite list as parameter and return True or False based on some unknown conditions, and we have no idea what this predicate is. Can ...
lucas's user avatar
  • 53
1 vote
2 answers
327 views

I need to pack information as closely as possible into a bitstream. I have variables with a different number of distinct states: Number_of_states=[3,5,129,15,6,2]# A bit longer in reality The best ...
Okapi575's user avatar
  • 718
2 votes
0 answers
107 views

Given the type of bitstrings in Haskell: data Bits = O Bits | I Bits | Nil Are there compression algorithms that have satisfactory results (specially when it comes to repeated substrings), that are ...
MaiaVictor's user avatar
  • 53.4k
1 vote
3 answers
760 views

# Erlang/OTP 24, Elixir 1.12.3 bmp_signature = <<66, 77>> #=> "BM" <<^bmp_signature, _::binary>> = <<66, 77, 30, 0>> #=> ** (MatchError) no match ...
kinkou's user avatar
  • 311
0 votes
1 answer
301 views

I've encoded an 8x8 block of numbers using RLE and got this string of bits that I need to write to a file. The last coefficient of the sequence is padded accordingly so that the whole thing is ...
user avatar
2 votes
1 answer
77 views

I'm trying to convert a string to a byte, thats what I've done. I want to send out a Modbusprotocol via serial and put it together in bitstring: tiger = '01' read = '03' ac_val = '0031' word = '0002' ...
Tec_Ley's user avatar
  • 23
0 votes
0 answers
159 views

I am working with bitsets std::bitset<29621645> (i.e. with sizes of 29621645 bits) in C++. Each bitset fills around 29MB, which is a lot. I fell over a library called sdsl which have their own ...
GoldenRetriever's user avatar
2 votes
1 answer
71 views

Just looking for some clarification on this homework question The bitshift operation is ((1010 & ~(1 << 3)) So it's a left shift by 3 which would then be 0000, but with a the not, would it ...
Jack Facer's user avatar
0 votes
2 answers
473 views

I am working on a compressor which compresses text files using Huffman coding in C++. After I perform the encoding, I get a bitstring(assume arbitrary length or say length = 2611) which represents the ...
ritvix's user avatar
  • 17
0 votes
1 answer
2k views

I have an ArrayList of Bytes. Firstly, when i print them i see integers? And the second thing is, i want to convert each Byte to a Bitstring and add it to a new list of bitstrings. How do i do that as ...
Shiverello's user avatar
1 vote
1 answer
2k views

I am new to python. Here is what I am struggling to implement. I have a very long bit string "1010101010101011111010101010111100001101010101011 ... ". I want to write this as bits and create a binary ...
Karthik k's user avatar
1 vote
3 answers
1k views

i am in the process of converting some cython code to python, and it went well until i came to the bitwise operations. Here is a snippet of the code: in_buf_word = b'\xff\xff\xff\xff\x00' bits = 8 ...
Emil Bengtsson's user avatar
0 votes
1 answer
2k views

I have a function that receives a list of strings and concatenates each string into a new string, i do that using Enum.join. But when i try this operation, i get the following error: ** (Protocol....
Giezy Ramírez's user avatar
4 votes
7 answers
5k views

I have value of the type bytes that need to be converted to BIT STRING bytes_val = (b'\x80\x00', 14) the bytes in index zero need to be converted to bit string of length as indicated by the second ...
user3206440's user avatar
  • 5,139
0 votes
1 answer
152 views

This is the code from geeksforgeeks which generates and print bitstrings of n bits but I want to know instead of printing the array, how can I store the values of the array or return it so I can use ...
robot11's user avatar
0 votes
2 answers
184 views

The OssBitString takes in string length (in bits) and a const unsigned char* as parameters. However, when I convert the input std::string to const unsigned char* and pass it to OssBitString, the ...
Phoenix's user avatar
0 votes
0 answers
97 views

The OssBitString takes in string length (in bits) and a const unsigned char* as parameters. However, when I convert the input std::string to const unsigned char* and pass it to OssBitString, the ...
Ram's user avatar
  • 1
0 votes
1 answer
257 views

count all distinct binary strings without two consecutive 1's I tried to convert bottom-to-top dynamic programming approach(mentioned in the link) to recursive relation but could not able to get the ...
dks's user avatar
  • 19
2 votes
1 answer
1k views

Suppose we have to solve a global optimization problem in which we have to find values of 5 variables, all of which are integers. Assume we get following two parent chromosomes, Parent 1: 6, 10, 3, 5,...
Avinash's user avatar
  • 415
1 vote
1 answer
292 views

I am using a BitArray in my python script, and I was wondering if there is a way to change the indexes order of the BitArray that I create. Right now the indexes are from 0 to N-1 where N is the ...
LearningEveryday's user avatar
0 votes
1 answer
674 views

I have a file with text and binary. Text is used to identify beginning and end of a chunk of binary data, which represents a list of complex numbers, e.g. (1.5+5.6j)(...). I have implemented the ...
rebrid's user avatar
  • 440
0 votes
0 answers
112 views

I need to process all binary files(PE32) from a folder. I'm looking to extract a specific string from each of these executables. The strings are sometimes found in little-endian, in some files they ...
Syntyche Ackerley's user avatar
5 votes
2 answers
548 views

Given an n-bit vector and an integer k, 1 <= k <= n, we have to maximize the number of ones in it by applying the following operation any number of times(including zero): Choose exactly k bits(...
Manish Chandra Joshi's user avatar
0 votes
0 answers
204 views

I took a String e.g. "hello" and made it a byte array (str.getBytes()), now I want to take a selection of bits e.g. 5,17,26,...(up to 4 bytes/32 bits) of the byte array made of 8 bit bytes and ...
user avatar
2 votes
3 answers
2k views

I'm working on a tool generates dummy binary files for a project. We have a spec that describes the real binary files, which are created from a stream of values with various bit lengths. I use input ...
corvidism's user avatar
  • 201
0 votes
1 answer
2k views

I am working on a program that is creating IRIG106 Chapter 10 data for a cube-sat project. Currently it is being implemented in python and I am having difficulty implementing the final component of ...
badrobit's user avatar
  • 803
0 votes
2 answers
4k views

This code accepts a bitstring and converts it to a character string. The bitstring comes from a txt file that's read into the client, converted to bitstring then sent to the server. def getChar(...
B.Uriah's user avatar
  • 47
-1 votes
1 answer
1k views

My XOR accepts two bitstrings and returns the XOR value of those two strings. I don't think the getXor function is reading the bitstring as integers and I've tried making changes but I'm not certain ...
B.Uriah's user avatar
  • 47
3 votes
1 answer
277 views

While I know how to generate all (n choose k) bitstrings of size n with exactly k bits set to one, I'm struggling finding a bijection, that gets as input a number i between 1 and (n choose k) and ...
Memphisd's user avatar
  • 317
0 votes
1 answer
2k views

The goal is to convert a bitString into a plain text using Huffman code table, r=000 h=001 o=01 w=100 d=1010 e=1011 l=11 I stored the Huffman code table in two different String[] arrays: String[] ...
Anderson's user avatar
0 votes
1 answer
912 views

I have been trying to figure out how to send a bitstring through python 3 using the serial module. Initially when I tried to serial.write it, it was sending the ascii code for 1 and 0. I'm new to ...
SugarBooty's user avatar
0 votes
1 answer
3k views

Say for instance, you have an 8-character string representing an 8-bit byte; i.e '00000000' (0) and you want to flip a single bit, to make it '00010000' (16). What's the best or most elegant way to ...
voices's user avatar
  • 555
1 vote
2 answers
703 views

I have a bitstring of the form bitstring = <<18::6,8::4,2::5,16::5,18::6,3000::16,0::4>>. I want to render but poison or Jason doesn't seem to be rendering. What is the best way to render ...
Tanweer's user avatar
  • 567
1 vote
0 answers
1k views

When using this code import bitstring f = 1.0e+00 b = bitstring.pack('>d', f) b.bin I get 64 bits 001111111111000000000000000000000000000000000000000000000000000 But I need to get Float (IEEE754 ...
Salma El-Sokkary's user avatar