forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: segregate x11 hashing #6303
Merged
PastaPastaPasta
merged 3 commits into
dashpay:develop
from
PastaPastaPasta:refactor/segregate-x11
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
File renamed without changes.
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,92 @@ | ||
// Copyright (c) 2014-2023 The Dash Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef BITCOIN_HASH_X11_H | ||
#define BITCOIN_HASH_X11_H | ||
|
||
|
||
#include <crypto/x11/sph_blake.h> | ||
#include <crypto/x11/sph_bmw.h> | ||
#include <crypto/x11/sph_cubehash.h> | ||
#include <crypto/x11/sph_echo.h> | ||
#include <crypto/x11/sph_groestl.h> | ||
#include <crypto/x11/sph_jh.h> | ||
#include <crypto/x11/sph_keccak.h> | ||
#include <crypto/x11/sph_luffa.h> | ||
#include <crypto/x11/sph_shavite.h> | ||
#include <crypto/x11/sph_simd.h> | ||
#include <crypto/x11/sph_skein.h> | ||
|
||
#include <uint256.h> | ||
|
||
|
||
/* ----------- Dash Hash ------------------------------------------------ */ | ||
template <typename T1> | ||
inline uint256 HashX11(const T1 pbegin, const T1 pend) | ||
|
||
{ | ||
sph_blake512_context ctx_blake; | ||
sph_bmw512_context ctx_bmw; | ||
sph_groestl512_context ctx_groestl; | ||
sph_jh512_context ctx_jh; | ||
sph_keccak512_context ctx_keccak; | ||
sph_skein512_context ctx_skein; | ||
sph_luffa512_context ctx_luffa; | ||
sph_cubehash512_context ctx_cubehash; | ||
sph_shavite512_context ctx_shavite; | ||
sph_simd512_context ctx_simd; | ||
sph_echo512_context ctx_echo; | ||
static unsigned char pblank[1]; | ||
|
||
uint512 hash[11]; | ||
|
||
sph_blake512_init(&ctx_blake); | ||
sph_blake512(&ctx_blake, (pbegin == pend ? pblank : static_cast<const void*>(&pbegin[0])), | ||
(pend - pbegin) * sizeof(pbegin[0])); | ||
sph_blake512_close(&ctx_blake, static_cast<void*>(&hash[0])); | ||
|
||
sph_bmw512_init(&ctx_bmw); | ||
sph_bmw512(&ctx_bmw, static_cast<const void*>(&hash[0]), 64); | ||
sph_bmw512_close(&ctx_bmw, static_cast<void*>(&hash[1])); | ||
|
||
sph_groestl512_init(&ctx_groestl); | ||
sph_groestl512(&ctx_groestl, static_cast<const void*>(&hash[1]), 64); | ||
sph_groestl512_close(&ctx_groestl, static_cast<void*>(&hash[2])); | ||
|
||
sph_skein512_init(&ctx_skein); | ||
sph_skein512(&ctx_skein, static_cast<const void*>(&hash[2]), 64); | ||
sph_skein512_close(&ctx_skein, static_cast<void*>(&hash[3])); | ||
|
||
sph_jh512_init(&ctx_jh); | ||
sph_jh512(&ctx_jh, static_cast<const void*>(&hash[3]), 64); | ||
sph_jh512_close(&ctx_jh, static_cast<void*>(&hash[4])); | ||
|
||
sph_keccak512_init(&ctx_keccak); | ||
sph_keccak512(&ctx_keccak, static_cast<const void*>(&hash[4]), 64); | ||
sph_keccak512_close(&ctx_keccak, static_cast<void*>(&hash[5])); | ||
|
||
sph_luffa512_init(&ctx_luffa); | ||
sph_luffa512(&ctx_luffa, static_cast<void*>(&hash[5]), 64); | ||
sph_luffa512_close(&ctx_luffa, static_cast<void*>(&hash[6])); | ||
|
||
sph_cubehash512_init(&ctx_cubehash); | ||
sph_cubehash512(&ctx_cubehash, static_cast<const void*>(&hash[6]), 64); | ||
sph_cubehash512_close(&ctx_cubehash, static_cast<void*>(&hash[7])); | ||
|
||
sph_shavite512_init(&ctx_shavite); | ||
sph_shavite512(&ctx_shavite, static_cast<const void*>(&hash[7]), 64); | ||
sph_shavite512_close(&ctx_shavite, static_cast<void*>(&hash[8])); | ||
|
||
sph_simd512_init(&ctx_simd); | ||
sph_simd512(&ctx_simd, static_cast<const void*>(&hash[8]), 64); | ||
sph_simd512_close(&ctx_simd, static_cast<void*>(&hash[9])); | ||
|
||
sph_echo512_init(&ctx_echo); | ||
sph_echo512(&ctx_echo, static_cast<const void*>(&hash[9]), 64); | ||
sph_echo512_close(&ctx_echo, static_cast<void*>(&hash[10])); | ||
|
||
return hash[10].trim256(); | ||
} | ||
|
||
#endif // BITCOIN_HASH_X11_H |
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 |
---|---|---|
|
@@ -45,3 +45,4 @@ src/util/ranges_set.* | |
src/util/wpipe.* | ||
src/wallet/bip39* | ||
src/wallet/hdchain.* | ||
src/hash_x11.h |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to add hash_x11.h to
test/util/data/non-backported.txt
to let extra linter and clang-format run on this file