Comments (7)
@caesarchad Bro
Blake compare to Keccak 256, 512
Keccak256 | Keccak512 | Blake | |
---|---|---|---|
Performance | 1. Blake is about 3 times faster than Keccak on a modern CPU for a 512-bit hash, and only 1.26 times faster for a 256-bit hash | ||
Security | 1. Has a round count that is high enough to give it a massive security margin, and the sponge construction it uses gives very good security proofs, which have only been proven better with time. 2. Can process bitstreams | 1. Has a round count that is high enough to give it a massive security margin, and the sponge construction it uses gives very good security proofs, which have only been proven better with time. 2. Can process bitstreams | 1. Blake also has a high security margin, which allowed Blake-2 to have a lower round count and still retain the expected security from a hash function of a given size. 2. The construction used by Blake was also changed for Blake-2, in order to simplify padding and memory access in software platforms, but also locked it to byte processing only. |
Others | 1. Keccak can generate arbitrary length bitstreams for various applications. 2. Keccak is a 2nd round CAESAR candidate based on the Keccak permutation used in SHA-3. | 1. Keccak can generate arbitrary length bitstreams for various applications. 2. Keccak is a 2nd round CAESAR candidate based on the Keccak permutation used in SHA-3. | Blake and derivatives are not nearly as flexible, NORX is as close Blake as anything, but they are still not really similar as a package, and the core functions are different. |
from bitconch-core.
@luhuimao
My thoughts, create a new go file containing the above function(modify if necessary) and replace all occurrences of existing keccak256/512.
// Blake2b256 caluculates and returns the Blake2b hash of the input data.
func Blake2b256(data ...[]byte) []byte {
// calculate the blake2b hash
hash, _ := blake2b.New256(nil)
// write into hash
for _, b := range data {
hash.Write(b)
}
// return the sum
return hash.Sum(nil)
}
// Blake2b256Hash calculates and returns the Blake2b256 hash of the input data,
// converting it to an internal Hash data structure.
func Blake2b256Hash(data ...[]byte) (h common.Hash) {
// calculate the blake2b hash
hash, _ := blake2b.New256(nil)
// write into hash
for _, b := range data {
hash.Write(b)
}
// return the sum
hash.Sum(h[:0])
return h
}
from bitconch-core.
@caesarchad
After my investigation, Blake2 offers better security and performance compared to keccak256, reasons as below:
- SHA256 was based on SHA1 (which is weak). BLAKE was based on
ChaCha20 (which is strong). - SHA256 has realistically feasible attacks against 31 out of 64
rounds. BLAKE2 has no feasible attacks against more than 2 out of 10
(BLAKE2s) or 2 out of 12 (BLAKE2b) rounds. - BLAKE2 has security features which could be useful for us, such as
protection against length-extension, a standard method of keying,
"personalization tags" to guarantee domain separation, etc. - BLAKE2 is more efficient than SHA256 in software on most
platforms. For example, on ARM chips, it is usually about twice as
efficient as SHA256 when hashing 64 bytes. - BLAKE2 is the de facto standard hash function used by all of the
skilled symmetric cryptographers working on things like Password
Hashing Competition, new Proofs-of-Work such as Equihash,
etc. Whatever Proof-of-Work function we choose, it'll probably turn
out to come defined to use BLAKE2.
from bitconch-core.
@luhuimao excellent work!
I have updated the code #11 (comment)
, will do some unit test to check.
from bitconch-core.
@luhuimao
I have updated the scope of the code, please help to double-check. if anything is missing out, please let me know.
from bitconch-core.
@caesarchad bro update:
golang src files use crypto.Keccak256Hash, addition, total: 37
#No | Go file | package | others |
---|---|---|---|
1 | accounts\abi\bind\topics.go | ||
2 | accounts\abi\event_test.go | ||
3 | cmd\utils\cmd.go | ||
4 | contracts\ens\ens.go | ||
5 | contracts\ens\ens_test.go | ||
6 | core\state\statedb.go | ||
7 | core\state\state_object.go | ||
8 | core\state\state_test.go | ||
9 | core\state\sync_test.go | ||
10 | core\vm\evm.go | ||
11 | eth\handler_test.go | ||
12 | les\odr_requests.go | ||
13 | les\request_test.go | ||
14 | light\odr_util.go | ||
15 | p2p\discover\database.go | ||
16 | p2p\discover\node.go | ||
17 | p2p\discover\table.go | ||
18 | p2p\discover\table_test.go | ||
19 | p2p\discover\udp.go | ||
20 | p2p\discover\udp_test.go | ||
21 | p2p\discv5\database.go | ||
22 | p2p\discv5\net.go | ||
23 | p2p\discv5\net_test.go | ||
24 | p2p\discv5\node.go | ||
25 | p2p\discv5\ticket.go | ||
26 | p2p\discv5\udp_test.go | ||
27 | swarm\api\config.go | ||
28 | trie\trie.go | ||
29 | whisper\mailserver\server_test.go | ||
30 | whisper\whisperv5\api.go | ||
31 | whisper\whisperv5\envelope.go | ||
32 | whisper\whisperv5\filter.go | ||
33 | whisper\whisperv5\filter_test.go | ||
34 | whisper\whisperv6\api.go | ||
35 | whisper\whisperv6\envelope.go | ||
36 | whisper\whisperv6\filter.go | ||
37 | whisper\whisperv6\filter_test.go |
FYI, I got these results by running command
"findstr /m /s /i /C:"crypto.Keccak256hash" *.* >E:\1.txt"
from bitconch-core.
@luhuimao
Push to BUS005 branch.
from bitconch-core.
Related Issues (20)
- Remove duplicate codes
- Support transaction history query on blockexplorer
- Upgrade block explorer to v1.1.2
- Add comments for source codes
- Fix node crash issue. HOT 5
- Upgrade javascript api (bitconch-web3j) to v1.1.4
- Upgrade Bitconch node engine RPC interface
- leader service && validator service crashed by "cannot allocate memory" HOT 3
- Correct typos and comments in the existing codes
- Reboot leader service failed due to "Resource temporarily unavailable"
- Adding some new features to morgan
- Fixing the " memory usage growing too fast by explorer" problem
- explorer service back online
- Test for balance transfer fails.
- Technical Weekly Report (Oct 22) HOT 4
- Technical Weekly Report (Oct 28) HOT 4
- New docker building scripts
- Seperate go source and rust into different repo
- Dependabot couldn't find the submodule vendor/bus-rust
- error: could not find `Cargo.toml` in `/home/ubuntu/Desktop/bitconch-core1` or any parent directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitconch-core.