mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
fix pre-commit
This commit is contained in:
@@ -535,11 +535,12 @@ struct Wasm_test : public beast::unit_test::suite
|
||||
[[maybe_unused]] uint256 const nft1{token::getNextID(env, alan, 0u)};
|
||||
|
||||
env(token::mint(alan, 0u),
|
||||
token::uri("https://github.com/XRPLF/XRPL-Standards/discussions/"
|
||||
"279?id=github.com/XRPLF/XRPL-Standards/discussions/"
|
||||
"279&ut=github.com/XRPLF/XRPL-Standards/discussions/"
|
||||
"279&sid=github.com/XRPLF/XRPL-Standards/discussions/"
|
||||
"279&aot=github.com/XRPLF/XRPL-Standards/disc"));
|
||||
token::uri(
|
||||
"https://github.com/XRPLF/XRPL-Standards/discussions/"
|
||||
"279?id=github.com/XRPLF/XRPL-Standards/discussions/"
|
||||
"279&ut=github.com/XRPLF/XRPL-Standards/discussions/"
|
||||
"279&sid=github.com/XRPLF/XRPL-Standards/discussions/"
|
||||
"279&aot=github.com/XRPLF/XRPL-Standards/disc"));
|
||||
[[maybe_unused]] uint256 const nft2{token::getNextID(env, alan, 0u)};
|
||||
env(token::mint(alan, 0u));
|
||||
env.close();
|
||||
|
||||
@@ -1,72 +1,69 @@
|
||||
#include <stdint.h>
|
||||
|
||||
static char const b58digits_ordered[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
||||
static char const b58digits_ordered[] =
|
||||
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
||||
|
||||
uint8_t e_data[32 * 1024];
|
||||
|
||||
void*
|
||||
allocate(int sz)
|
||||
void *allocate(int sz)
|
||||
{
|
||||
static int idx = 0;
|
||||
if (idx >= 32)
|
||||
return 0;
|
||||
if (sz > 1024)
|
||||
return 0;
|
||||
return &e_data[idx++ << 10];
|
||||
static int idx = 0;
|
||||
if (idx >= 32)
|
||||
return 0;
|
||||
if (sz > 1024)
|
||||
return 0;
|
||||
return &e_data[idx++ << 10];
|
||||
}
|
||||
|
||||
void
|
||||
deallocate(void* p)
|
||||
void deallocate(void *p) {}
|
||||
|
||||
extern int32_t b58enco(char *b58, int32_t b58sz, void const *data,
|
||||
int32_t binsz)
|
||||
{
|
||||
}
|
||||
uint8_t const *bin = data;
|
||||
int32_t carry;
|
||||
int32_t i, j, high, zcount = 0;
|
||||
int32_t size;
|
||||
|
||||
extern int32_t
|
||||
b58enco(char* b58, int32_t b58sz, void const* data, int32_t binsz)
|
||||
{
|
||||
uint8_t const* bin = data;
|
||||
int32_t carry;
|
||||
int32_t i, j, high, zcount = 0;
|
||||
int32_t size;
|
||||
while (zcount < binsz && !bin[zcount])
|
||||
++zcount;
|
||||
|
||||
while (zcount < binsz && !bin[zcount])
|
||||
++zcount;
|
||||
size = (binsz - zcount) * 138 / 100 + 1;
|
||||
uint8_t *buf = allocate(size);
|
||||
if (!buf)
|
||||
return 0;
|
||||
// memset(buf, 0, size);
|
||||
for (i = 0; i < size; ++i)
|
||||
buf[i] = 0;
|
||||
|
||||
size = (binsz - zcount) * 138 / 100 + 1;
|
||||
uint8_t* buf = allocate(size);
|
||||
if (!buf)
|
||||
return 0;
|
||||
// memset(buf, 0, size);
|
||||
for (i = 0; i < size; ++i)
|
||||
buf[i] = 0;
|
||||
|
||||
for (i = zcount, high = size - 1; i < binsz; ++i, high = j)
|
||||
for (i = zcount, high = size - 1; i < binsz; ++i, high = j)
|
||||
{
|
||||
for (carry = bin[i], j = size - 1; (j > high) || carry; --j)
|
||||
{
|
||||
for (carry = bin[i], j = size - 1; (j > high) || carry; --j)
|
||||
{
|
||||
carry += 256 * buf[j];
|
||||
buf[j] = carry % 58;
|
||||
carry /= 58;
|
||||
if (!j)
|
||||
break;
|
||||
}
|
||||
carry += 256 * buf[j];
|
||||
buf[j] = carry % 58;
|
||||
carry /= 58;
|
||||
if (!j)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < size && !buf[j]; ++j)
|
||||
;
|
||||
for (j = 0; j < size && !buf[j]; ++j)
|
||||
;
|
||||
|
||||
if (b58sz <= zcount + size - j)
|
||||
return 0;
|
||||
if (b58sz <= zcount + size - j)
|
||||
return 0;
|
||||
|
||||
if (zcount)
|
||||
{
|
||||
// memset(b58, '1', zcount);
|
||||
for (i = 0; i < zcount; ++i)
|
||||
b58[i] = '1';
|
||||
}
|
||||
if (zcount)
|
||||
{
|
||||
// memset(b58, '1', zcount);
|
||||
for (i = 0; i < zcount; ++i)
|
||||
b58[i] = '1';
|
||||
}
|
||||
|
||||
for (i = zcount; j < size; ++i, ++j)
|
||||
b58[i] = b58digits_ordered[buf[j]];
|
||||
b58[i] = '\0';
|
||||
for (i = zcount; j < size; ++i, ++j)
|
||||
b58[i] = b58digits_ordered[buf[j]];
|
||||
b58[i] = '\0';
|
||||
|
||||
return i + 1;
|
||||
return i + 1;
|
||||
}
|
||||
|
||||
@@ -1,47 +1,43 @@
|
||||
#include <stdint.h>
|
||||
|
||||
int32_t
|
||||
float_from_uint(uint8_t const*, int32_t, uint8_t*, int32_t, int32_t);
|
||||
int32_t
|
||||
check_keylet(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
|
||||
int32_t float_from_uint(uint8_t const *, int32_t, uint8_t *, int32_t, int32_t);
|
||||
int32_t check_keylet(uint8_t const *, int32_t, uint8_t const *, int32_t,
|
||||
uint8_t *, int32_t);
|
||||
|
||||
uint8_t e_data1[32 * 1024];
|
||||
uint8_t e_data2[32 * 1024];
|
||||
|
||||
int32_t
|
||||
test1()
|
||||
int32_t test1()
|
||||
{
|
||||
e_data1[1] = 0xFF;
|
||||
e_data1[2] = 0xFF;
|
||||
e_data1[3] = 0xFF;
|
||||
e_data1[4] = 0xFF;
|
||||
e_data1[5] = 0xFF;
|
||||
e_data1[6] = 0xFF;
|
||||
e_data1[7] = 0xFF;
|
||||
e_data1[8] = 0xFF;
|
||||
int32_t result = float_from_uint(&e_data1[1], 8, &e_data1[35], 12, 0);
|
||||
return result >= 0 ? *((int32_t*)(&e_data1[36])) : result;
|
||||
e_data1[1] = 0xFF;
|
||||
e_data1[2] = 0xFF;
|
||||
e_data1[3] = 0xFF;
|
||||
e_data1[4] = 0xFF;
|
||||
e_data1[5] = 0xFF;
|
||||
e_data1[6] = 0xFF;
|
||||
e_data1[7] = 0xFF;
|
||||
e_data1[8] = 0xFF;
|
||||
int32_t result = float_from_uint(&e_data1[1], 8, &e_data1[35], 12, 0);
|
||||
return result >= 0 ? *((int32_t *)(&e_data1[36])) : result;
|
||||
}
|
||||
|
||||
int32_t
|
||||
test2()
|
||||
int32_t test2()
|
||||
{
|
||||
// Set up misaligned uint32 (seq) at offset 1
|
||||
e_data2[1] = 0xFF;
|
||||
e_data2[2] = 0xFF;
|
||||
e_data2[3] = 0xFF;
|
||||
e_data2[4] = 0xFF;
|
||||
// Set up valid non-zero AccountID (20 bytes) at offset 10
|
||||
for (int i = 0; i < 20; i++)
|
||||
e_data2[10 + i] = i + 1;
|
||||
// Call check_keylet with misaligned uint32 at &e_data2[1] to hit line 72 in HostFuncWrapper.cpp
|
||||
int32_t result = check_keylet(&e_data2[10], 20, &e_data2[1], 4, &e_data2[35], 32);
|
||||
// Return the misaligned value directly to validate it was read correctly (-1 if all 0xFF)
|
||||
return result >= 0 ? *((int32_t*)(&e_data2[36])) : result;
|
||||
// Set up misaligned uint32 (seq) at offset 1
|
||||
e_data2[1] = 0xFF;
|
||||
e_data2[2] = 0xFF;
|
||||
e_data2[3] = 0xFF;
|
||||
e_data2[4] = 0xFF;
|
||||
// Set up valid non-zero AccountID (20 bytes) at offset 10
|
||||
for (int i = 0; i < 20; i++)
|
||||
e_data2[10 + i] = i + 1;
|
||||
// Call check_keylet with misaligned uint32 at &e_data2[1] to hit line 72 in
|
||||
// HostFuncWrapper.cpp
|
||||
int32_t result =
|
||||
check_keylet(&e_data2[10], 20, &e_data2[1], 4, &e_data2[35], 32);
|
||||
// Return the misaligned value directly to validate it was read correctly (-1
|
||||
// if all 0xFF)
|
||||
return result >= 0 ? *((int32_t *)(&e_data2[36])) : result;
|
||||
}
|
||||
|
||||
int32_t
|
||||
test()
|
||||
{
|
||||
return test1() + test2();
|
||||
}
|
||||
int32_t test() { return test1() + test2(); }
|
||||
|
||||
@@ -2,26 +2,24 @@
|
||||
|
||||
char buf[1024];
|
||||
|
||||
void*
|
||||
allocate(int sz)
|
||||
void *allocate(int sz)
|
||||
{
|
||||
if (!sz)
|
||||
return 0;
|
||||
if (!sz)
|
||||
return 0;
|
||||
|
||||
if (sz == 1)
|
||||
return ((void*)(8 * 1024 * 1024));
|
||||
if (sz == 2)
|
||||
return 0;
|
||||
if (sz == 3)
|
||||
return ((void*)(0xFFFFFFFF));
|
||||
if (sz == 1)
|
||||
return ((void *)(8 * 1024 * 1024));
|
||||
if (sz == 2)
|
||||
return 0;
|
||||
if (sz == 3)
|
||||
return ((void *)(0xFFFFFFFF));
|
||||
|
||||
return &buf[sz];
|
||||
return &buf[sz];
|
||||
}
|
||||
|
||||
int32_t
|
||||
test(char* p, int32_t sz)
|
||||
int32_t test(char *p, int32_t sz)
|
||||
{
|
||||
if (!sz)
|
||||
return 0;
|
||||
return p[0];
|
||||
if (!sz)
|
||||
return 0;
|
||||
return p[0];
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// typedef long long mint;
|
||||
typedef int mint;
|
||||
|
||||
mint
|
||||
fib(mint n)
|
||||
mint fib(mint n)
|
||||
{
|
||||
if (!n)
|
||||
return 0;
|
||||
if (n <= 2)
|
||||
return 1;
|
||||
return fib(n - 1) + fib(n - 2);
|
||||
if (!n)
|
||||
return 0;
|
||||
if (n <= 2)
|
||||
return 1;
|
||||
return fib(n - 1) + fib(n - 2);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
int
|
||||
loop()
|
||||
int loop()
|
||||
{
|
||||
int volatile x = 0;
|
||||
while (1)
|
||||
x++;
|
||||
return x;
|
||||
int volatile x = 0;
|
||||
while (1)
|
||||
x++;
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
#include <stdint.h>
|
||||
|
||||
int32_t
|
||||
get_ledger_sqn(uint8_t*, int32_t);
|
||||
int32_t get_ledger_sqn(uint8_t *, int32_t);
|
||||
|
||||
int
|
||||
finish()
|
||||
int finish()
|
||||
{
|
||||
uint32_t sqn;
|
||||
int32_t result = get_ledger_sqn((uint8_t*)&sqn, sizeof(sqn));
|
||||
uint32_t sqn;
|
||||
int32_t result = get_ledger_sqn((uint8_t *)&sqn, sizeof(sqn));
|
||||
|
||||
if (result < 0)
|
||||
return result;
|
||||
if (result < 0)
|
||||
return result;
|
||||
|
||||
return sqn >= 5 ? 5 : 0;
|
||||
return sqn >= 5 ? 5 : 0;
|
||||
}
|
||||
|
||||
@@ -2,22 +2,33 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
static uint64_t const K512[] = {
|
||||
0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc, 0x3956c25bf348b538,
|
||||
0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118, 0xd807aa98a3030242, 0x12835b0145706fbe,
|
||||
0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2, 0x72be5d74f27b896f, 0x80deb1fe3b1696b1, 0x9bdc06a725c71235,
|
||||
0xc19bf174cf692694, 0xe49b69c19ef14ad2, 0xefbe4786384f25e3, 0x0fc19dc68b8cd5b5, 0x240ca1cc77ac9c65,
|
||||
0x2de92c6f592b0275, 0x4a7484aa6ea6e483, 0x5cb0a9dcbd41fbd4, 0x76f988da831153b5, 0x983e5152ee66dfab,
|
||||
0xa831c66d2db43210, 0xb00327c898fb213f, 0xbf597fc7beef0ee4, 0xc6e00bf33da88fc2, 0xd5a79147930aa725,
|
||||
0x06ca6351e003826f, 0x142929670a0e6e70, 0x27b70a8546d22ffc, 0x2e1b21385c26c926, 0x4d2c6dfc5ac42aed,
|
||||
0x53380d139d95b3df, 0x650a73548baf63de, 0x766a0abb3c77b2a8, 0x81c2c92e47edaee6, 0x92722c851482353b,
|
||||
0xa2bfe8a14cf10364, 0xa81a664bbc423001, 0xc24b8b70d0f89791, 0xc76c51a30654be30, 0xd192e819d6ef5218,
|
||||
0xd69906245565a910, 0xf40e35855771202a, 0x106aa07032bbd1b8, 0x19a4c116b8d2d0c8, 0x1e376c085141ab53,
|
||||
0x2748774cdf8eeb99, 0x34b0bcb5e19b48a8, 0x391c0cb3c5c95a63, 0x4ed8aa4ae3418acb, 0x5b9cca4f7763e373,
|
||||
0x682e6ff3d6b2b8a3, 0x748f82ee5defb2fc, 0x78a5636f43172f60, 0x84c87814a1f0ab72, 0x8cc702081a6439ec,
|
||||
0x90befffa23631e28, 0xa4506cebde82bde9, 0xbef9a3f7b2c67915, 0xc67178f2e372532b, 0xca273eceea26619c,
|
||||
0xd186b8c721c0c207, 0xeada7dd6cde0eb1e, 0xf57d4f7fee6ed178, 0x06f067aa72176fba, 0x0a637dc5a2c898a6,
|
||||
0x113f9804bef90dae, 0x1b710b35131c471b, 0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc,
|
||||
0x431d67c49c100d4c, 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817};
|
||||
0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f,
|
||||
0xe9b5dba58189dbbc, 0x3956c25bf348b538, 0x59f111f1b605d019,
|
||||
0x923f82a4af194f9b, 0xab1c5ed5da6d8118, 0xd807aa98a3030242,
|
||||
0x12835b0145706fbe, 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2,
|
||||
0x72be5d74f27b896f, 0x80deb1fe3b1696b1, 0x9bdc06a725c71235,
|
||||
0xc19bf174cf692694, 0xe49b69c19ef14ad2, 0xefbe4786384f25e3,
|
||||
0x0fc19dc68b8cd5b5, 0x240ca1cc77ac9c65, 0x2de92c6f592b0275,
|
||||
0x4a7484aa6ea6e483, 0x5cb0a9dcbd41fbd4, 0x76f988da831153b5,
|
||||
0x983e5152ee66dfab, 0xa831c66d2db43210, 0xb00327c898fb213f,
|
||||
0xbf597fc7beef0ee4, 0xc6e00bf33da88fc2, 0xd5a79147930aa725,
|
||||
0x06ca6351e003826f, 0x142929670a0e6e70, 0x27b70a8546d22ffc,
|
||||
0x2e1b21385c26c926, 0x4d2c6dfc5ac42aed, 0x53380d139d95b3df,
|
||||
0x650a73548baf63de, 0x766a0abb3c77b2a8, 0x81c2c92e47edaee6,
|
||||
0x92722c851482353b, 0xa2bfe8a14cf10364, 0xa81a664bbc423001,
|
||||
0xc24b8b70d0f89791, 0xc76c51a30654be30, 0xd192e819d6ef5218,
|
||||
0xd69906245565a910, 0xf40e35855771202a, 0x106aa07032bbd1b8,
|
||||
0x19a4c116b8d2d0c8, 0x1e376c085141ab53, 0x2748774cdf8eeb99,
|
||||
0x34b0bcb5e19b48a8, 0x391c0cb3c5c95a63, 0x4ed8aa4ae3418acb,
|
||||
0x5b9cca4f7763e373, 0x682e6ff3d6b2b8a3, 0x748f82ee5defb2fc,
|
||||
0x78a5636f43172f60, 0x84c87814a1f0ab72, 0x8cc702081a6439ec,
|
||||
0x90befffa23631e28, 0xa4506cebde82bde9, 0xbef9a3f7b2c67915,
|
||||
0xc67178f2e372532b, 0xca273eceea26619c, 0xd186b8c721c0c207,
|
||||
0xeada7dd6cde0eb1e, 0xf57d4f7fee6ed178, 0x06f067aa72176fba,
|
||||
0x0a637dc5a2c898a6, 0x113f9804bef90dae, 0x1b710b35131c471b,
|
||||
0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc,
|
||||
0x431d67c49c100d4c, 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a,
|
||||
0x5fcb6fab3ad6faec, 0x6c44198c4a475817};
|
||||
|
||||
#define ROTATE(x, y) (((x) >> (y)) | ((x) << (64 - (y))))
|
||||
#define Sigma0(x) (ROTATE((x), 28) ^ ROTATE((x), 34) ^ ROTATE((x), 39))
|
||||
@@ -28,103 +39,94 @@ static uint64_t const K512[] = {
|
||||
#define Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z)))
|
||||
#define Maj(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
|
||||
|
||||
static inline uint64_t
|
||||
B2U64(uint8_t val, uint8_t sh)
|
||||
static inline uint64_t B2U64(uint8_t val, uint8_t sh)
|
||||
{
|
||||
return ((uint64_t)val) << sh;
|
||||
return ((uint64_t)val) << sh;
|
||||
}
|
||||
|
||||
void*
|
||||
allocate(int sz)
|
||||
{
|
||||
return malloc(sz);
|
||||
}
|
||||
void
|
||||
deallocate(void* p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
void *allocate(int sz) { return malloc(sz); }
|
||||
void deallocate(void *p) { free(p); }
|
||||
|
||||
uint8_t e_data[32 * 1024];
|
||||
|
||||
uint8_t*
|
||||
sha512_process(uint8_t const* data, int32_t length)
|
||||
uint8_t *sha512_process(uint8_t const *data, int32_t length)
|
||||
{
|
||||
static uint64_t state[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
static uint64_t state[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
uint64_t a, b, c, d, e, f, g, h, s0, s1, T1, T2;
|
||||
uint64_t X[16];
|
||||
uint64_t a, b, c, d, e, f, g, h, s0, s1, T1, T2;
|
||||
uint64_t X[16];
|
||||
|
||||
uint64_t blocks = length / 128;
|
||||
while (blocks--)
|
||||
uint64_t blocks = length / 128;
|
||||
while (blocks--)
|
||||
{
|
||||
a = state[0];
|
||||
b = state[1];
|
||||
c = state[2];
|
||||
d = state[3];
|
||||
e = state[4];
|
||||
f = state[5];
|
||||
g = state[6];
|
||||
h = state[7];
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
a = state[0];
|
||||
b = state[1];
|
||||
c = state[2];
|
||||
d = state[3];
|
||||
e = state[4];
|
||||
f = state[5];
|
||||
g = state[6];
|
||||
h = state[7];
|
||||
X[i] = B2U64(data[0], 56) | B2U64(data[1], 48) | B2U64(data[2], 40) |
|
||||
B2U64(data[3], 32) | B2U64(data[4], 24) | B2U64(data[5], 16) |
|
||||
B2U64(data[6], 8) | B2U64(data[7], 0);
|
||||
data += 8;
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
X[i] = B2U64(data[0], 56) | B2U64(data[1], 48) | B2U64(data[2], 40) | B2U64(data[3], 32) |
|
||||
B2U64(data[4], 24) | B2U64(data[5], 16) | B2U64(data[6], 8) | B2U64(data[7], 0);
|
||||
data += 8;
|
||||
T1 = h;
|
||||
T1 += Sigma1(e);
|
||||
T1 += Ch(e, f, g);
|
||||
T1 += K512[i];
|
||||
T1 += X[i];
|
||||
|
||||
T1 = h;
|
||||
T1 += Sigma1(e);
|
||||
T1 += Ch(e, f, g);
|
||||
T1 += K512[i];
|
||||
T1 += X[i];
|
||||
T2 = Sigma0(a);
|
||||
T2 += Maj(a, b, c);
|
||||
|
||||
T2 = Sigma0(a);
|
||||
T2 += Maj(a, b, c);
|
||||
|
||||
h = g;
|
||||
g = f;
|
||||
f = e;
|
||||
e = d + T1;
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = T1 + T2;
|
||||
}
|
||||
|
||||
for (i = 16; i < 80; i++)
|
||||
{
|
||||
s0 = X[(i + 1) & 0x0f];
|
||||
s0 = sigma0(s0);
|
||||
s1 = X[(i + 14) & 0x0f];
|
||||
s1 = sigma1(s1);
|
||||
|
||||
T1 = X[i & 0xf] += s0 + s1 + X[(i + 9) & 0xf];
|
||||
T1 += h + Sigma1(e) + Ch(e, f, g) + K512[i];
|
||||
T2 = Sigma0(a) + Maj(a, b, c);
|
||||
|
||||
h = g;
|
||||
g = f;
|
||||
f = e;
|
||||
e = d + T1;
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = T1 + T2;
|
||||
}
|
||||
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
state[4] += e;
|
||||
state[5] += f;
|
||||
state[6] += g;
|
||||
state[7] += h;
|
||||
h = g;
|
||||
g = f;
|
||||
f = e;
|
||||
e = d + T1;
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = T1 + T2;
|
||||
}
|
||||
|
||||
return (uint8_t*)(state);
|
||||
for (i = 16; i < 80; i++)
|
||||
{
|
||||
s0 = X[(i + 1) & 0x0f];
|
||||
s0 = sigma0(s0);
|
||||
s1 = X[(i + 14) & 0x0f];
|
||||
s1 = sigma1(s1);
|
||||
|
||||
T1 = X[i & 0xf] += s0 + s1 + X[(i + 9) & 0xf];
|
||||
T1 += h + Sigma1(e) + Ch(e, f, g) + K512[i];
|
||||
T2 = Sigma0(a) + Maj(a, b, c);
|
||||
|
||||
h = g;
|
||||
g = f;
|
||||
f = e;
|
||||
e = d + T1;
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = T1 + T2;
|
||||
}
|
||||
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
state[4] += e;
|
||||
state[5] += f;
|
||||
state[6] += g;
|
||||
state[7] += h;
|
||||
}
|
||||
|
||||
return (uint8_t *)(state);
|
||||
}
|
||||
|
||||
// int main ()
|
||||
|
||||
@@ -125,7 +125,8 @@ public:
|
||||
std::int64_t
|
||||
getGas() const;
|
||||
|
||||
std::int64_t setGas(std::int64_t) const;
|
||||
std::int64_t
|
||||
setGas(std::int64_t) const;
|
||||
};
|
||||
|
||||
struct ModuleWrapper
|
||||
|
||||
@@ -99,7 +99,8 @@ InstanceWrapper::operator=(InstanceWrapper&& o)
|
||||
return *this;
|
||||
}
|
||||
|
||||
InstanceWrapper::operator bool() const
|
||||
InstanceWrapper::
|
||||
operator bool() const
|
||||
{
|
||||
return static_cast<bool>(instance_);
|
||||
}
|
||||
@@ -259,7 +260,8 @@ ModuleWrapper::operator=(ModuleWrapper&& o)
|
||||
return *this;
|
||||
}
|
||||
|
||||
ModuleWrapper::operator bool() const
|
||||
ModuleWrapper::
|
||||
operator bool() const
|
||||
{
|
||||
return instanceWrap_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user