Algorithms used in the development of virtual currency bulb, bit (bits) and bytes (bytes)

Source: Internet
Author: User
Tags hash valid

Blockchain Enthusiast (qq:53016353)

You may know that all the data in a computer is made up of 0 or 1, and the smallest data unit is a bit (bit, or bit), which is also 0 or 1. Imagine that a computer has a lot of light bulbs, and this bulb has two different states, bright (1) or off (0). and different data, the pattern displayed by the lamp is also different. Big data, such as video, uses quite a lot of light bulbs, while a short email requires less light bulbs. A single light bulb stands for a bit. In addition, you may have heard of a word called a byte, a byte equivalent to a combination of 8 bulbs. The 1MB data is about 1 million bytes, which is equivalent to 8 million bulbs.

Today, home computers have billions of or even trillions of bulbs. But we find that even a collection of 256 bulbs is enough to represent any particle that can be observed in the universe. Imagine all the patterns that 256 light bulbs can produce, and that would be an astronomical figure: the possibility of 2^256.


P2





Cryptographic hash functions (or cryptographic hashing functions)



A hash function, which takes any input, can produce a specific size output. The process of using a hash function and then producing some data, which we call hashing (hashing) or transliteration as a hashing method. And the output of the hash function, we call it a hash (hash). The basic characteristic of a particular hash function is the size of its output. For example in this article, we use a hash function that outputs output as a zero bits (32 bytes). Of course there are hash functions that produce smaller outputs, or they can produce larger outputs, and there are other hash functions that can produce bits, but in this case, we don't care about the hash function we use.


P3





Using the hash function of this example, when an n-megabyte (MB) video is hashed, its output is: some of the 256 bulbs are lit. When a short e-mail message is hashed, the output of the 256 bulbs shows another pattern. In some ways, hashing looks like compression. Simply explaining the difference between the two, the FPT will always produce the same number of bulbs, while compressing the results of an n-megabyte (MB) video will still produce an output of millions of bulbs. A compressed video that can be uncompressed and then get the original video. When a video is hashed to just 256 bulbs, the possibility of rebuilding the original video from this hash is small. This may not sound ideal, but it is actually a powerful feature of the hash function.


P4


A secure cryptographic hash function, one of its key features is that it is unidirectional. This means that, from a mathematical and computer perspective, it is almost impossible to reverse the input from the output. That is, given a hash, it should not be feasible to know or find the input data provided to the hash function. Technically speaking, we call it inverse-image resistance (pre-image resistance).


As a result, the hash function should consume approximately the same amount of time, whether it is a hash or a larger or smaller input. Another ideal result is that the hash, which is generated by the hash function of the lamp pattern, it should seem random, the data "Password1" for hashing, the resulting bulb pattern, and the data "Password2" for the hash of the resulting lamp pattern, There is a big difference between the two. Otherwise, if the pattern is similar, the other person can infer that the input is similar, and if the relevant word (such as "Pass", "word") is found, the password is easily found. A secure hash function produces significantly different output, even if the input is only a bit apart.


The ideal behavior for security is given a hash, and the only way to find the input data is by hashing the combination of all the inputs until the correct input is hashed. If the input is random, the time to find it is both indeterminate.


Although finding a hash of the input should be very difficult, it takes a long time, but calculating a hash can be done very quickly. A hash function with a large number of inputs can be output in less than a second. Given today's smartphones, billions of calculations per second, 1 seconds is equivalent to a long time for computing.


The cryptographic hash function should also be anti-collision (collision resistant). A collision process, meaning that when a hash function evaluates to more than 1 inputs, it outputs the same output. If the hash method is used to calculate the data 1 (possibly a spreadsheet), and the hash method is used to calculate the data 2 (which may be a picture), both produce the same output, then the collision conflict occurs.


Cryptographic hash functions, the importance of security, will be clearer when we describe the blockchain and hash sections.





Blockchain and hash method



The hashing method (Hashing) is widely used in blockchain, and there are some examples here.


