当前位置:网站首页>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
边栏推荐
- 精选综述 | 用于白内障分级/分类的机器学习技术
- c# .net mvc 使用百度Ueditor富文本框上传文件(图片,视频等)
- Wireshark network packet capture
- Write it down once Net analysis of thread burst height of an industrial control data acquisition platform
- 如何让你的小游戏适配不同尺寸的手机屏幕
- 关于联邦学习和激励的相关概念(1)
- Win11共享文件打不开怎么办?Win11共享文件打不开的解决方法
- repeat_ P1002 [NOIP2002 popularization group] cross the river pawn_ dp
- Oracle database, numbers Force 2 decimal places to display-Alibaba Cloud
- What financial products can you buy with a deposit of 100000 yuan?
猜你喜欢

输入的查询SQL语句,是如何执行的?

Ziguang zhanrui completed the first 5g R17 IOT NTN satellite on the Internet of things in the world
![NLP, vision, chip What is the development direction of AI? Release of the outlook report of Qingyuan Association [download attached]](/img/79/82763392e74d102921b4e8e601d4c6.png)
NLP, vision, chip What is the development direction of AI? Release of the outlook report of Qingyuan Association [download attached]

YOLOv5s-ShuffleNetV2

Decryption function calculates "task state and lifecycle management" of asynchronous task capability

关于联邦学习和激励的相关概念(1)

The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!

水晶光电:长安深蓝SL03的AR-HUD产品由公司供应
![[in-depth learning] review pytoch's 19 loss functions](/img/c1/07650a6755d5c64ebf8ce370456fb7.png)
[in-depth learning] review pytoch's 19 loss functions

紫光展锐完成全球首个 5G R17 IoT NTN 卫星物联网上星实测
随机推荐
Optimize if code with policy mode [policy mode]
Process of manually encrypt the mass-producing firmware and programming ESP devices
Application practice | Shuhai supply chain construction of data center based on Apache Doris
Taishan Office Technology Lecture: about the order of background (shading and highlighting)
Talking about cookies of client storage technology
Qt编写物联网管理平台38-多种数据库支持
Introduction to ACM combination counting
2022 version of stronger jsonpath compatibility and performance test (snack3, fastjson2, jayway.jsonpath)
Data set division
Related concepts of federal learning and motivation (1)
精选综述 | 用于白内障分级/分类的机器学习技术
Offset function and windowing function
哈希(Hash)竞猜游戏系统开发功能分析及源码
New wizard effect used by BCG
电脑页面不能全屏怎么办?Win11页面不能全屏的解决方法
Template_ Judging prime_ Square root / six prime method
实践示例理解js强缓存协商缓存
泰山OFFICE技术讲座:关于背景(底纹和高亮)的顺序问题
Abc229 summary (connected component count of the longest continuous character graph in the interval)
B2B mall system development of electronic components: an example of enabling enterprises to build standardized purchase, sale and inventory processes