Skip to content

Commit

Permalink
Refactor yes(crypt|power) and k12/keccak code locations
Browse files Browse the repository at this point in the history
  • Loading branch information
Spudz76 committed Sep 23, 2020
1 parent 2c80bc6 commit 2b68eb5
Show file tree
Hide file tree
Showing 32 changed files with 76 additions and 254 deletions.
12 changes: 6 additions & 6 deletions cmake/randomx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ if (WITH_RANDOMX)
src/crypto/rx/RxDataset.cpp
src/crypto/rx/RxQueue.cpp
src/crypto/rx/RxVm.cpp
src/crypto/randomx/defyx/KangarooTwelve.c
src/crypto/randomx/defyx/KeccakP-1600-reference.c
src/crypto/randomx/defyx/KeccakSpongeWidth1600.c
src/crypto/randomx/defyx/yescrypt-best.c
src/crypto/randomx/panthera/sha256.c
src/crypto/randomx/panthera/yespower-opt.c
src/crypto/k12/KangarooTwelve.c
src/crypto/keccak/KeccakP-1600-reference.c
src/crypto/keccak/KeccakSpongeWidth1600.c
src/crypto/yes/sha256.c
src/crypto/yes/yescrypt-best.c
src/crypto/yes/yespower-opt.c
)

if (CMAKE_C_COMPILER_ID MATCHES MSVC)
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ and related or neighboring rights to the source code in this file.
#ifndef KeccakP1600_excluded

#include <stddef.h>
#include "align.h"
#include "KeccakSpongeWidth1600.h"
#include "../align.h"
#include "../keccak/KeccakSpongeWidth1600.h"
#include "Phases.h"

typedef KCP_Phases KangarooTwelve_Phases;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and related or neighboring rights to the source code in this file.
#define _KeccakSpongeCommon_h_

#include <string.h>
#include "align.h"
#include "../align.h"

#define KCP_DeclareSpongeStructure(prefix, size, alignment) \
ALIGN(alignment) typedef struct prefix##_SpongeInstanceStruct { \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion src/crypto/randomx/panthera/insecure_memzero.h

This file was deleted.

129 changes: 0 additions & 129 deletions src/crypto/randomx/panthera/sha256.h

This file was deleted.

94 changes: 0 additions & 94 deletions src/crypto/randomx/panthera/sysendian.h

This file was deleted.

18 changes: 9 additions & 9 deletions src/crypto/randomx/randomx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cassert>

extern "C" {
#include "crypto/randomx/defyx/yescrypt.h"
#include "crypto/randomx/panthera/yespower.h"
#include "crypto/randomx/defyx/KangarooTwelve.h"
#include "crypto/yes/yescrypt.h"
#include "crypto/yes/yespower.h"
#include "crypto/k12/KangarooTwelve.h"
}

#include "base/tools/Profiler.h"
Expand Down Expand Up @@ -638,9 +638,9 @@ extern "C" {
assert(inputSize == 0 || input != nullptr);
assert(output != nullptr);
alignas(16) uint64_t tempHash[8];
switch (algo) {
switch (algo) {
case xmrig::Algorithm::RX_DEFYX: rx_sipesh_k12(tempHash, sizeof(tempHash), input, inputSize); break;
case xmrig::Algorithm::RX_XLA: rx_yespower_k12(tempHash, sizeof(tempHash), input, inputSize); break;
case xmrig::Algorithm::RX_XLA: rx_yespower_k12(tempHash, sizeof(tempHash), input, inputSize); break;
default: rx_blake2b_wrapper::run(tempHash, sizeof(tempHash), input, inputSize);
}
machine->initScratchpad(&tempHash);
Expand All @@ -654,9 +654,9 @@ extern "C" {
}

void randomx_calculate_hash_first(randomx_vm* machine, uint64_t (&tempHash)[8], const void* input, size_t inputSize, const xmrig::Algorithm algo) {
switch (algo) {
switch (algo) {
case xmrig::Algorithm::RX_DEFYX: rx_sipesh_k12(tempHash, sizeof(tempHash), input, inputSize); break;
case xmrig::Algorithm::RX_XLA: rx_yespower_k12(tempHash, sizeof(tempHash), input, inputSize); break;
case xmrig::Algorithm::RX_XLA: rx_yespower_k12(tempHash, sizeof(tempHash), input, inputSize); break;
default: rx_blake2b_wrapper::run(tempHash, sizeof(tempHash), input, inputSize);
}
machine->initScratchpad(tempHash);
Expand All @@ -673,9 +673,9 @@ extern "C" {
machine->run(&tempHash);

// Finish current hash and fill the scratchpad for the next hash at the same time
switch (algo) {
switch (algo) {
case xmrig::Algorithm::RX_DEFYX: rx_sipesh_k12(tempHash, sizeof(tempHash), nextInput, nextInputSize); break;
case xmrig::Algorithm::RX_XLA: rx_yespower_k12(tempHash, sizeof(tempHash), nextInput, nextInputSize); break;
case xmrig::Algorithm::RX_XLA: rx_yespower_k12(tempHash, sizeof(tempHash), nextInput, nextInputSize); break;
default: rx_blake2b_wrapper::run(tempHash, sizeof(tempHash), nextInput, nextInputSize);
}
machine->hashAndFill(output, tempHash);
Expand Down
File renamed without changes.
Loading

0 comments on commit 2b68eb5

Please sign in to comment.