feat: ensure format consistency and add badges to README
This commit is contained in:
parent
8c2ec423ba
commit
d6121571a2
7 changed files with 28 additions and 14 deletions
9
.editorconfig
Normal file
9
.editorconfig
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
# nanocurrency-js
|
||||||
|
|
||||||
|
[](https://travis-ci.org/marvinroger/nanocurrency-js)
|
||||||
|
[](https://github.com/semantic-release/semantic-release)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
A toolkit for the Nano cryptocurrency.
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "nanocurrency",
|
"name": "nanocurrency",
|
||||||
"description": "Toolkit for the Nano cryptocurrency",
|
"description": "A toolkit for the Nano cryptocurrency.",
|
||||||
"version": "0.0.0-development",
|
"version": "0.0.0-development",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Marvin ROGER",
|
"name": "Marvin ROGER",
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,7 @@ const uint64_t WORK_THRESHOLD = 0xffffffc000000000;
|
||||||
|
|
||||||
void hex_to_bytes(const std::string& hex, uint8_t* bytes) {
|
void hex_to_bytes(const std::string& hex, uint8_t* bytes) {
|
||||||
int byte_index = 0;
|
int byte_index = 0;
|
||||||
for (unsigned int i = 0; i < hex.length(); i += 2)
|
for (unsigned int i = 0; i < hex.length(); i += 2) {
|
||||||
{
|
|
||||||
std::string byte_string = hex.substr(i, 2);
|
std::string byte_string = hex.substr(i, 2);
|
||||||
uint8_t byte = (uint8_t) strtol(byte_string.c_str(), NULL, 16);
|
uint8_t byte = (uint8_t) strtol(byte_string.c_str(), NULL, 16);
|
||||||
bytes[byte_index++] = byte;
|
bytes[byte_index++] = byte;
|
||||||
|
|
@ -42,8 +41,7 @@ uint64_t generate_work(uint8_t* block_hash, uint8_t worker_number, uint8_t worke
|
||||||
return work;
|
return work;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t swap_uint64(uint64_t val)
|
uint64_t swap_uint64(uint64_t val) {
|
||||||
{
|
|
||||||
val = ((val << 8) & 0xFF00FF00FF00FF00ULL ) | ((val >> 8) & 0x00FF00FF00FF00FFULL );
|
val = ((val << 8) & 0xFF00FF00FF00FF00ULL ) | ((val >> 8) & 0x00FF00FF00FF00FFULL );
|
||||||
val = ((val << 16) & 0xFFFF0000FFFF0000ULL ) | ((val >> 16) & 0x0000FFFF0000FFFFULL );
|
val = ((val << 16) & 0xFFFF0000FFFF0000ULL ) | ((val >> 16) & 0x0000FFFF0000FFFFULL );
|
||||||
return (val << 32) | (val >> 32);
|
return (val << 32) | (val >> 32);
|
||||||
|
|
@ -51,8 +49,7 @@ uint64_t swap_uint64(uint64_t val)
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
EMSCRIPTEN_KEEPALIVE
|
EMSCRIPTEN_KEEPALIVE
|
||||||
char* emscripten_generate_work(char* block_hash_hex, uint8_t worker_number, uint8_t worker_count)
|
char* emscripten_generate_work(char* block_hash_hex, uint8_t worker_number, uint8_t worker_count) {
|
||||||
{
|
|
||||||
std::string block_hash_hex_string(block_hash_hex);
|
std::string block_hash_hex_string(block_hash_hex);
|
||||||
uint8_t block_hash_bytes[32];
|
uint8_t block_hash_bytes[32];
|
||||||
hex_to_bytes(block_hash_hex_string, block_hash_bytes);
|
hex_to_bytes(block_hash_hex_string, block_hash_bytes);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue