Changeset View
Changeset View
Standalone View
Standalone View
src/crypto/sha256_shani.cpp
// Copyright (c) 2018 The Bitcoin Core developers | // Copyright (c) 2018 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
// | // | ||||
// Based on https://github.com/noloader/SHA-Intrinsics/blob/master/sha256-x86.c, | // Based on https://github.com/noloader/SHA-Intrinsics/blob/master/sha256-x86.c, | ||||
// Written and placed in public domain by Jeffrey Walton. | // Written and placed in public domain by Jeffrey Walton. | ||||
// Based on code from Intel, and by Sean Gulley for the miTLS project. | // Based on code from Intel, and by Sean Gulley for the miTLS project. | ||||
#ifdef ENABLE_SHANI | #ifdef ENABLE_SHANI | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <immintrin.h> | #include <immintrin.h> | ||||
namespace { | namespace { | ||||
alignas(__m128i) const uint8_t MASK[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, | alignas(__m128i) const uint8_t MASK[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, | ||||
0x05, 0x04, 0x0b, 0x0a, 0x09, 0x08, | 0x05, 0x04, 0x0b, 0x0a, 0x09, 0x08, | ||||
0x0f, 0x0e, 0x0d, 0x0c}; | 0x0f, 0x0e, 0x0d, 0x0c}; | ||||
alignas(__m128i) const uint8_t INIT0[16] = {0x8c, 0x68, 0x05, 0x9b, 0x7f, 0x52, | alignas(__m128i) const uint8_t INIT0[16] = {0x8c, 0x68, 0x05, 0x9b, 0x7f, 0x52, | ||||
0x0e, 0x51, 0x85, 0xae, 0x67, 0xbb, | 0x0e, 0x51, 0x85, 0xae, 0x67, 0xbb, | ||||
0x67, 0xe6, 0x09, 0x6a}; | 0x67, 0xe6, 0x09, 0x6a}; | ||||
▲ Show 20 Lines • Show All 366 Lines • Show Last 20 Lines |