Checksum 一个良好的校验和算法通常会对进行很小的修改的输入数据都会输出一个显著不同的值

w

https://en.wikipedia.org/wiki/Checksum

https://zh.wikipedia.org/wiki/校验和

checksum is a small-sized datum derived from a block of digital data for the purpose of detecting errors which may have been introduced during its transmission or storage. It is usually applied to an installation file after it is received from the download server. By themselves, checksums are often used to verify data integrity but are not relied upon to verify data authenticity.

The actual procedure which yields the checksum from a data input is called a checksum function or checksum algorithm. Depending on its design goals, a good checksum algorithm will usually output a significantly different value, even for small changes made to the input. This is especially true of cryptographic hash functions, which may be used to detect many data corruption errors and verify overall data integrity; if the computed checksum for the current data input matches the stored value of a previously computed checksum, there is a very high probability the data has not been accidentally altered or corrupted.

Checksum functions are related to hash functionsfingerprintsrandomization functions, and cryptographic hash functions. However, each of those concepts has different applications and therefore different design goals.

校验和(英语:Checksum)是冗余校验的一种形式。 它是通过错误检测方法,对经过空间(如通信)或者时间(如计算机存储)传送的数据的完整性进行检查的一种简单方法。

计算机领域常见的校验和的方法有循环冗余校验(CRC)、MD5SHA家族等。

时间: 2024-07-31 14:26:40

Checksum 一个良好的校验和算法通常会对进行很小的修改的输入数据都会输出一个显著不同的值的相关文章

微信小程序——修改data里面数组某一个值

比如我现在有个data数据如下: data: { playIndex: null, courseList: [{ videoId: '0', isPlaying: false, }, { videoId: '1', isPlaying: false, }] }, 我现在想要修改courseList里面的isPlaying的值该怎么做呢? var thisIdx = e.currentTarget.dataset.index; var playStatus = "courseList["

异或校验和算法

在数据传输或者数据下载过程中,通常要保证数据的可靠性和安全性,所以,发送方和接收方要约定共同的协议,而这个协议中常常会出现校验和的运算. C代码如下: 1 unsigned char calc_nmea_checksum(const char * setence) 2 { 3 unsigned char checksum = 0; 4 while(* setence) 5 { 6 checksum ^= (unsigned char)* setence++; 7 } 8 9 return che

IP数据报首部校验和算法

当用google搜索IP数据报首部校验和算法的时候,总是看到的是代码,没有看到其过程,于是就有了此文,如有错误请指正.文章省略一点,呵呵 IP/ICMP/IGMP/TCP/UDP等协议的校验和算法都是相同的,算法如下: 在发送数据时,为了计算数IP据报的校验和.应该按如下步骤: (1)把IP数据报的首部都置为0,包括校验和字段. (2)把首部看成以16位为单位的数字组成,依次进行二进制反码求和. (3)把得到的结果存入校验和字段中. 在接收数据时,计算数据报的校验和相对简单,按如下步骤: (1)

分享一个德州扑克的算法

德州扑克想必很多人都玩过,当然对于新手需要说明的是,德州指的是德克萨斯州,而不是山东德州. 这几个月一直在做一个德州扑克的服务器,分享下在计算最大牌型,比牌逻辑的算法和洗牌的方法,希望对大家有帮助. 首先我们定义一下Poker类 public class Poker { private String tag; // 图片扑克花色的表示(代表的是红桃.黑桃,梅花.方块 private int num; // 表示扑克牌面的大 public Poker(String tag, int num) {

一个文件中有40亿个整数,每个整数为四个字节,内存为1GB,写出一个算法:求出这个文件里的整数里不包含的一个整数

4个字节表示的整数,总共只有2^32约等于4G个可能.为了简单起见,可以假设都是无符号整数.分配500MB内存,每一bit代表一个整数,刚好可以表示完4个字节的整数,初始值为0.基本思想每读入一个数,就把它对应的bit位置为1,处理完40G个数后,对500M的内存遍历,找出一个bit为0的位,输出对应的整数就是未出现的.算法流程:1)分配500MB内存buf,初始化为02)unsigned int x=0x1;  for each int j in file  buf=buf|x<<j;  e

一个非常有用的算法---统计二进制数中1的个数

本人算法小菜,看见一个非常好的算法,统计一个数的二进制数的1的个数.觉得不错,与大家分享. 1 int fun(int x){ 2 int count = 0; 3 while(x){ 4 count++; 5 x = x &(x-1) 6 } 7 return count; 8 } 下面是个人的一点解释(欢迎拍砖) 比如一个数x的二进制后面几位是1000. x-1的二进制后面几位变成了     0111. 二者&,变成了                            0000.

大数据DDos检测——DDos攻击本质上是时间序列数据,t+1时刻的数据特点和t时刻强相关,因此用HMM或者CRF来做检测是必然! 和一个句子的分词算法CRF没有区别!

DDos攻击本质上是时间序列数据,t+1时刻的数据特点和t时刻强相关,因此用HMM或者CRF来做检测是必然!--和一个句子的分词算法CRF没有区别!注:传统DDos检测直接基于IP数据发送流量来识别,通过硬件防火墙搞定.大数据方案是针对慢速DDos攻击来搞定.难点:在进行攻击的时候,攻击数据包都是经过伪装的,在源IP 地址上也是进行伪造的,这样就很难对攻击进行地址的确定,在查找方面也是很难的.这样就导致了分布式拒绝服务攻击在检验方法上是很难做到的.领域知识见:http://blog.csdn.n

一个类似 Twitter 雪花算法 的 连续序号 ID 产生器 SeqIDGenerator

项目地址 :     https://github.com/kelin-xycs/SeqIDGenerator 今天 QQ 群 里有网友问起产生唯一 ID 的方法 有哪些,  讨论了各种方法 . 有网友提到 Twitter 的 雪花算法 :       https://blog.csdn.net/w200221626/article/details/52064976 我觉得 GUID 的 优点 是 简单 高效, 缺点 是 可读性 比较差 . 高效 是指 相比起 要到 数据库 读取 种子(当前最大

C++算法之 倒序输出一个链表

题目:给定一个头结点,倒叙输出一个链表 解法1:先将链表反转,在遍历输出 解法2:不修改链表自身的结构,动态申请一段空间,申请一个指针数组,数组内存放的指针指向链表的每个值,再遍历数组输出: void PrintListBack(ListNode* head) { int n = GetLength(head); ListNode** p = new ListNode*[n+1]; p[n] = NULL; int i = 0; ListNode* pNode = head; while (i