当前位置:网站首页>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
边栏推荐
- MySQL中的日期时间类型与格式化方式
- What does the neural network Internet of things mean? Popular explanation
- Huawei Nova 10 series supports the application security detection function to build a strong mobile security firewall
- 关于联邦学习和激励的相关概念(1)
- 凌云出海记 | 一零跃动&华为云:共助非洲普惠金融服务
- Wireshark network packet capture
- 九齐NY8B062D MCU规格书/datasheet
- 左右最值最大差问题
- B2B mall system development of electronic components: an example of enabling enterprises to build standardized purchase, sale and inventory processes
- Informatics Olympiad 1336: [example 3-1] find roots and children
猜你喜欢
Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
如何让你的小游戏适配不同尺寸的手机屏幕
Aiming at the "amnesia" of deep learning, scientists proposed that based on similarity weighted interleaved learning, they can board PNAS
Pytoch learning (4)
What should we pay attention to when doing social media marketing? Here is the success secret of shopline sellers!
So this is the BGP agreement
What does the neural network Internet of things mean? Popular explanation
Regular replacement [JS, regular expression]
C # better operation mongodb database
Development and construction of DFI ecological NFT mobile mining system
随机推荐
凌云出海记 | 一零跃动&华为云:共助非洲普惠金融服务
Dark horse programmer - software testing - stage 08 2-linux and database-23-30-process port related, modify file permissions, obtain port number information, program and process related operations, Li
Decryption function calculates "task state and lifecycle management" of asynchronous task capability
Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
Practice examples to understand JS strong cache negotiation cache
Optimize if code with policy mode [policy mode]
Kotlin inheritance
Pointnext: review pointnet through improved model training and scaling strategies++
NLP, vision, chip What is the development direction of AI? Release of the outlook report of Qingyuan Association [download attached]
实战模拟│JWT 登录认证
栈:如何实现有效括号的判断?
Flet tutorial 05 outlinedbutton basic introduction (tutorial includes source code)
Employment prospects of neural network Internet of things application technology [welcome to add]
2022 Health Exhibition, Beijing Health Expo, China Health Exhibition, great health exhibition November 13
太方便了,钉钉上就可完成代码发布审批啦!
15million employees are easy to manage, and the cloud native database gaussdb makes HR office more efficient
Form组件常用校验规则-1(持续更新中~)
Data set division
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
The problem of the maximum difference between the left and right maxima