-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
external/bitcoin-sha256/: Use SHA256 implementation from Bitcoin.
- Loading branch information
Showing
9 changed files
with
828 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
noinst_LTLIBRARIES = libbitcoin-sha256.la | ||
libbitcoin_sha256_la_SOURCES = \ | ||
compat/cpuid.h \ | ||
crypto/common.h \ | ||
crypto/sha256.cpp \ | ||
crypto/sha256.h | ||
AM_CPPFLAGS = -I $(top_srcdir) |
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,7 @@ | ||
This is the SHA256 implementation copied from the | ||
obscure project https://github.com/bitcoin/bitcoin . | ||
|
||
Specifically, the files `crypto/sha256.cpp` and | ||
`crypto/sha256.h` are copied verbatim, while the | ||
files `crypto/common.h` and `compat/cpuid.h` are minimal | ||
shims to get the SHA256 implementation working. |
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,6 @@ | ||
#ifndef BITCOIN_SHA256_COMPAT_CPUID_H | ||
#define BITCOIN_SHA256_COMPAT_CPUID_H | ||
|
||
/* Created by ZmnSCPxj as a minimal compatibility shim. */ | ||
|
||
#endif /* !defined(BITCOIN_SHA256_COMPAT_CPUID_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef BITCOIN_SHA256_CRYPTO_COMMON_H | ||
#define BITCOIN_SHA256_CRYPTO_COMMON_H | ||
|
||
/* Created by ZmnSCPxj as a minimal compatibility shim. */ | ||
|
||
#include<stdint.h> | ||
|
||
namespace { | ||
|
||
void WriteBE32(unsigned char* ptr, uint32_t x) { | ||
*(ptr++) = uint8_t((x >> 24) & 0xFF); | ||
*(ptr++) = uint8_t((x >> 16) & 0xFF); | ||
*(ptr++) = uint8_t((x >> 8) & 0xFF); | ||
*(ptr++) = uint8_t((x >> 0) & 0xFF); | ||
} | ||
void WriteBE64(unsigned char* ptr, uint64_t x) { | ||
*(ptr++) = uint8_t((x >> 56) & 0xFF); | ||
*(ptr++) = uint8_t((x >> 48) & 0xFF); | ||
*(ptr++) = uint8_t((x >> 40) & 0xFF); | ||
*(ptr++) = uint8_t((x >> 32) & 0xFF); | ||
*(ptr++) = uint8_t((x >> 24) & 0xFF); | ||
*(ptr++) = uint8_t((x >> 16) & 0xFF); | ||
*(ptr++) = uint8_t((x >> 8) & 0xFF); | ||
*(ptr++) = uint8_t((x >> 0) & 0xFF); | ||
} | ||
uint32_t ReadBE32(unsigned char const* ptr) { | ||
return (uint32_t(ptr[0]) << 24) | ||
| (uint32_t(ptr[1]) << 16) | ||
| (uint32_t(ptr[2]) << 8) | ||
| (uint32_t(ptr[3]) << 0) | ||
; | ||
} | ||
|
||
} | ||
|
||
#endif /* !defined(BITCOIN_SHA256_CRYPTO_COMMON_H) */ |
Oops, something went wrong.