当前位置:网站首页>哈希(Hash)竞猜游戏系统开发功能分析及源码
哈希(Hash)竞猜游戏系统开发功能分析及源码
2022-07-04 18:45:00 【VC_MrsFu123】
哈希(Hash)算法,即散列函数。它是种单向密码体制,即它是一个从明文到密文的不可逆的映射,只有加密过程,没有解密过程。同时,哈希函数可以将任意长度的输入经过变化以后得到固定长度的输出。哈希函数的这种单向特征和输出数据长度固定的特征使得它可以生成消息或者数据。
哈希算法(散列算法或者消息摘要算法)是信息存储和查询所用的项基本技术,它是一种基于Hash函数的文件构造方法,把给定的任意长关键宇映射为一个固定长度的哈希值,一般用于鉴权、认证、加密、索引等。其主要优点是运算简单,预处理时间较短,内存消耗低,匹配查找速度比较快,便于维护和刷新,支持匹配规则数多等。
Hash构造函数的方法
1.直接定址法:
直接定址法是以数据元素关键字k本身或它的线性函数作为它的哈希地址,即:H(k)=k或H(k)=a×k+b;(其中a,b为常数)
2.数字分析法:
假设关键字集合中的每个关键字都是由s位数字组成(u1,u2,…,us),分析关键字集中的全体,并从中提取分布均匀的若干位或它们的组合作为地址。
数字分析法是取数据元素关键字中某些取值较均匀的数字位作为哈希地址的方法。即当关键字的位数很多时,可以通过对关键字的各位进行分析,丢掉分布不均匀的位,作为哈希值。它只适合于所有关键字值已知的情况。通过分析分布情况把关键字取值区间转化为一个较小的关键字取值区间。
3.折叠法:
将关键字分割成若干部分,然后取它们的叠加和为哈希地址。两种叠加处理的方法:移位叠加:将分割后的几部分低位对齐相加;边界叠加:从一端沿分割界来回折叠,然后对齐相加。
所谓折叠法是将关键字分割成位数相同的几部分(最后一部分的位数可以不同),然后取这几部分的叠加和(舍去进位),这方法称为折叠法。这种方法适用于关键字位数较多,而且关键字中每一位上数字分布大致均匀的情况。
折叠法中数位折叠又分为移位叠加和边界叠加两种方法,移位叠加是将分割后是每一部分的最低位对齐,然后相加;边界叠加是从一端向另一端沿分割界来回折叠,然后对齐相加。
哈希性质:
(1)单向性。That is,given an input number,it is easy to calculate its hash value,but given a hash value,the original input number cannot be obtained according to the same algorithm.
(2)弱抗碰撞性。That is,given an input number,it is computationally infeasible to find another hash value to get a given number when using the same method.
(3)强抗碰撞性。That is,for any two different input numbers,it is not feasible to calculate the same hash value according to the same algorithm.
边栏推荐
- What does the neural network Internet of things mean? Popular explanation
- Process of manually encrypt the mass-producing firmware and programming ESP devices
- What is the application technology of neural network and Internet of things
- 1007 maximum subsequence sum (25 points) (PAT class a)
- repeat_ P1002 [NOIP2002 popularization group] cross the river pawn_ dp
- 如何让你的小游戏适配不同尺寸的手机屏幕
- Employment prospects of neural network Internet of things application technology [welcome to add]
- Niuke Xiaobai month race 7 e applese's super ability
- Integretee integrates into Moonriver through xcm, bringing enterprise class privacy solutions to its ecosystem
- 上线首月,这家露营地游客好评率高达99.9%!他是怎么做到的?
猜你喜欢
关于联邦学习和激励的相关概念(1)
一文搞懂Go语言中文件的读写与创建
实践示例理解js强缓存协商缓存
MySQL中的日期时间类型与格式化方式
C server log module
Huawei Nova 10 series supports the application security detection function to build a strong mobile security firewall
node强缓存和协商缓存实战示例
C language - Introduction - Foundation - grammar - process control (VII)
FS4061A升压8.4V充电IC芯片和FS4061B升压12.6V充电IC芯片规格书datasheet
[problem] Druid reports exception SQL injection violation, part always true condition not allow solution
随机推荐
Lingyun going to sea | 10 jump &huawei cloud: jointly help Africa's inclusive financial services
Niuke Xiaobai month race 7 F question
C # use stopwatch to measure the running time of the program
What should we pay attention to when doing social media marketing? Here is the success secret of shopline sellers!
Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...
为什么最大速度是光速
Cbcgptabwnd control used by BCG (equivalent to MFC TabControl)
Neural network IOT platform construction (IOT platform construction practical tutorial)
Write it down once Net analysis of thread burst height of an industrial control data acquisition platform
Kotlin condition control
【历史上的今天】7 月 4 日:第一本电子书问世;磁条卡的发明者出生;掌上电脑先驱诞生
Lingyun going to sea | Wenhua online & Huawei cloud: creating a new solution for smart teaching in Africa
2022 version of stronger jsonpath compatibility and performance test (snack3, fastjson2, jayway.jsonpath)
Dark horse programmer - software testing - stage 07 2-linux and database -09-24-linux command learning steps, wildcards, absolute paths, relative paths, common commands for files and directories, file
YOLOv5s-ShuffleNetV2
ACM组合计数入门
Huawei Nova 10 series supports the application security detection function to build a strong mobile security firewall
PHP pseudo original API docking method
In the first month of its launch, the tourist praise rate of this campsite was as high as 99.9%! How did he do it?
凌云出海记 | 文华在线&华为云:打造非洲智慧教学新方案