checksum

Generating one MD5/SHA1 checksum of multiple files in Python

笑着哭i 提交于 2019-12-10 10:55:15
问题 I have looked through several topics about calculating checksums of files in Python but none of them answered the question about one sum from multiple files. I have several files in sub directories and would like to determine if there was any change in one or more of them. Is there a way to generate one sum from multiple files? EDIT: This is the way I do it to get a list of sums: checksums = [(fname, hashlib.md5(open(fname, 'rb').read()).digest()) for fname in flist] 回答1: So I made it :) This

Checksum algorithm based on J.G. Fletcher

霸气de小男生 提交于 2019-12-10 10:25:40
问题 I have been tasked in implementing a Checksum algorithm that is based on the J.G. Fletcher checksum and ISO 8473-1:1998 and is described like so : They then list 4 data that can be checked to see if the algo is correct but my version fails at the last two values. 0000 gives a checksum of FFFF 0000'00 gives a checksum of FFFF ABCDEF'01 gives a checksum of 9CF8 1456'F89A'0001 gives a checksum of 24DC I've been working on this for hours now and can't find what I did wrong, a new set of eyes

Is there a checksum algorithm that also supports “subtracting” data from it?

扶醉桌前 提交于 2019-12-09 15:25:31
问题 I have a system with roughly a 100 million documents, and I'd like to keep track of their modifications between mirrors. In order to exchange information about modifications effectively, I want to send information about modified documents by days, not by each separate document. Something like this: [ 2012/03/26, cs26], [ 2012/03/25, cs25], [ 2012/03/24, cs24], ... where each cs is the checksum of timestamps of all documents created on a particular day. Now, the problem I'm running into is

重读TCP/IP(5)之TCP头部

Deadly 提交于 2019-12-09 10:27:28
TCP 概述 前一篇讲述了 IP ,它是一个不可靠的,无连接的,无序的,无流控的,只顾寻找最佳路由进行转发,提供最好的传输,既然 IP 不管这些,是因为这些都由 TCP 来完成, IP 层只需要传送,不管到达,复杂度在于路由选择, TCP 接管了有序,有连接的,可靠的服务,复杂度也就在于如何有序,如何控制流量,使得传输可靠,两个协议侧重面不同,但却又相辅相承, TCP 保证正确的传输, IP 保证最佳路径传输, IP 不保证到达, TCP 保证到达。想要知道 TCP 与 IP 不一样的地方就需要了解它的头部和 IP 有什么区别。 TCP 头部 Source port 源端口和 Destination port 目的端口 : 占 16 位,告知主机该报文段是来自哪个源端口以及传给哪个上层协议(应用层)目的端口的,进行 TCP 通信,客户端通常使用系统自动选择的临时端口号,而服务器则使用一些知名服务的端口号。 应用程序的端口号和应用程序所在主机的IP地址统称为socket(套接字),IP:XX, 在互联网上socket唯一标识每一个应用程序,源端口+源IP+目的端口+目的IP称为套接字对,一对套接字就是一个连接,一个客户端与服务器之间的连接。 Sequence Number 序列号: 占 32 位,一次 TCP 通信(建立到断开)过程中某一个传输方向上的字节流的每个字节的编号,它保证了

Error updating emacs packages: Failed to download 'gnu' archive

巧了我就是萌 提交于 2019-12-09 04:36:48
问题 My init.el uses this to initialize packages: (package-initialize) (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")) (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) (add-to-list 'package-archives '("melpa-stable" . "http://melpa-stable.milkbox.net/packages/")) When I do M-x package-refresh-contents I get the following error: Failed to download `gnu' archive. M-x toggle-debug-on-error gives me this stacktrace: Debugger entered--Lisp

Calculate CRC8-Maxim checksum in Java

风流意气都作罢 提交于 2019-12-08 13:33:15
问题 I'm trying to code a CRC8-Maxim calculator in java but I'm stuck. I've tried many API's such as Jacksum, but nothing worked like it should. The only thing I found is this website: http://www.sunshine2k.de/coding/javascript/crc/crc_js.html If I choose the CRC8-Maxim setting, the result is exactly what I need it to be. (example: The checksum of VR1,?, should be D7) Do you have any idea, how I could code that in java? I need it for my final school project and there's not much time left. Thanks

Understanding the TCP checksum function

耗尽温柔 提交于 2019-12-08 09:35:02
问题 I believe that the TCP checksum function does the following: Break up the pseudoheader and the TCP segment header and data into 2 byte blocks. Add a one byte padding of 0s to the end of the last block if it's not 2 bytes long, to make it 2 bytes. Take the one's complement of the sum to get the TCP checksum. Sounds simple enough. Hence I wrote my own generic checksum function: #include <inttypes.h> #include <arpa/inet.h> uint16_t checksum(uint16_t * data, int size) { uint16_t sum = 0; int i =

malloc error in f2py

邮差的信 提交于 2019-12-08 09:28:54
问题 I am trying to use f2py to run a simple integration problem in 3 dimensions. The python code which calls the fortran code is as follows: #!/Library/Frameworks/EPD64.framework/Versions/Current/bin/python import pymods as modules import pygauleg as gauleg import pyint as integrator import pylab as pl import sys import math import time ############################################ # main routine ############################# ############################################ zero = 0.0 one = 1.0 pi =

How to calculate SHA-256 checksum of S3 file content

萝らか妹 提交于 2019-12-08 06:02:24
问题 S3 out of the box provides the MD5 checksum of the S3 object content. But I need to calculate the SHA-256 checksum of the file content. The file could be large enough so I do not want to load the file in memory and calculate the checksum, instead I need a solution to calculate the checksum without loading the whole file in memory. 回答1: It can be achieved by following steps in Java: Get InputStream of the S3 Object Use MessageDigest and DigestInputStream classes for the SHA-256 hash(or SHA-1

How to write and send an ASTM frame to medical equipment

旧城冷巷雨未停 提交于 2019-12-08 01:02:13
问题 I am currently working on the ASTM protocol to send orders tests request to medical instrument. But I cannot send a message to the equipment correctly. To be more explicit, I want for example to send these frames: String h1, s2, s3, s4, s5, s6 = ""; h1 = "H|@^\\|ODM-IdfDGIWA-36|||GeneXpert PC^GeneXpert^4.8|||||LIS||P|1394-97|20070521100245"; s2 = "P|1"; s3 = "O|1|SID-818||^^^TestId-12|S|20070812140500|||||A||||ORH||||||||||Q"; s4 = "O|2|SID-818||^^^TestId-14|S|20070812140600|||||A||||ORH|||||