Questions tagged [parity]

A parity bit, or check bit, is a bit that is added to ensure that the number of bits with the value one in a set of bits is even or odd. Parity bits are used as the simplest form of error detecting code.

A parity bit, or check bit, is a bit that is added to ensure that the number of bits with the value one in a set of bits is even or odd. Parity bits are used as the simplest form of error detecting code.

There are two variants of parity bits: even parity bit and odd parity bit. In case of even parity, the parity bit is set to 1, if the number of ones in a given set of bits (not including the parity bit) is odd, making the number of ones in the entire set of bits (including the parity bit) even. If the number of ones in a given set of bits is already even, it is set to a 0. When using odd parity, the parity bit is set to 1 if the number of ones in a given set of bits (not including the parity bit) is even, keeping the number of ones in the entire set of bits (including the parity bit) odd. when the number of set bits is odd, then the odd parity bit is set to 0.[1]

236 questions
0
votes
1 answer

parity check in matlab and FPGA board

as the code shown, s = serial('COM3','BaudRate',115200, 'Parity', 'odd','DataBits',8,'StopBits',1); fopen(s); I add the parity check function in the serial port communication in Matlab. I create the serial port to send data to a FPGA board. In the…
Mr.Z
  • 1
0
votes
0 answers

What is an efficient to find if a given sub sequence exists in an infinite sequence?

There is an infinite sequence b, such that b[i] = 1 , if the binary representation of i has odd number of 1s, and b[i] = 0 , otherwise. Given a sub sequence of 0s and 1s, I am required to find the starting index of a match, if one exists or state…
user3760100
  • 679
  • 1
  • 9
  • 20
0
votes
2 answers

how to perform xor operation correctly?

i have a binary string and i would like to perform a xor operation consequentially on several bits of that string. my string is : 011001100011100000000011 i am trying to perform the calculation using the next line of code: private String…
user4559332
0
votes
1 answer

Regex even parity

I'm trying to make a regex that will match with a number whose sum, it's parity, is even. So 802 (8+0+2) is even, and 902 (9+0+2) is odd. Apparently there is an arithmetic law to do this Regex without counting, or breaking any of Regex's rules. I've…
0
votes
0 answers

non-boost asio checking for errors c++

Is there a way to check for errors in a non-boost asio program using tcp? And is there a way to add an error to the connection randomly? I made a simple Echo Server in C++ for which i now have to generate random errors, but the problem is that i…
Patrick
  • 123
  • 2
  • 10
0
votes
0 answers

TCP Client/Server with two dimensonal parity bit c++

I got a problem there with which you can hopefully help me. I need to programm a TCP Client and Server using asio http://think-async.com/ and streambased in-output. However I also need to error check using two dimensional parity bits (DATA,ACK,NAK)…
Patrick
  • 123
  • 2
  • 10
0
votes
2 answers

Character conversion errors when using Pyserial

I've been writing a script that pulls data from a serial device at regular intervals. I've got everything working, except that the responses I receive from the device contain many question marks. Since the formatting is correct on what I'm getting…
oirectine
  • 139
  • 8
0
votes
1 answer

Parity bit checks using General Hamming Algorithm

In a logic circuit, I have an 8-bit data vector that is fed into an ECC IC which I am supposed to develop the logic for and that contains a vector of 5 Parity Bits. My first step to develop the logic (with logic gates, XOR), is to figure out which…
Cesar A
  • 663
  • 1
  • 7
  • 10
0
votes
1 answer

Reversing encryption algorithm that XORs each character with another in the string, using parity to control offset

I've reversed the following algorithm from a challenge binary I'm investigating: def encrypt(plain): l = len(plain) a = 10 cipher = "" for i in range(0, l): if i + a < l - 1: cipher += chr( xor(plain[i],…
Juicy
  • 11,840
  • 35
  • 123
  • 212
0
votes
1 answer

Changing output into 4x4 matrices

So I'm working on a method in Java that basically takes a random string of letters then goes through the method and changes the string into parity bits, which is basically converting each character to its numeric value in binary. This is what I…
L.redir
  • 65
  • 1
  • 2
  • 9
0
votes
1 answer

CRC, parity bit, checksum

Given 2 bytes of data, let say I've 2 bit error. Which one will be the best to use to detect the error? 1D parity bit where one bit is computed for every byte in the data, or 8 bit checksum computed from every byte in the data, or CRC 8 scheme…
Alicia Soh
  • 67
  • 1
  • 1
  • 5
0
votes
4 answers

Calculate parity bit from a string in C

I am trying to calculate the parity bit in a string using the following code. I first calculate a parityByte for the string and then calculate a parityBit for that byte. From what I have gathered, these functions should do the trick, but right now…
user2288240
  • 1
  • 1
  • 2
0
votes
1 answer

Why my smart card accepts two different keys as its MAC key?

As you see below, I tried to list installed applets on my card using gp -list. I specify some different key: GP: gp -mac 404142434445464748494A4B4C4D4E4F -list AID: A000000151000000 (|....Q...|) ISD OP_READY: Security Domain, Card lock, Card…
Jean
  • 687
  • 1
  • 9
  • 25
0
votes
0 answers

The number of 1’s that are in the same position in Num and Parity Mask

I am giving a function to write as part of my program that takes as input a short integer num, and a short integer parity mask. The function then return the number of 1’s that are in the same position in num and in the parity mask. for example, if…
user3055141
  • 109
  • 1
  • 2
  • 8
0
votes
0 answers

64 bit Compute Parity Returning Strange Answer

I am trying to find the parity of numbers using a simple loop that checks each set bit and increments a counter. I seem to have an extra bit though at addresses outside of 32 bits. For example, when trying to find the parity of 1, which should be…
aaron-prindle
  • 3,077
  • 1
  • 17
  • 15