5 Topics

Member Avatar for
Member Avatar for ihatehippies

I'm soliciting advice for performace improvements for creating a weak checksum for file segments (used in the rSync algorithm) Here's what I have so far: def blockchecksums(instream, blocksize=4096): from hashlib import md5 weakhashes = [] stronghashes = [] for chunk in iter(lambda: instream.read(blocksize),""): a = b = 0 l = …

Member Avatar for ihatehippies
0
243
Member Avatar for trd360

The instructions are long but here goes. The starting code they provided me is after the instructions. The bar codes used on products in a store are visual encodings of Universal Product Code (UPC) numbers. For example, 036000291452 is a UPC code (in this case for a box of tissues). …

Member Avatar for ken_taiken
0
354
Member Avatar for debasishgang7

Hi all, I am trying to calculate checksum of some data using python. I am putting a sample ICMP header here and the correct checksum of that packet(Got this by sniffing network with wireshark) [B]DATA is "08 00 69 eb 8e 13 00 01" And the correct checksum is "0xa9eb". …

Member Avatar for debasishgang7
0
398
Member Avatar for _neo_

I need to convert this C code to python. void GetChkSum(Int len, PSTR buf, PSTR res) { memset(res, 0, 4); for(int i=0; i<len; i+=4) { res[0]^=(buf+i)[0]; res[1]^=(buf+i)[1]; res[2]^=(buf+i)[2]; res[3]^=(buf+i)[3]; } res[0]=~res[0]; res[1]=~res[1]; res[2]=~res[2]; res[3]=~res[3]; } In my case, buf is bytes object. for example: buf = b'00000001TXBEG 0000' len is …

Member Avatar for _neo_
0
319
Member Avatar for waleed.makarem

Dear All , I need your support to convert the below C++ 6 lines code to C# or vb.net . this function calculates the checksum for a given text. GUCHAR GenerateCkSum(GUCHAR *pure_data, U2 size) { GUCHAR chksum; I2 i; chksum = pure_data[0]; for(i=1; i<size ; i++) chksum ^= pure_data[i]; return …

0
84

The End.