-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Keccak256 in oPoW with CSHAKE256 with domain seperation (#1842)
* Replace keccak with CSHAKE256 in oPoW * Add benchmarks to hash writers to compare blake2b to the CSHAKE * Update genesis blocks * Update tests * Define genesis's block level to be the maximal one * Add message to genesis coinbase * Add comments to genesis coinbase * Fix tests Co-authored-by: Ori Newman <[email protected]>
- Loading branch information
1 parent
a2173ef
commit e3463b7
Showing
10 changed files
with
171 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package hashes | ||
|
||
import ( | ||
"math/rand" | ||
"testing" | ||
) | ||
|
||
func BenchmarkNewBlockHashWriterSmall(b *testing.B) { | ||
r := rand.New(rand.NewSource(0)) | ||
var someBytes [32]byte | ||
r.Read(someBytes[:]) | ||
for i := 0; i < b.N; i++ { | ||
hasher := NewBlockHashWriter() | ||
hasher.InfallibleWrite(someBytes[:]) | ||
hasher.Finalize() | ||
} | ||
} | ||
|
||
func BenchmarkNewBlockHashWriterBig(b *testing.B) { | ||
r := rand.New(rand.NewSource(0)) | ||
var someBytes [1024]byte | ||
r.Read(someBytes[:]) | ||
for i := 0; i < b.N; i++ { | ||
hasher := NewBlockHashWriter() | ||
hasher.InfallibleWrite(someBytes[:]) | ||
hasher.Finalize() | ||
} | ||
} | ||
|
||
func BenchmarkNewHeavyHashWriterSmall(b *testing.B) { | ||
r := rand.New(rand.NewSource(0)) | ||
var someBytes [32]byte | ||
r.Read(someBytes[:]) | ||
for i := 0; i < b.N; i++ { | ||
hasher := NewHeavyHashWriter() | ||
hasher.InfallibleWrite(someBytes[:]) | ||
hasher.Finalize() | ||
} | ||
} | ||
|
||
func BenchmarkNewHeavyHashWriterBig(b *testing.B) { | ||
r := rand.New(rand.NewSource(0)) | ||
var someBytes [1024]byte | ||
r.Read(someBytes[:]) | ||
for i := 0; i < b.N; i++ { | ||
hasher := NewHeavyHashWriter() | ||
hasher.InfallibleWrite(someBytes[:]) | ||
hasher.Finalize() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.