当前位置:网站首页>What is the development of block hash quiz game system? Hash quiz game system development (case mature)
What is the development of block hash quiz game system? Hash quiz game system development (case mature)
2022-07-04 20:36:00 【VC_ MrsFu123】
01.Hash function
One way hash function , Also known as one-way Hash function 、 Hash function , It is a function that changes the input message string of any length into a fixed output string, and it is difficult to get the input string from the output string . This output string is called the hash value of the message . Generally used to generate message summaries , Key encryption, etc .
Hash algorithm is widely used in many scenarios , For example, secure encryption and hash table lookup in data structures , Bloom filter and load balancing ( Consistent Hashing ) wait .
02. common Hash function
common Hash Function has MD series 、SHA series 、MAC and CRC etc. .
MD series
MD Full name Message Digest, According to the Standard Version, it is divided into MD2、MD4、MD5 Three algorithms , At present, the most commonly used is MD5 Version algorithm .
MD4 Algorithm
1990 year , stay MD2 On the basis of the development of MD4 Algorithm .
MD5 Algorithm
1991 year ,MD4 Its founder developed MD5 Algorithm . No matter how long the string is , Use MD5 The calculated length is the same , It is convenient for the statistics and management of information at ordinary times .
after MD5 Encryption generates a fixed length of 128bit String of . because 128 position 0 and 1 The binary string expression of is not friendly , So it turns into 16 Base number ,128/4=32 Bit 16 Base number . take 32 Before removing bit 8 Position and back 8 Bit gets 16 position . So there will be MD5 Of 32 Bit and 16 Bit encryption .
SHA series
SHA(Security Hash Algorithm) It's American NIST and NSA A standard of design Hash Algorithm ,SHA Standard algorithm for digital signature DSS in , It is also a kind of high security Hash Algorithm .
SHA-1
SHA-1 The input message length of the algorithm is less than 264bit, The final output value is 160 Bits,SHA-1 And MD4 By comparison , It mainly increases the extension transformation , Add the output of the previous round to the next one , This increases the avalanche effect , And because of it 160 Bits Output , More resistant to exhaustive attacks .
The general implementation process : Convert the message digest into a bit string , Carry on the place filling operation to the converted bit string , Attach the length value and initialize the cache , Then calculate the message digest .
SHA-256
SHA-256 The maximum length of algorithm input message does not exceed 264 Bits, Enter the 512 Bits Work in groups , The output produced is a 256 Bits Message summary of .
SHA-2 Other derivative algorithms of
Include SHA-224、SHA-256、SHA-384、SHA-512, Together these versions make up SHA big family .
SHA-224:SHA-256 Of “ Castration plate ”, Can generate length 224bit A summary of the information .
SHA-512: Can generate length 512bit A summary of the information .
SHA-384:SHA-512 Of “ Castration plate ”, Can generate length 384bit A summary of the information .
SHA The newest member of the family SHA-3 Already in 2015 It came out in .
MAC
MAC Algorithm (Message Authentication Codes) With a secret key Hash function .
MAC There are two forms of Algorithm , Namely CBC-MAC Algorithm and HMAC Algorithm . stay HTTP Most used in MAC The algorithm is HMAC Algorithm .
HMAC(Hash-based Message Authentication Code) The algorithm uses Hash Algorithm as encryption primitive ,HMAC combination Hash There are many variations of the algorithm , such as HMAC-SHA-1、HMAC-SHA256、HMAC-SHA512. Don't mistake HMAC The algorithm is Hash The algorithm adds a key ,HMAC The algorithm is just based on Hash Algorithm , The internal implementation is quite complicated .
CRC
CRC(Cyclic Redundancy Check): Cyclic redundancy test . It is a hash function that generates a short fixed digit check code based on data packets on the Internet or computer files , It is mainly used to detect or verify the possible errors after data transmission or saving . The generated number is calculated and appended to the data before transmission or storage , The receiver then checks to see if the data has changed . Generally speaking , The values of cyclic redundancy check are 32 An integer . Because this function is easy to use binary computer hardware 、 Easy to do mathematical analysis and especially good at detecting errors caused by transmission channel interference , So it's widely used .
list (Hash table, Also called hash table ) It's a search algorithm , With the list 、 Tree algorithm is different from , Hash table algorithm does not need to do a series of search and keyword search ( A keyword is the value of a data item in a data element , To identify a data element ) Comparison operation of .
Hash table algorithm wants to be able to do as much as possible without any comparison , You can get the data elements you are looking for in one access , Therefore, the storage location of the data element and its keyword must be specified ( You can use key Express ) Establish a definite correspondence between , Make each keyword correspond to a unique storage location in the hash table . So in the search , Just find the position of the given keyword in the hash table according to the corresponding relationship . This correspondence is called a hash function ( You can use h(key) Express ).
The methods used to construct hash functions are :
(1) direct addressing : Take the key or a linear function value of the key as the hash address . namely :h(key)=key or h(key)=a*key+b, among a and b Constant .
(2) Digital analysis
(3) The square method : Take the middle digits after the square of the keyword as the hash address .
(4) Folding method : Divide keywords into parts with the same number of digits , Then take the sum of these parts as the hash address .
(5) Division and remainder : The keyword is not longer than the hash table m Number of numbers p The remainder after division is the hash address , namely :h(key)=key MOD p p≤m
(6) Random number method : Choose a random function , Take the random function value of the keyword as its hash address , namely :h(key)=random(key)
So construct a useful hash table , The most important thing is to do the following two things well :
To design a " good " Hash function to calculate Key value .( A good hash function should avoid conflicts as much as possible , And the calculation should be as simple and fast as possible )
What is a block hash?
The block hash value is the DNA of a piece of data,and each block hash value is unique,random and unbreakable."Hashfun"is hello DAPP,the SK application launched by fun blockchain ecology in the gamefi stage,has a mission to implement the"interesting investment and mining"mechanism and attract millions of Genesis residents.
What is blockchain?
In essence,blockchain is a shared database of data or information stored in it.It has the characteristics of unforgeability,full trace,traceability,openness and transparency,collective maintenance,etc
边栏推荐
- Write it down once Net analysis of thread burst height of an industrial control data acquisition platform
- Template_ Large integer subtraction_ Regardless of size
- 输入的查询SQL语句,是如何执行的?
- #夏日挑战赛#带你玩转HarmonyOS多端钢琴演奏
- 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
- Talking about cookies of client storage technology
- B2B mall system development of electronic components: an example of enabling enterprises to build standardized purchase, sale and inventory processes
- Basic use of kotlin
- [problem] Druid reports exception SQL injection violation, part always true condition not allow solution
- 实战模拟│JWT 登录认证
猜你喜欢
AP8022开关电源小家电ACDC芯片离线式开关电源IC
复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
太方便了,钉钉上就可完成代码发布审批啦!
ICML 2022 | meta proposes a robust multi-objective Bayesian optimization method to effectively deal with input noise
[problem] Druid reports exception SQL injection violation, part always true condition not allow solution
Flet tutorial 05 outlinedbutton basic introduction (tutorial includes source code)
Cbcgptabwnd control used by BCG (equivalent to MFC TabControl)
公司要上监控,Zabbix 和 Prometheus 怎么选?这么选准没错!
Pointnext: review pointnet through improved model training and scaling strategies++
On communication bus arbitration mechanism and network flow control from the perspective of real-time application
随机推荐
同事的接口文档我每次看着就头大,毛病多多。。。
Integretee integrates into Moonriver through xcm, bringing enterprise class privacy solutions to its ecosystem
凌云出海记 | 一零跃动&华为云:共助非洲普惠金融服务
What financial products can you buy with a deposit of 100000 yuan?
YOLOv5s-ShuffleNetV2
华为nova 10系列支持应用安全检测功能 筑牢手机安全防火墙
Selected review | machine learning technology for Cataract Classification / classification
泰山OFFICE技术讲座:关于背景(底纹和高亮)的顺序问题
Taishan Office Technology Lecture: about the order of background (shading and highlighting)
[ismb2022 tutorial] the picture shows the precision medicine of learning. Marinka zitnik, Harvard University, keynote speaker, with 87 ppt
Decryption function calculates "task state and lifecycle management" of asynchronous task capability
On communication bus arbitration mechanism and network flow control from the perspective of real-time application
关于联邦学习和激励的相关概念(1)
What does the neural network Internet of things mean? Popular explanation
如何让你的小游戏适配不同尺寸的手机屏幕
Practice examples to understand JS strong cache negotiation cache
记一次 .NET 某工控数据采集平台 线程数 爆高分析
In operation (i.e. included in) usage of SSRs filter
c# .net mvc 使用百度Ueditor富文本框上传文件(图片,视频等)
B2B mall system development of electronic components: an example of enabling enterprises to build standardized purchase, sale and inventory processes