The address on the blockchain is obtained by hashing the public key. An Ethereum account address is derived from the Keccak-256 (developer should read the key difference between it and sha3-256) hashing a public key. A Bitcoin address is derived from hashing a public key by sha2–256 and RIPEMD160.


The anti-collision of the hash function is important, because if 2 people generate the same address (a conflict), either party can spend the money on that address.


Signatures are also a fundamental part of the blockchain. Similar to signing a cheque, the cryptographic signature determines which transactions are valid. The signature is generated by the private key and the data hash that needs to be signed.


The transaction hash is very obvious in the blockchain. For example, describe a trade: "Alice sends Bob the X-unit currency at D-T," then the trade is submitted to their hash, For example, 5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060 is a trade in the Ethereum blockchain. The transaction hash is also more directly available, such as the "1024th transaction in 1337 chunks" description, you only need to copy the hash and paste it into a blockchain browser, then you can view the details of the transaction.


In a metaphysical sense, chunks in the blockchain are determined by their hash, which acts as a double role for authentication and complete validation. An identifying string also provides its own integrity, known as a self-certification identifier.


For a blockchain using a mining mechanism, the proof of work (proof-of-work) is a number, which we call a random number (nonce), and when it merges with other hashed data, it produces a value that is smaller than the specified target values. Mining makes the hashing method a fast arithmetic and one-way irreversible algorithm. It takes time to find a valid random number, because (miners) have no clues to help them find a hash that is small enough, and the only way to find one that is less than the target value is to compute a lot of hashes: in Bitcoin, there are currently more than 10^25 (septillion) orders of magnitude hash. When a random number is found, it takes 1 seconds to validate it, and the new block is broadcast on the network, creating the latest consensus and blockchain.


The storage data on the blockchain is permanent, but it is unwise to store large amounts of data on the blockchain, and the practical blockchain storage method is to store the fixed-size (usually small) data represented on the blockchain, which we call "data hashing". One application of blockchain is as a timestamp service. Suppose you want to prove a picture that is present and that it is not fabricated in the future. You can store the hash of the image on the blockchain, and a year later, when the judge asks if the picture was actually there a year ago, you can provide the picture, and the judge can hash the image and compare it to the hash you stored on the blockchain.


The FPT also involves more advanced examples, such as blockchain, scalability, and the fundamental of light purse innovation-Meckerschau (Merkle tree).





Hash for security identification



Secure cryptographic hash functions are unidirectional, fast-calculating, and anti-collision. By combining these features, they process any type of input and then produce a fixed-size output called a hash, which is useful for the identification of any data. The hash of the length of Bits, which represents an astronomical combination of the unique identifiers of the global Internet of things, is more than enough, and even at the scale of nanotechnology, these hashes can be written as 64 characters (hexadecimal), which makes them useful as identifiers. In a blockchain, hashes are identifiers that are used as chunks, trades, and addresses.


P5


Hashes also enjoy the benefits of security and privacy. If a song is recorded in a number format and the hash of the song is recorded on the blockchain, then no one else can claim that they are the first to create the song and generate the hash, and they will not know the song itself: someone cannot write songs or tamper with the hash. Similarly, unless a song or other digitized property or data is indicated, it is only the hash itself that is displayed on the blockchain. Ownership records can also be stored on blockchain, for example, the vehicle registry can store the car data hash (photo, VIN, license plate) on the blockchain, only the vehicle owner, insurance company and the government will know the actual details of the vehicle.





In-depth theory, widely used



Designing cryptographic hash functions requires a combination of art and science. In order to prove their safety, it is necessary to use advanced mathematics and computer science. Blockchain is the first user interface with a hash that is provided for a large crowd. A good user experience with a lot of hashing behind it, but as we see today with the various IDs and serial numbers, sometimes hashing is the best identifier for a lengthy alternative. As encryption and Internet of things become more popular, you want to see more 64-character hashes in the future.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.