1
0
Fork 0
forked from lthn/blockchain

Merge branch 'develop' into libmdbx

This commit is contained in:
cryptozoidberg 2019-09-27 20:34:00 +02:00
commit 01bc8ef53d
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
74 changed files with 1479 additions and 426 deletions

View file

@ -240,7 +240,7 @@ namespace math_helper
}
}
PUSH_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_GCC_WARNING(strict-aliasing)
inline
uint64_t generated_random_uint64()
@ -248,7 +248,7 @@ DISABLE_GCC_WARNING(strict-aliasing)
boost::uuids::uuid id___ = boost::uuids::random_generator()();
return *reinterpret_cast<uint64_t*>(&id___.data[0]); //(*reinterpret_cast<uint64_t*>(&id___.data[0]) ^ *reinterpret_cast<uint64_t*>(&id___.data[8]));
}
POP_WARNINGS
POP_GCC_WARNINGS
template<int default_interval, bool start_immediate = true>
class once_a_time_seconds
{

View file

@ -54,7 +54,7 @@
#endif
#include "os_defenitions.h"
#include "warnings.h"
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4100)
@ -1374,7 +1374,7 @@ namespace log_space
if(!plogger) return false;
return plogger->remove_logger(type);
}
PUSH_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_GCC_WARNING(maybe-uninitialized)
static int get_set_log_detalisation_level(bool is_need_set = false, int log_level_to_set = LOG_LEVEL_1)
{
@ -1386,7 +1386,7 @@ DISABLE_GCC_WARNING(maybe-uninitialized)
}
return log_detalisation_level;
}
POP_WARNINGS
POP_GCC_WARNINGS
static int get_set_time_level(bool is_need_set = false, int time_log_level = LOG_LEVEL_0)
{
static int val_time_log_level = LOG_LEVEL_0;
@ -1705,6 +1705,6 @@ POP_WARNINGS
} // namespace epee
POP_WARNINGS
POP_VS_WARNINGS
#endif //_MISC_LOG_EX_H_

View file

@ -36,7 +36,7 @@
#include "misc_language.h"
#include "warnings.h"
PUSH_WARNINGS
PUSH_VS_WARNINGS
namespace epee {
namespace net_utils {
/************************************************************************/
@ -474,7 +474,7 @@ bool boosted_tcp_server<t_protocol_handler>::init_server(uint32_t port, const st
CATCH_ENTRY_L0("boosted_tcp_server<t_protocol_handler>::init_server", false);
}
//-----------------------------------------------------------------------------
PUSH_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_GCC_WARNING(maybe-uninitialized)
template<class t_protocol_handler>
bool boosted_tcp_server<t_protocol_handler>::init_server(const std::string port, const std::string& address)
@ -487,7 +487,7 @@ bool boosted_tcp_server<t_protocol_handler>::init_server(const std::string port,
}
return this->init_server(p, address);
}
POP_WARNINGS
POP_GCC_WARNINGS
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
bool boosted_tcp_server<t_protocol_handler>::worker_thread()
@ -794,4 +794,4 @@ bool boosted_tcp_server<t_protocol_handler>::connect_async(const std::string& ad
}
} // namespace net_utils
} // namespace epee
POP_WARNINGS
POP_VS_WARNINGS

View file

@ -37,7 +37,7 @@
#define HTTP_MAX_PRE_COMMAND_LINE_CHARS 20
#define HTTP_MAX_HEADER_LEN 100000
PUSH_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_GCC_WARNING(maybe-uninitialized)
@ -690,7 +690,7 @@ namespace net_utils
}
}
POP_WARNINGS
POP_GCC_WARNINGS
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------

View file

@ -101,7 +101,7 @@ namespace epee
return load_t_from_binary(out, f_buff);
}
//-----------------------------------------------------------------------------------------------------------
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4100)
template<class t_struct>
bool store_t_to_binary(const t_struct& str_in, std::string& binary_buff, size_t indent = 0)
@ -110,7 +110,7 @@ DISABLE_VS_WARNINGS(4100)
str_in.store(ps);
return ps.store_to_binary(binary_buff);
}
POP_WARNINGS
POP_VS_WARNINGS
//-----------------------------------------------------------------------------------------------------------
template<class t_struct>
std::string store_t_to_binary(const t_struct& str_in, size_t indent = 0)

View file

@ -45,7 +45,7 @@ namespace epee
return sizeof(pack_value);
}
PUSH_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_GCC_WARNING(strict-aliasing)
template<class t_stream>
size_t pack_varint(t_stream& strm, size_t val)
@ -67,7 +67,7 @@ namespace epee
return pack_varint_t<uint64_t>(strm, PORTABLE_RAW_SIZE_MARK_INT64, val);
}
}
POP_WARNINGS
POP_GCC_WARNINGS
template<class t_stream>
bool put_string(t_stream& strm, const std::string& v)

View file

@ -41,33 +41,37 @@ namespace epee
template<typename from_type, typename to_type>
void convert_int_to_uint(const from_type& from, to_type& to)
{
PUSH_WARNINGS
PUSH_VS_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_VS_WARNINGS(4018)
CHECK_AND_ASSERT_THROW_MES(from >=0, "unexpected int value with signed storage value less than 0, and unsigned receiver value: " << from);
DISABLE_GCC_AND_CLANG_WARNING(sign-compare)
CHECK_AND_ASSERT_THROW_MES(from <= std::numeric_limits<to_type>::max(), "int value overhead: try to set value " << from << " to type " << typeid(to_type).name() << " with max possible value = " << std::numeric_limits<to_type>::max());
to = static_cast<to_type>(from);
POP_WARNINGS
POP_GCC_WARNINGS
POP_VS_WARNINGS
}
template<typename from_type, typename to_type>
void convert_int_to_int(const from_type& from, to_type& to)
{
CHECK_AND_ASSERT_THROW_MES(from >= boost::numeric::bounds<to_type>::lowest(), "int value overhead: try to set value " << from << " to type " << typeid(to_type).name() << " with lowest possible value = " << boost::numeric::bounds<to_type>::lowest());
PUSH_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_CLANG_WARNING(tautological-constant-out-of-range-compare)
CHECK_AND_ASSERT_THROW_MES(from <= std::numeric_limits<to_type>::max(), "int value overhead: try to set value " << from << " to type " << typeid(to_type).name() << " with max possible value = " << std::numeric_limits<to_type>::max());
POP_WARNINGS
POP_GCC_WARNINGS
to = static_cast<to_type>(from);
}
template<typename from_type, typename to_type>
void convert_uint_to_any_int(const from_type& from, to_type& to)
{
PUSH_WARNINGS
PUSH_VS_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_VS_WARNINGS(4018)
DISABLE_CLANG_WARNING(tautological-constant-out-of-range-compare)
CHECK_AND_ASSERT_THROW_MES(from <= std::numeric_limits<to_type>::max(), "uint value overhead: try to set value " << from << " to type " << typeid(to_type).name() << " with max possible value = " << std::numeric_limits<to_type>::max());
to = static_cast<to_type>(from);
POP_WARNINGS
POP_GCC_WARNINGS
POP_VS_WARNINGS
}
template<typename from_type, typename to_type, bool, bool> //is from signed, is from to signed

View file

@ -216,7 +216,7 @@ namespace string_tools
return t_pod;
}
//----------------------------------------------------------------------------
PUSH_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_GCC_WARNING(maybe-uninitialized)
template<class XType>
inline bool get_xtype_from_string(OUT XType& val, const std::string& str_id)
@ -247,7 +247,7 @@ DISABLE_GCC_WARNING(maybe-uninitialized)
return true;
}
POP_WARNINGS
POP_GCC_WARNINGS
//---------------------------------------------------
template<typename int_t>
bool get_xnum_from_hex_string(const std::string str, int_t& res )

View file

@ -59,10 +59,10 @@ namespace misc_utils
char tmpbuf[200] = {0};
tm* pt = NULL;
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4996)
pt = localtime(&time_);
POP_WARNINGS
POP_VS_WARNINGS
if(pt)
strftime( tmpbuf, 199, "%d.%m.%Y %H:%M:%S", pt );
@ -81,10 +81,10 @@ POP_WARNINGS
char tmpbuf[200] = {0};
tm* pt = NULL;
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4996)
pt = localtime(&time_);
POP_WARNINGS
POP_VS_WARNINGS
if(pt)
strftime( tmpbuf, 199, "%Y_%m_%d %H_%M_%S", pt );
@ -109,10 +109,10 @@ POP_WARNINGS
{
char tmpbuf[200] = {0};
tm* pt = NULL;
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4996)
pt = gmtime(&time_);
POP_WARNINGS
POP_VS_WARNINGS
strftime( tmpbuf, 199, "%a, %d %b %Y %H:%M:%S GMT", pt );
return tmpbuf;
}
@ -126,7 +126,7 @@ POP_WARNINGS
tail = -tail;
res = "-";
}
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4244)
int days = tail/(60*60*24);
tail = tail%(60*60*24);
@ -135,7 +135,7 @@ DISABLE_VS_WARNINGS(4244)
int minutes = tail/(60);
tail = tail%(60);
int seconds = tail;
POP_WARNINGS
POP_VS_WARNINGS
res += std::string("d") + boost::lexical_cast<std::string>(days) + ".h" + boost::lexical_cast<std::string>(hours) + ".m" + boost::lexical_cast<std::string>(minutes) + ".s" + boost::lexical_cast<std::string>(seconds);
return res;
}

View file

@ -2,8 +2,12 @@
#if defined(_MSC_VER)
#define PUSH_WARNINGS __pragma(warning(push))
#define POP_WARNINGS __pragma(warning(pop))
#define PUSH_VS_WARNINGS __pragma(warning(push))
#define POP_VS_WARNINGS __pragma(warning(pop))
#define PUSH_GCC_WARNINGS
#define POP_GCC_WARNINGS
#define DISABLE_VS_WARNINGS(w) __pragma(warning(disable: w))
#define DISABLE_GCC_WARNING(w)
#define DISABLE_CLANG_WARNING(w)
@ -13,8 +17,12 @@
#include <boost/preprocessor/stringize.hpp>
#define PUSH_WARNINGS _Pragma("GCC diagnostic push")
#define POP_WARNINGS _Pragma("GCC diagnostic pop")
#define PUSH_VS_WARNINGS
#define POP_VS_WARNINGS
#define PUSH_GCC_WARNINGS _Pragma("GCC diagnostic push")
#define POP_GCC_WARNINGS _Pragma("GCC diagnostic pop")
#define DISABLE_VS_WARNINGS(w)
#if defined(__clang__)

View file

@ -122,7 +122,7 @@ namespace command_line
boost::program_options::basic_parsed_options<charT> parse_command_line(int argc, const charT* const argv[],
const boost::program_options::options_description& desc, bool allow_unregistered = false)
{
auto parser = boost::program_options::command_line_parser(argc, argv);
auto parser = boost::program_options::basic_command_line_parser<charT>(argc, argv);
parser.options(desc);
if (allow_unregistered)
{

160
src/crypto/blake2-impl.h Normal file
View file

@ -0,0 +1,160 @@
/*
BLAKE2 reference source code package - reference C implementations
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
your option. The terms of these licenses can be found at:
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
#ifndef BLAKE2_IMPL_H
#define BLAKE2_IMPL_H
#include <stdint.h>
#include <string.h>
#if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)
#if defined(_MSC_VER)
#define BLAKE2_INLINE __inline
#elif defined(__GNUC__)
#define BLAKE2_INLINE __inline__
#else
#define BLAKE2_INLINE
#endif
#else
#define BLAKE2_INLINE inline
#endif
static BLAKE2_INLINE uint32_t load32( const void *src )
{
#if defined(NATIVE_LITTLE_ENDIAN)
uint32_t w;
memcpy(&w, src, sizeof w);
return w;
#else
const uint8_t *p = ( const uint8_t * )src;
return (( uint32_t )( p[0] ) << 0) |
(( uint32_t )( p[1] ) << 8) |
(( uint32_t )( p[2] ) << 16) |
(( uint32_t )( p[3] ) << 24) ;
#endif
}
static BLAKE2_INLINE uint64_t load64( const void *src )
{
#if defined(NATIVE_LITTLE_ENDIAN)
uint64_t w;
memcpy(&w, src, sizeof w);
return w;
#else
const uint8_t *p = ( const uint8_t * )src;
return (( uint64_t )( p[0] ) << 0) |
(( uint64_t )( p[1] ) << 8) |
(( uint64_t )( p[2] ) << 16) |
(( uint64_t )( p[3] ) << 24) |
(( uint64_t )( p[4] ) << 32) |
(( uint64_t )( p[5] ) << 40) |
(( uint64_t )( p[6] ) << 48) |
(( uint64_t )( p[7] ) << 56) ;
#endif
}
static BLAKE2_INLINE uint16_t load16( const void *src )
{
#if defined(NATIVE_LITTLE_ENDIAN)
uint16_t w;
memcpy(&w, src, sizeof w);
return w;
#else
const uint8_t *p = ( const uint8_t * )src;
return ( uint16_t )((( uint32_t )( p[0] ) << 0) |
(( uint32_t )( p[1] ) << 8));
#endif
}
static BLAKE2_INLINE void store16( void *dst, uint16_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
memcpy(dst, &w, sizeof w);
#else
uint8_t *p = ( uint8_t * )dst;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w;
#endif
}
static BLAKE2_INLINE void store32( void *dst, uint32_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
memcpy(dst, &w, sizeof w);
#else
uint8_t *p = ( uint8_t * )dst;
p[0] = (uint8_t)(w >> 0);
p[1] = (uint8_t)(w >> 8);
p[2] = (uint8_t)(w >> 16);
p[3] = (uint8_t)(w >> 24);
#endif
}
static BLAKE2_INLINE void store64( void *dst, uint64_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
memcpy(dst, &w, sizeof w);
#else
uint8_t *p = ( uint8_t * )dst;
p[0] = (uint8_t)(w >> 0);
p[1] = (uint8_t)(w >> 8);
p[2] = (uint8_t)(w >> 16);
p[3] = (uint8_t)(w >> 24);
p[4] = (uint8_t)(w >> 32);
p[5] = (uint8_t)(w >> 40);
p[6] = (uint8_t)(w >> 48);
p[7] = (uint8_t)(w >> 56);
#endif
}
static BLAKE2_INLINE uint64_t load48( const void *src )
{
const uint8_t *p = ( const uint8_t * )src;
return (( uint64_t )( p[0] ) << 0) |
(( uint64_t )( p[1] ) << 8) |
(( uint64_t )( p[2] ) << 16) |
(( uint64_t )( p[3] ) << 24) |
(( uint64_t )( p[4] ) << 32) |
(( uint64_t )( p[5] ) << 40) ;
}
static BLAKE2_INLINE void store48( void *dst, uint64_t w )
{
uint8_t *p = ( uint8_t * )dst;
p[0] = (uint8_t)(w >> 0);
p[1] = (uint8_t)(w >> 8);
p[2] = (uint8_t)(w >> 16);
p[3] = (uint8_t)(w >> 24);
p[4] = (uint8_t)(w >> 32);
p[5] = (uint8_t)(w >> 40);
}
static BLAKE2_INLINE uint32_t rotr32( const uint32_t w, const unsigned c )
{
return ( w >> c ) | ( w << ( 32 - c ) );
}
static BLAKE2_INLINE uint64_t rotr64( const uint64_t w, const unsigned c )
{
return ( w >> c ) | ( w << ( 64 - c ) );
}
/* prevents compiler optimizing out memset() */
static BLAKE2_INLINE void secure_zero_memory(void *v, size_t n)
{
static void *(*const volatile memset_v)(void *, int, size_t) = &memset;
memset_v(v, 0, n);
}
#endif

200
src/crypto/blake2.h Normal file
View file

@ -0,0 +1,200 @@
/*
BLAKE2 reference source code package - reference C implementations
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
your option. The terms of these licenses can be found at:
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
#ifndef BLAKE2_H
#define BLAKE2_H
#include <stddef.h>
#include <stdint.h>
#if defined(_MSC_VER)
#define BLAKE2_PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
#else
#define BLAKE2_PACKED(x) x __attribute__((packed))
#endif
#if defined(__cplusplus)
extern "C" {
#endif
enum blake2s_constant
{
BLAKE2S_BLOCKBYTES = 64,
BLAKE2S_OUTBYTES = 32,
BLAKE2S_KEYBYTES = 32,
BLAKE2S_SALTBYTES = 8,
BLAKE2S_PERSONALBYTES = 8
};
enum blake2b_constant
{
BLAKE2B_BLOCKBYTES = 128,
BLAKE2B_OUTBYTES = 64,
BLAKE2B_KEYBYTES = 64,
BLAKE2B_SALTBYTES = 16,
BLAKE2B_PERSONALBYTES = 16
};
typedef struct blake2s_state__
{
uint32_t h[8];
uint32_t t[2];
uint32_t f[2];
uint8_t buf[BLAKE2S_BLOCKBYTES];
size_t buflen;
size_t outlen;
uint8_t last_node;
} blake2s_state;
typedef struct blake2b_state__
{
uint64_t h[8];
uint64_t t[2];
uint64_t f[2];
uint8_t buf[BLAKE2B_BLOCKBYTES];
size_t buflen;
size_t outlen;
uint8_t last_node;
} blake2b_state;
typedef struct blake2sp_state__
{
blake2s_state S[8][1];
blake2s_state R[1];
uint8_t buf[8 * BLAKE2S_BLOCKBYTES];
size_t buflen;
size_t outlen;
} blake2sp_state;
typedef struct blake2bp_state__
{
blake2b_state S[4][1];
blake2b_state R[1];
uint8_t buf[4 * BLAKE2B_BLOCKBYTES];
size_t buflen;
size_t outlen;
} blake2bp_state;
BLAKE2_PACKED(struct blake2s_param__
{
uint8_t digest_length; /* 1 */
uint8_t key_length; /* 2 */
uint8_t fanout; /* 3 */
uint8_t depth; /* 4 */
uint32_t leaf_length; /* 8 */
uint32_t node_offset; /* 12 */
uint16_t xof_length; /* 14 */
uint8_t node_depth; /* 15 */
uint8_t inner_length; /* 16 */
/* uint8_t reserved[0]; */
uint8_t salt[BLAKE2S_SALTBYTES]; /* 24 */
uint8_t personal[BLAKE2S_PERSONALBYTES]; /* 32 */
});
typedef struct blake2s_param__ blake2s_param;
BLAKE2_PACKED(struct blake2b_param__
{
uint8_t digest_length; /* 1 */
uint8_t key_length; /* 2 */
uint8_t fanout; /* 3 */
uint8_t depth; /* 4 */
uint32_t leaf_length; /* 8 */
uint32_t node_offset; /* 12 */
uint32_t xof_length; /* 16 */
uint8_t node_depth; /* 17 */
uint8_t inner_length; /* 18 */
uint8_t reserved[14]; /* 32 */
uint8_t salt[BLAKE2B_SALTBYTES]; /* 48 */
uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */
});
typedef struct blake2b_param__ blake2b_param;
typedef struct blake2xs_state__
{
blake2s_state S[1];
blake2s_param P[1];
} blake2xs_state;
typedef struct blake2xb_state__
{
blake2b_state S[1];
blake2b_param P[1];
} blake2xb_state;
/* Padded structs result in a compile-time error */
enum {
BLAKE2_DUMMY_1 = 1/(sizeof(blake2s_param) == BLAKE2S_OUTBYTES),
BLAKE2_DUMMY_2 = 1/(sizeof(blake2b_param) == BLAKE2B_OUTBYTES)
};
// static_assert(sizeof(blake2s_param) == BLAKE2S_OUTBYTES, "Wrong size of blake2s_param");
// static_assert(sizeof(blake2b_param) == BLAKE2B_OUTBYTES, "Wrong size of blake2b_param");
/* Streaming API */
int blake2s_init( blake2s_state *S, size_t outlen );
int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen );
int blake2s_init_param( blake2s_state *S, const blake2s_param *P );
int blake2s_update( blake2s_state *S, const void *in, size_t inlen );
int blake2s_final( blake2s_state *S, void *out, size_t outlen );
int blake2b_init( blake2b_state *S, size_t outlen );
int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t keylen );
int blake2b_init_param( blake2b_state *S, const blake2b_param *P );
int blake2b_update( blake2b_state *S, const void *in, size_t inlen );
int blake2b_final( blake2b_state *S, void *out, size_t outlen );
int blake2sp_init( blake2sp_state *S, size_t outlen );
int blake2sp_init_key( blake2sp_state *S, size_t outlen, const void *key, size_t keylen );
int blake2sp_update( blake2sp_state *S, const void *in, size_t inlen );
int blake2sp_final( blake2sp_state *S, void *out, size_t outlen );
int blake2bp_init( blake2bp_state *S, size_t outlen );
int blake2bp_init_key( blake2bp_state *S, size_t outlen, const void *key, size_t keylen );
int blake2bp_update( blake2bp_state *S, const void *in, size_t inlen );
int blake2bp_final( blake2bp_state *S, void *out, size_t outlen );
/* Variable output length API */
int blake2xs_init( blake2xs_state *S, const size_t outlen );
int blake2xs_init_key( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen );
int blake2xs_update( blake2xs_state *S, const void *in, size_t inlen );
int blake2xs_final(blake2xs_state *S, void *out, size_t outlen);
int blake2xb_init( blake2xb_state *S, const size_t outlen );
int blake2xb_init_key( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen );
int blake2xb_update( blake2xb_state *S, const void *in, size_t inlen );
int blake2xb_final(blake2xb_state *S, void *out, size_t outlen);
/* Simple API */
int blake2s( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
int blake2b( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
int blake2sp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
int blake2bp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
int blake2xs( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
int blake2xb( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
/* This is simply an alias for blake2b */
int blake2( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
#if defined(__cplusplus)
}
#endif
#endif

379
src/crypto/blake2b-ref.c Normal file
View file

@ -0,0 +1,379 @@
/*
BLAKE2 reference source code package - reference C implementations
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
your option. The terms of these licenses can be found at:
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "blake2.h"
#include "blake2-impl.h"
static const uint64_t blake2b_IV[8] =
{
0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL,
0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL,
0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
};
static const uint8_t blake2b_sigma[12][16] =
{
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } ,
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }
};
static void blake2b_set_lastnode( blake2b_state *S )
{
S->f[1] = (uint64_t)-1;
}
/* Some helper functions, not necessarily useful */
static int blake2b_is_lastblock( const blake2b_state *S )
{
return S->f[0] != 0;
}
static void blake2b_set_lastblock( blake2b_state *S )
{
if( S->last_node ) blake2b_set_lastnode( S );
S->f[0] = (uint64_t)-1;
}
static void blake2b_increment_counter( blake2b_state *S, const uint64_t inc )
{
S->t[0] += inc;
S->t[1] += ( S->t[0] < inc );
}
static void blake2b_init0( blake2b_state *S )
{
size_t i;
memset( S, 0, sizeof( blake2b_state ) );
for( i = 0; i < 8; ++i ) S->h[i] = blake2b_IV[i];
}
/* init xors IV with input parameter block */
int blake2b_init_param( blake2b_state *S, const blake2b_param *P )
{
const uint8_t *p = ( const uint8_t * )( P );
size_t i;
blake2b_init0( S );
/* IV XOR ParamBlock */
for( i = 0; i < 8; ++i )
S->h[i] ^= load64( p + sizeof( S->h[i] ) * i );
S->outlen = P->digest_length;
return 0;
}
int blake2b_init( blake2b_state *S, size_t outlen )
{
blake2b_param P[1];
if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
P->digest_length = (uint8_t)outlen;
P->key_length = 0;
P->fanout = 1;
P->depth = 1;
store32( &P->leaf_length, 0 );
store32( &P->node_offset, 0 );
store32( &P->xof_length, 0 );
P->node_depth = 0;
P->inner_length = 0;
memset( P->reserved, 0, sizeof( P->reserved ) );
memset( P->salt, 0, sizeof( P->salt ) );
memset( P->personal, 0, sizeof( P->personal ) );
return blake2b_init_param( S, P );
}
int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t keylen )
{
blake2b_param P[1];
if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
if ( !key || !keylen || keylen > BLAKE2B_KEYBYTES ) return -1;
P->digest_length = (uint8_t)outlen;
P->key_length = (uint8_t)keylen;
P->fanout = 1;
P->depth = 1;
store32( &P->leaf_length, 0 );
store32( &P->node_offset, 0 );
store32( &P->xof_length, 0 );
P->node_depth = 0;
P->inner_length = 0;
memset( P->reserved, 0, sizeof( P->reserved ) );
memset( P->salt, 0, sizeof( P->salt ) );
memset( P->personal, 0, sizeof( P->personal ) );
if( blake2b_init_param( S, P ) < 0 ) return -1;
{
uint8_t block[BLAKE2B_BLOCKBYTES];
memset( block, 0, BLAKE2B_BLOCKBYTES );
memcpy( block, key, keylen );
blake2b_update( S, block, BLAKE2B_BLOCKBYTES );
secure_zero_memory( block, BLAKE2B_BLOCKBYTES ); /* Burn the key from stack */
}
return 0;
}
#define G(r,i,a,b,c,d) \
do { \
a = a + b + m[blake2b_sigma[r][2*i+0]]; \
d = rotr64(d ^ a, 32); \
c = c + d; \
b = rotr64(b ^ c, 24); \
a = a + b + m[blake2b_sigma[r][2*i+1]]; \
d = rotr64(d ^ a, 16); \
c = c + d; \
b = rotr64(b ^ c, 63); \
} while(0)
#define ROUND(r) \
do { \
G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \
G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \
G(r,2,v[ 2],v[ 6],v[10],v[14]); \
G(r,3,v[ 3],v[ 7],v[11],v[15]); \
G(r,4,v[ 0],v[ 5],v[10],v[15]); \
G(r,5,v[ 1],v[ 6],v[11],v[12]); \
G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \
G(r,7,v[ 3],v[ 4],v[ 9],v[14]); \
} while(0)
static void blake2b_compress( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] )
{
uint64_t m[16];
uint64_t v[16];
size_t i;
for( i = 0; i < 16; ++i ) {
m[i] = load64( block + i * sizeof( m[i] ) );
}
for( i = 0; i < 8; ++i ) {
v[i] = S->h[i];
}
v[ 8] = blake2b_IV[0];
v[ 9] = blake2b_IV[1];
v[10] = blake2b_IV[2];
v[11] = blake2b_IV[3];
v[12] = blake2b_IV[4] ^ S->t[0];
v[13] = blake2b_IV[5] ^ S->t[1];
v[14] = blake2b_IV[6] ^ S->f[0];
v[15] = blake2b_IV[7] ^ S->f[1];
ROUND( 0 );
ROUND( 1 );
ROUND( 2 );
ROUND( 3 );
ROUND( 4 );
ROUND( 5 );
ROUND( 6 );
ROUND( 7 );
ROUND( 8 );
ROUND( 9 );
ROUND( 10 );
ROUND( 11 );
for( i = 0; i < 8; ++i ) {
S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
}
}
#undef G
#undef ROUND
int blake2b_update( blake2b_state *S, const void *pin, size_t inlen )
{
const unsigned char * in = (const unsigned char *)pin;
if( inlen > 0 )
{
size_t left = S->buflen;
size_t fill = BLAKE2B_BLOCKBYTES - left;
if( inlen > fill )
{
S->buflen = 0;
memcpy( S->buf + left, in, fill ); /* Fill buffer */
blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
blake2b_compress( S, S->buf ); /* Compress */
in += fill; inlen -= fill;
while(inlen > BLAKE2B_BLOCKBYTES) {
blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
blake2b_compress( S, in );
in += BLAKE2B_BLOCKBYTES;
inlen -= BLAKE2B_BLOCKBYTES;
}
}
memcpy( S->buf + S->buflen, in, inlen );
S->buflen += inlen;
}
return 0;
}
int blake2b_final( blake2b_state *S, void *out, size_t outlen )
{
uint8_t buffer[BLAKE2B_OUTBYTES] = {0};
size_t i;
if( out == NULL || outlen < S->outlen )
return -1;
if( blake2b_is_lastblock( S ) )
return -1;
blake2b_increment_counter( S, S->buflen );
blake2b_set_lastblock( S );
memset( S->buf + S->buflen, 0, BLAKE2B_BLOCKBYTES - S->buflen ); /* Padding */
blake2b_compress( S, S->buf );
for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
store64( buffer + sizeof( S->h[i] ) * i, S->h[i] );
memcpy( out, buffer, S->outlen );
secure_zero_memory(buffer, sizeof(buffer));
return 0;
}
/* inlen, at least, should be uint64_t. Others can be size_t. */
int blake2b( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen )
{
blake2b_state S[1];
/* Verify parameters */
if ( NULL == in && inlen > 0 ) return -1;
if ( NULL == out ) return -1;
if( NULL == key && keylen > 0 ) return -1;
if( !outlen || outlen > BLAKE2B_OUTBYTES ) return -1;
if( keylen > BLAKE2B_KEYBYTES ) return -1;
if( keylen > 0 )
{
if( blake2b_init_key( S, outlen, key, keylen ) < 0 ) return -1;
}
else
{
if( blake2b_init( S, outlen ) < 0 ) return -1;
}
blake2b_update( S, ( const uint8_t * )in, inlen );
blake2b_final( S, out, outlen );
return 0;
}
int blake2( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen ) {
return blake2b(out, outlen, in, inlen, key, keylen);
}
#if defined(SUPERCOP)
int crypto_hash( unsigned char *out, unsigned char *in, unsigned long long inlen )
{
return blake2b( out, BLAKE2B_OUTBYTES, in, inlen, NULL, 0 );
}
#endif
#if defined(BLAKE2B_SELFTEST)
#include <string.h>
#include "blake2-kat.h"
int main( void )
{
uint8_t key[BLAKE2B_KEYBYTES];
uint8_t buf[BLAKE2_KAT_LENGTH];
size_t i, step;
for( i = 0; i < BLAKE2B_KEYBYTES; ++i )
key[i] = ( uint8_t )i;
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
buf[i] = ( uint8_t )i;
/* Test simple API */
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
{
uint8_t hash[BLAKE2B_OUTBYTES];
blake2b( hash, BLAKE2B_OUTBYTES, buf, i, key, BLAKE2B_KEYBYTES );
if( 0 != memcmp( hash, blake2b_keyed_kat[i], BLAKE2B_OUTBYTES ) )
{
goto fail;
}
}
/* Test streaming API */
for(step = 1; step < BLAKE2B_BLOCKBYTES; ++step) {
for (i = 0; i < BLAKE2_KAT_LENGTH; ++i) {
uint8_t hash[BLAKE2B_OUTBYTES];
blake2b_state S;
uint8_t * p = buf;
size_t mlen = i;
int err = 0;
if( (err = blake2b_init_key(&S, BLAKE2B_OUTBYTES, key, BLAKE2B_KEYBYTES)) < 0 ) {
goto fail;
}
while (mlen >= step) {
if ( (err = blake2b_update(&S, p, step)) < 0 ) {
goto fail;
}
mlen -= step;
p += step;
}
if ( (err = blake2b_update(&S, p, mlen)) < 0) {
goto fail;
}
if ( (err = blake2b_final(&S, hash, BLAKE2B_OUTBYTES)) < 0) {
goto fail;
}
if (0 != memcmp(hash, blake2b_keyed_kat[i], BLAKE2B_OUTBYTES)) {
goto fail;
}
}
}
puts( "ok" );
return 0;
fail:
puts("error");
return -1;
}
#endif

View file

@ -304,7 +304,7 @@ namespace crypto {
ge_tobytes(&image, &point2);
}
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4200)
struct rs_comm_entry
{
@ -314,7 +314,7 @@ struct rs_comm_entry
hash h;
struct rs_comm_entry ab[];
};
POP_WARNINGS
POP_VS_WARNINGS
static inline size_t rs_comm_size(size_t pubs_count) {
return sizeof(rs_comm)+pubs_count * sizeof(rs_comm_entry);

View file

@ -17,7 +17,7 @@
#include "warnings.h"
PUSH_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_CLANG_WARNING(unused-private-field)
@ -236,3 +236,4 @@ POD_MAKE_COMPARABLE(crypto, signature)
POD_MAKE_COMPARABLE(crypto, key_derivation)
POD_MAKE_LESS_OPERATOR(crypto, hash)
POD_MAKE_LESS_OPERATOR(crypto, key_image)
POP_GCC_WARNINGS

View file

@ -22,7 +22,7 @@ static inline const void *cpadd(const void *p, size_t i) {
return (const char *) p + i;
}
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4267)
static_assert(sizeof(size_t) == 4 || sizeof(size_t) == 8, "size_t must be 4 or 8 bytes long");
static inline void place_length(uint8_t *buffer, size_t bufsize, size_t length) {
@ -32,7 +32,7 @@ static inline void place_length(uint8_t *buffer, size_t bufsize, size_t length)
*(uint64_t *) padd(buffer, bufsize - 8) = swap64be(length);
}
}
POP_WARNINGS
POP_VS_WARNINGS
#pragma pack(push, 1)
union hash_state {

View file

@ -8,7 +8,11 @@
#include "common/pod-class.h"
#include "generic-ops.h"
#include "warnings.h"
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4804)
#include "blake2.h"
POP_VS_WARNINGS
namespace crypto {
extern "C" {
@ -41,6 +45,12 @@ namespace crypto {
tree_hash(reinterpret_cast<const char (*)[HASH_SIZE]>(hashes), count, reinterpret_cast<char *>(&root_hash));
}
inline hash blake2_hash(const void *data, std::size_t length) {
hash h;
blake2(&h, sizeof(h), data, length, nullptr, 0);
return h;
}
}
POD_MAKE_HASHABLE(crypto, hash)

View file

@ -1820,8 +1820,8 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_
main_cumul_diff.pow_diff = main_pow_diff_end - main_pow_diff_begin;
//TODO: measurement of precise cumulative difficult
wide_difficulty_type alt = get_a_to_b_relative_cumulative_difficulty(difficulty_pos_at_split_point, difficulty_pow_at_split_point, alt_cumul_diff, main_cumul_diff);
wide_difficulty_type main = get_a_to_b_relative_cumulative_difficulty(difficulty_pos_at_split_point, difficulty_pow_at_split_point, main_cumul_diff, alt_cumul_diff);
boost::multiprecision::uint1024_t alt = get_a_to_b_relative_cumulative_difficulty(difficulty_pos_at_split_point, difficulty_pow_at_split_point, alt_cumul_diff, main_cumul_diff);
boost::multiprecision::uint1024_t main = get_a_to_b_relative_cumulative_difficulty(difficulty_pos_at_split_point, difficulty_pow_at_split_point, main_cumul_diff, alt_cumul_diff);
LOG_PRINT_L1("[FORK_CHOICE]: " << ENDL
<< "difficulty_pow_at_split_point:" << difficulty_pow_at_split_point << ENDL
<< "difficulty_pos_at_split_point:" << difficulty_pos_at_split_point << ENDL

View file

@ -255,13 +255,13 @@ namespace currency
END_SERIALIZE()
};
struct tx_message
struct tx_derivation_hint
{
std::string msg;
BEGIN_SERIALIZE()
FIELD(msg)
END_SERIALIZE()
END_SERIALIZE()
};
struct tx_service_attachment
@ -382,7 +382,7 @@ namespace currency
END_SERIALIZE()
};
struct etc_tx_derivation_hint
struct etc_tx_uint16_t
{
uint16_t v;
BEGIN_SERIALIZE()
@ -390,7 +390,7 @@ namespace currency
END_SERIALIZE()
};
typedef boost::mpl::vector<tx_service_attachment, tx_comment, tx_payer, tx_receiver, tx_message, std::string, tx_crypto_checksum, etc_tx_time, etc_tx_details_unlock_time, etc_tx_details_expiration_time, etc_tx_details_flags, crypto::public_key, extra_attachment_info, extra_alias_entry, extra_user_data, extra_padding, etc_tx_derivation_hint, etc_tx_details_unlock_time2> all_payload_types;
typedef boost::mpl::vector<tx_service_attachment, tx_comment, tx_payer, tx_receiver, tx_derivation_hint, std::string, tx_crypto_checksum, etc_tx_time, etc_tx_details_unlock_time, etc_tx_details_expiration_time, etc_tx_details_flags, crypto::public_key, extra_attachment_info, extra_alias_entry, extra_user_data, extra_padding, etc_tx_uint16_t, etc_tx_details_unlock_time2> all_payload_types;
typedef boost::make_variant_over<all_payload_types>::type attachment_v;
typedef boost::make_variant_over<all_payload_types>::type extra_v;
typedef boost::make_variant_over<all_payload_types>::type payload_items_v;
@ -602,7 +602,7 @@ SET_VARIANT_TAGS(currency::tx_comment, 7, "comment");
SET_VARIANT_TAGS(currency::tx_payer, 8, "payer");
SET_VARIANT_TAGS(std::string, 9, "string");
SET_VARIANT_TAGS(currency::tx_crypto_checksum, 10, "checksum");
SET_VARIANT_TAGS(currency::tx_message, 11, "message");
SET_VARIANT_TAGS(currency::tx_derivation_hint, 11, "derivation_hint");
SET_VARIANT_TAGS(currency::tx_service_attachment, 12, "attachment");
//SET_VARIANT_TAGS(currency::tx_onetime_secret_key, 13, "sec_key");
SET_VARIANT_TAGS(currency::etc_tx_details_unlock_time, 14, "unlock_time");
@ -616,7 +616,7 @@ SET_VARIANT_TAGS(currency::extra_user_data, 19, "user_data");
SET_VARIANT_TAGS(currency::extra_alias_entry, 20, "alias_entry");
SET_VARIANT_TAGS(currency::extra_padding, 21, "extra_padding");
SET_VARIANT_TAGS(crypto::public_key, 22, "pub_key");
SET_VARIANT_TAGS(currency::etc_tx_derivation_hint, 23, "derive_hint");
SET_VARIANT_TAGS(currency::etc_tx_uint16_t, 23, "etc_tx_uint16");
SET_VARIANT_TAGS(uint16_t, 24, "derive_xor");
//txout_v
SET_VARIANT_TAGS(currency::ref_by_id, 25, "ref_by_id");

View file

@ -107,7 +107,7 @@ namespace boost
a & x.derivation_hash;
}
template <class Archive>
inline void serialize(Archive &a, currency::tx_message &x, const boost::serialization::version_type ver)
inline void serialize(Archive &a, currency::tx_derivation_hint &x, const boost::serialization::version_type ver)
{
a & x.msg;
}
@ -211,7 +211,7 @@ namespace boost
}
template <class Archive>
inline void serialize(Archive &a, currency::etc_tx_derivation_hint &at, const boost::serialization::version_type ver)
inline void serialize(Archive &a, currency::etc_tx_uint16_t&at, const boost::serialization::version_type ver)
{
a & at.v;
}

View file

@ -21,7 +21,7 @@
#include "warnings.h"
#include "crypto/hash.h"
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4355)
namespace currency
@ -159,4 +159,4 @@ namespace currency
};
}
POP_WARNINGS
POP_VS_WARNINGS

View file

@ -516,6 +516,17 @@ namespace currency
return r;
}
//---------------------------------------------------------------
uint16_t get_derivation_hint(const crypto::key_derivation& derivation)
{
crypto::hash h = blake2_hash(&derivation, sizeof(derivation));
uint16_t* pderiv_hash_as_array = (uint16_t*)&h;
uint16_t res = pderiv_hash_as_array[0];
for (size_t i = 1; i != sizeof(h) / sizeof(uint16_t); i++)
res ^= pderiv_hash_as_array[i];
return res;
}
//---------------------------------------------------------------
uint64_t get_string_uint64_hash(const std::string& str)
{
crypto::hash h = crypto::cn_fast_hash(str.data(), str.size());
@ -523,15 +534,22 @@ namespace currency
return phash_as_array[0] ^ phash_as_array[1] ^ phash_as_array[2] ^ phash_as_array[3];
}
//---------------------------------------------------------------
uint16_t get_derivation_xor(const crypto::key_derivation& derivation)
tx_derivation_hint make_tx_derivation_hint_from_uint16(uint16_t hint)
{
uint16_t* pderiv_as_array = (uint16_t*)&derivation;
uint16_t res = pderiv_as_array[0];
for (size_t i = 1; i != sizeof(derivation) / sizeof(uint16_t); i++)
res ^= pderiv_as_array[i];
return res;
tx_derivation_hint dh = AUTO_VAL_INIT(dh);
dh.msg.assign((const char*)&hint, sizeof(hint));
return dh;
}
//---------------------------------------------------------------
// bool get_uint16_from_tx_derivation_hint(const tx_derivation_hint& dh, uint16_t& hint)
// {
// tx_derivation_hint dh;
// if (dh.msg.size() != sizeof(hint))
// return false;
// hint = *((uint16_t*)dh.msg.data());
// return true;
// }
//---------------------------------------------------------------
bool construct_tx_out(const tx_destination_entry& de, const crypto::secret_key& tx_sec_key, size_t output_index, transaction& tx, std::set<uint16_t>& deriv_cache, uint8_t tx_outs_attr)
{
CHECK_AND_ASSERT_MES(de.addr.size() == 1 || (de.addr.size() > 1 && de.minimum_sigs <= de.addr.size()), false, "Invalid destination entry: amount: " << de.amount << " minimum_sigs: " << de.minimum_sigs << " addr.size(): " << de.addr.size());
@ -551,12 +569,12 @@ namespace currency
crypto::key_derivation derivation = AUTO_VAL_INIT(derivation);
bool r = derive_public_key_from_target_address(apa, tx_sec_key, output_index, out_eph_public_key, derivation);
CHECK_AND_ASSERT_MES(r, false, "failed to derive_public_key_from_target_address");
etc_tx_derivation_hint dh = AUTO_VAL_INIT(dh);
dh.v = get_derivation_xor(derivation);
if (deriv_cache.count(dh.v) == 0)
uint16_t hint = get_derivation_hint(derivation);
if (deriv_cache.count(hint) == 0)
{
tx.extra.push_back(dh);
deriv_cache.insert(dh.v);
tx.extra.push_back(make_tx_derivation_hint_from_uint16(hint));
deriv_cache.insert(hint);
}
}
target_keys.push_back(out_eph_public_key);
@ -646,11 +664,6 @@ namespace currency
crypto::chacha_crypt(m.acc_addr, m_key);
m_was_crypted_entries = true;
}
void operator()(tx_message& m)
{
crypto::chacha_crypt(m.msg, m_key);
m_was_crypted_entries = true;
}
void operator()(tx_service_attachment& sa)
{
if (sa.flags&TX_SERVICE_ATTACHMENT_DEFLATE_BODY)
@ -686,13 +699,6 @@ namespace currency
rdecrypted_att.push_back(local_comment);
}
void operator()(const tx_message& m)
{
tx_message local_msg = m;
crypto::chacha_crypt(local_msg.msg, rkey);
rdecrypted_att.push_back(local_msg);
}
void operator()(const tx_service_attachment& sa)
{
tx_service_attachment local_sa = sa;
@ -1544,14 +1550,19 @@ namespace currency
bool check_tx_derivation_hint(const transaction& tx, const crypto::key_derivation& derivation)
{
bool found_der_xor = false;
uint16_t my_derive_xor = get_derivation_xor(derivation);
uint16_t my_derive_xor = get_derivation_hint(derivation);
tx_derivation_hint dh = make_tx_derivation_hint_from_uint16(my_derive_xor);
for (auto& e : tx.extra)
{
if (e.type() == typeid(etc_tx_derivation_hint))
if (e.type() == typeid(tx_derivation_hint))
{
found_der_xor = true;
if (my_derive_xor == boost::get<etc_tx_derivation_hint>(e).v)
return true;
const tx_derivation_hint& tdh = boost::get<tx_derivation_hint>(e);
if (tdh.msg.size() == sizeof(uint16_t))
{
found_der_xor = true;
if (dh.msg == tdh.msg)
return true;
}
}
}
//if tx doesn't have any hints - feature is not supported, use full scan
@ -2204,9 +2215,9 @@ namespace currency
return true;
}
bool operator()(const tx_message& ee)
bool operator()(const tx_derivation_hint& ee)
{
tv.type = "message";
tv.type = "derivation_hint";
tv.short_view = std::to_string(ee.msg.size()) + " bytes";
tv.datails_view = epee::string_tools::buff_to_hex_nodelimer(ee.msg);
@ -2220,7 +2231,7 @@ namespace currency
return true;
}
bool operator()(const etc_tx_derivation_hint& dh)
bool operator()(const etc_tx_uint16_t& dh)
{
tv.type = "XOR";
tv.short_view = epee::string_tools::pod_to_hex(dh);
@ -2702,7 +2713,7 @@ namespace currency
}
wide_difficulty_type get_a_to_b_relative_cumulative_difficulty(const wide_difficulty_type& difficulty_pos_at_split_point,
boost::multiprecision::uint1024_t get_a_to_b_relative_cumulative_difficulty(const wide_difficulty_type& difficulty_pos_at_split_point,
const wide_difficulty_type& difficulty_pow_at_split_point,
const difficulties& a_diff,
const difficulties& b_diff )
@ -2717,20 +2728,20 @@ namespace currency
boost::multiprecision::uint1024_t res =
(basic_sum * a_pow_cumulative_difficulty * a_pos_cumulative_difficulty) / (boost::multiprecision::uint1024_t(b_pow_cumulative_difficulty)*b_pos_cumulative_difficulty);
if (res > boost::math::tools::max_value<wide_difficulty_type>())
{
ASSERT_MES_AND_THROW("[INTERNAL ERROR]: Failed to get_a_to_b_relative_cumulative_difficulty, res = " << res << ENDL
<< ", difficulty_pos_at_split_point: " << difficulty_pos_at_split_point << ENDL
<< ", difficulty_pow_at_split_point:" << difficulty_pow_at_split_point << ENDL
<< ", a_pos_cumulative_difficulty:" << a_pos_cumulative_difficulty << ENDL
<< ", b_pos_cumulative_difficulty:" << b_pos_cumulative_difficulty << ENDL
<< ", a_pow_cumulative_difficulty:" << a_pow_cumulative_difficulty << ENDL
<< ", b_pow_cumulative_difficulty:" << b_pow_cumulative_difficulty << ENDL
);
}
// if (res > boost::math::tools::max_value<wide_difficulty_type>())
// {
// ASSERT_MES_AND_THROW("[INTERNAL ERROR]: Failed to get_a_to_b_relative_cumulative_difficulty, res = " << res << ENDL
// << ", difficulty_pos_at_split_point: " << difficulty_pos_at_split_point << ENDL
// << ", difficulty_pow_at_split_point:" << difficulty_pow_at_split_point << ENDL
// << ", a_pos_cumulative_difficulty:" << a_pos_cumulative_difficulty << ENDL
// << ", b_pos_cumulative_difficulty:" << b_pos_cumulative_difficulty << ENDL
// << ", a_pow_cumulative_difficulty:" << a_pow_cumulative_difficulty << ENDL
// << ", b_pow_cumulative_difficulty:" << b_pow_cumulative_difficulty << ENDL
// );
// }
TRY_ENTRY();
wide_difficulty_type short_res = res.convert_to<wide_difficulty_type>();
return short_res;
// wide_difficulty_type short_res = res.convert_to<wide_difficulty_type>();
return res;
CATCH_ENTRY_WITH_FORWARDING_EXCEPTION();
}

View file

@ -604,7 +604,7 @@ namespace currency
wide_difficulty_type pow_diff;
};
wide_difficulty_type get_a_to_b_relative_cumulative_difficulty(const wide_difficulty_type& difficulty_pos_at_split_point,
boost::multiprecision::uint1024_t get_a_to_b_relative_cumulative_difficulty(const wide_difficulty_type& difficulty_pos_at_split_point,
const wide_difficulty_type& difficulty_pow_at_split_point,
const difficulties& a_diff,
const difficulties& b_diff

View file

@ -19,7 +19,7 @@
#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL "currency_protocol"
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4355)
#define ASYNC_RELAY_MODE
@ -145,4 +145,4 @@ namespace currency
#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL NULL
POP_WARNINGS
POP_VS_WARNINGS

View file

@ -17,7 +17,7 @@
#include "currency_core/bc_offers_service.h"
#include "serialization/binary_utils.h"
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4100)
class daemon_commands_handler
@ -874,4 +874,4 @@ private:
};
POP_WARNINGS
POP_VS_WARNINGS

View file

@ -8,7 +8,7 @@
#include <boost/program_options.hpp>
#include "warnings.h"
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4100)
DISABLE_VS_WARNINGS(4503)
#include "include_base_utils.h"
@ -30,7 +30,7 @@ using namespace epee;
#include "wallet/wallet2.h"
#include "wallet_id_adapter.h"
POP_WARNINGS
POP_VS_WARNINGS
namespace po = boost::program_options;

View file

@ -11,7 +11,7 @@
#ifndef Q_MOC_RUN
#include "warnings.h"
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4100)
DISABLE_VS_WARNINGS(4503)
#include "serialization/keyvalue_serialization.h"
@ -20,7 +20,7 @@ DISABLE_VS_WARNINGS(4503)
#include "wallet/wallet_rpc_server_commans_defs.h"
#include "currency_core/offers_services_helpers.h"
#include "currency_core/basic_api_response_codes.h"
POP_WARNINGS
POP_VS_WARNINGS
#endif

View file

@ -1,19 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
<!-- Generator: Adobe Illustrator 23.0.5, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st0{fill:#42A5F5;}
</style>
<title>icons_5</title>
<g id="f31d9964-f67b-451c-9eb6-78b833647305">
<path class="st0" d="M299.9,197.6c9.3-16.7,14.2-35.5,14.1-54.6c0-70-43.4-105-97-105s-97,35-97,105c-0.1,19.1,4.8,38,14.2,54.6
C89.2,218.8,68.5,274.1,50,346l334-0.1C365.5,274,344.8,218.8,299.9,197.6z M178.1,94c11.6-11.6,27.6-14,38.9-14s27.3,2.4,38.9,14
c13.3,13.2,16.1,34,16.1,49c0,34.7-24.7,63-55,63s-55-28.3-55-63C162,115.7,170.7,101.3,178.1,94z M128.8,256.5
c10.1-14.3,21.1-22.1,36.1-25c31.4,22,73.1,22,104.5-0.1c14.9,2.9,25.9,10.8,35.9,25c8.9,12.6,16.3,29.3,22.7,47.5L106.1,304
C112.5,285.8,119.9,269.1,128.8,256.5z"/>
<path class="st0" d="M32.5,261H0v42h18.2C23,287,27.6,273.3,32.5,261z"/>
<path class="st0" d="M83,182c-0.9-3.6-1.7-7.3-2.4-11H0v42h56.8C64.2,201.6,73,191.2,83,182z"/>
<path class="st0" d="M88.8,81H0v42h79C80.4,108.6,83.7,94.5,88.8,81z"/>
</g>
<path class="st0" d="M299.8688965,197.5991211C309.2000122,180.9190063,314.0674133,162.1126099,314,143c0-70-43.4283447-105-97-105
s-97,35-97,105c-0.067482,19.1287231,4.8083801,37.9504089,14.1549072,54.6403809
C89.2226563,218.8474121,68.4660568,274.09021,50,346l334-0.0964355
C365.5390625,274.013916,344.7792969,218.8364258,299.8688965,197.5991211z M178.0637207,93.9938965
C189.6651611,82.4277267,205.6410065,80,217,80s27.3348389,2.4277267,38.9362793,13.9938965
C269.2130127,107.2301025,272,127.9494629,272,143c0,34.7382813-24.6730042,63-55,63s-55-28.2617188-55-63
C162,115.7322998,170.7354736,101.2995605,178.0637207,93.9938965z M128.7593994,256.5493164
c10.1036377-14.295166,21.1329346-22.1210938,36.0562744-25.0251465
c31.352066,21.9882507,73.1230164,21.9658966,104.4515381-0.0559082
c14.8673096,2.9362793,25.869751,10.7570801,35.944458,24.9881592
c8.9063721,12.5805664,16.3375244,29.3043213,22.7064209,47.4633789l-221.8294678,0.0639954
C112.4510498,285.8366699,119.87146,269.1243896,128.7593994,256.5493164z"/>
<path class="st0" d="M32.4565392,261H0v42h18.2427998C22.95117,287.0407715,27.6054707,273.2824707,32.4565392,261z"/>
<path class="st0" d="M82.9628906,181.9945068C82.0220032,178.3674316,81.2279968,174.6973877,80.5518799,171H0v42h56.8131104
C64.2091751,201.6196442,72.9933243,191.2043915,82.9628906,181.9945068z"/>
<path class="st0" d="M88.7985764,81H0v42h78.9995117C80.3876266,108.6271896,83.6829224,94.5031357,88.7985764,81z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because one or more lines are too long

View file

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g id="logout">
<polygon class="st0" points="68.5,0 68.5,90 110.5,90 110.5,42 341.5,42 341.5,342 110.5,342 110.5,294 68.5,294 68.5,384
383.5,384 383.5,0 "/>
<polygon class="st0" points="194.5,270 282,192 194.5,114.5 194.5,171 0,171 0,213 194.5,213 "/>
</g>
<svg id="ab50e553-f2b3-4433-b3ff-0d9613f08375" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 383.5 384">
<defs>
<style>
.ecae9e89-1a50-4e7d-886b-c0873462098f {
fill: #42a5f5;
}
</style>
</defs>
<title>exit</title>
<g id="be098581-bbc7-4930-ae81-d0f1e45068cd" data-name="logout">
<polygon class="ecae9e89-1a50-4e7d-886b-c0873462098f" points="68.5 0 68.5 90 110.5 90 110.5 42 341.5 42 341.5 342 110.5 342 110.5 294 68.5 294 68.5 384 383.5 384 383.5 0 68.5 0"/>
<polygon class="ecae9e89-1a50-4e7d-886b-c0873462098f" points="185.5 270 273 192 185.5 114.5 185.5 171 0 171 0 213 185.5 213 185.5 270"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 672 B

After

Width:  |  Height:  |  Size: 676 B

View file

@ -1,17 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g id="settings">
<path class="st0" d="M384,213.3v-42.7h-65.9c-3.1-18.9-10.4-37-21.3-52.7l46.5-46.5l-30.5-30.3L266,87.7
c-15.7-11-33.8-18.3-52.7-21.3V0h-42.7v65.9c-18.9,3.1-37,10.4-52.7,21.3L71.3,41.2L41.2,71.3L87.7,118
c-11,15.7-18.3,33.8-21.3,52.7H0v42.7h65.9c3.1,18.9,10.4,37,21.3,52.7l-46.1,46.7l30.1,30.1l46.5-46.5
c15.7,11,33.8,18.3,52.7,21.3V384h42.7v-65.9c18.9-3.1,37-10.4,52.7-21.3l46.5,46.5l30.1-30.1l-46.5-46.5
c11-15.7,18.3-33.8,21.3-52.7H384V213.3z M102.6,192c0-49.4,40-89.4,89.4-89.4s89.4,40,89.4,89.4s-40,89.4-89.4,89.4
C142.7,281.3,102.7,241.3,102.6,192z"/>
<circle class="st0" cx="192" cy="192" r="41"/>
</g>
<svg id="a22f0928-30d8-4699-903e-959bbb5157b6" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384.00001 384.00001">
<defs>
<style>
.b2acf0b3-a12d-45f7-a117-55ab824eefa9 {
fill: #42a5f5;
}
</style>
</defs>
<title>settings</title>
<g id="aa4a36a4-78af-43f5-b1fa-6aab82396505" data-name="settings">
<path class="b2acf0b3-a12d-45f7-a117-55ab824eefa9" d="M384,213.33334V170.66667H318.08a127.9996,127.9996,0,0,0-21.33334-52.69334l46.50668-46.50667L312.74667,41.17333,266.02668,87.68a128.00008,128.00008,0,0,0-52.69334-21.33334V0H170.66667V65.92a128,128,0,0,0-52.69334,21.33333l-46.72-46.08-30.08,30.08,46.50668,46.72a128.00014,128.00014,0,0,0-21.33334,52.69334H0v42.66667H65.92a127.99993,127.99993,0,0,0,21.33333,52.69334l-46.08,46.72,30.08,30.08L117.76,296.32a127.99957,127.99957,0,0,0,52.69335,21.33333V384H213.12V318.08a127.99949,127.99949,0,0,0,52.69334-21.33334L312.32,343.25335l30.08-30.08-46.50668-46.50667a127.99973,127.99973,0,0,0,21.33334-52.69334H384ZM102.61334,192A89.38668,89.38668,0,1,1,192,281.38669,89.38664,89.38664,0,0,1,102.61334,192Z" transform="translate(0 0)"/>
<circle class="b2acf0b3-a12d-45f7-a117-55ab824eefa9" cx="192.00001" cy="192.00001" r="40.99999"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1,19 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
<!-- Generator: Adobe Illustrator 23.0.5, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st0{fill:#42A5F5;}
</style>
<title>icons_5</title>
<g id="f31d9964-f67b-451c-9eb6-78b833647305">
<path class="st0" d="M299.9,197.6c9.3-16.7,14.2-35.5,14.1-54.6c0-70-43.4-105-97-105s-97,35-97,105c-0.1,19.1,4.8,38,14.2,54.6
C89.2,218.8,68.5,274.1,50,346l334-0.1C365.5,274,344.8,218.8,299.9,197.6z M178.1,94c11.6-11.6,27.6-14,38.9-14s27.3,2.4,38.9,14
c13.3,13.2,16.1,34,16.1,49c0,34.7-24.7,63-55,63s-55-28.3-55-63C162,115.7,170.7,101.3,178.1,94z M128.8,256.5
c10.1-14.3,21.1-22.1,36.1-25c31.4,22,73.1,22,104.5-0.1c14.9,2.9,25.9,10.8,35.9,25c8.9,12.6,16.3,29.3,22.7,47.5L106.1,304
C112.5,285.8,119.9,269.1,128.8,256.5z"/>
<path class="st0" d="M32.5,261H0v42h18.2C23,287,27.6,273.3,32.5,261z"/>
<path class="st0" d="M83,182c-0.9-3.6-1.7-7.3-2.4-11H0v42h56.8C64.2,201.6,73,191.2,83,182z"/>
<path class="st0" d="M88.8,81H0v42h79C80.4,108.6,83.7,94.5,88.8,81z"/>
</g>
<path class="st0" d="M299.8688965,197.5991211C309.2000122,180.9190063,314.0674133,162.1126099,314,143c0-70-43.4283447-105-97-105
s-97,35-97,105c-0.067482,19.1287231,4.8083801,37.9504089,14.1549072,54.6403809
C89.2226563,218.8474121,68.4660568,274.09021,50,346l334-0.0964355
C365.5390625,274.013916,344.7792969,218.8364258,299.8688965,197.5991211z M178.0637207,93.9938965
C189.6651611,82.4277267,205.6410065,80,217,80s27.3348389,2.4277267,38.9362793,13.9938965
C269.2130127,107.2301025,272,127.9494629,272,143c0,34.7382813-24.6730042,63-55,63s-55-28.2617188-55-63
C162,115.7322998,170.7354736,101.2995605,178.0637207,93.9938965z M128.7593994,256.5493164
c10.1036377-14.295166,21.1329346-22.1210938,36.0562744-25.0251465
c31.352066,21.9882507,73.1230164,21.9658966,104.4515381-0.0559082
c14.8673096,2.9362793,25.869751,10.7570801,35.944458,24.9881592
c8.9063721,12.5805664,16.3375244,29.3043213,22.7064209,47.4633789l-221.8294678,0.0639954
C112.4510498,285.8366699,119.87146,269.1243896,128.7593994,256.5493164z"/>
<path class="st0" d="M32.4565392,261H0v42h18.2427998C22.95117,287.0407715,27.6054707,273.2824707,32.4565392,261z"/>
<path class="st0" d="M82.9628906,181.9945068C82.0220032,178.3674316,81.2279968,174.6973877,80.5518799,171H0v42h56.8131104
C64.2091751,201.6196442,72.9933243,191.2043915,82.9628906,181.9945068z"/>
<path class="st0" d="M88.7985764,81H0v42h78.9995117C80.3876266,108.6271896,83.6829224,94.5031357,88.7985764,81z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1024 1024" style="enable-background:new 0 0 1024 1024;" xml:space="preserve">
<style type="text/css">
.st0{fill:url(#SVGID_1_);}
.st1{fill:url(#SVGID_2_);}
.st2{fill:url(#SVGID_3_);}
</style>
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="512.55" y1="984.3" x2="512.55" y2="39.3" gradientTransform="matrix(1 0 0 -1 0 1024)">
<stop offset="0" style="stop-color:#1ECED0"/>
<stop offset="0.5" style="stop-color:#8AA9F4"/>
<stop offset="1" style="stop-color:#6A44FB"/>
</linearGradient>
<polygon class="st0" points="679.6,984.7 193.5,305.1 344.4,39.7 831.6,715.3 "/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="217.75" y1="700.86" x2="217.75" y2="382.2152" gradientTransform="matrix(1 0 0 -1 0 1024)">
<stop offset="0" style="stop-color:#57B7E3"/>
<stop offset="1" style="stop-color:#7E8AF4;stop-opacity:0"/>
</linearGradient>
<polygon class="st1" points="193.5,305.1 435.5,643.4 0,643.4 "/>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="807.25" y1="332.3745" x2="807.25" y2="641.9303" gradientTransform="matrix(1 0 0 -1 0 1024)">
<stop offset="0" style="stop-color:#7C83F4"/>
<stop offset="1" style="stop-color:#68B0E9;stop-opacity:0"/>
</linearGradient>
<polygon class="st2" points="831.6,715.3 590.5,381 1024,381 "/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g id="logout">
<polygon class="st0" points="68.5,0 68.5,90 110.5,90 110.5,42 341.5,42 341.5,342 110.5,342 110.5,294 68.5,294 68.5,384
383.5,384 383.5,0 "/>
<polygon class="st0" points="194.5,270 282,192 194.5,114.5 194.5,171 0,171 0,213 194.5,213 "/>
</g>
<svg id="ab50e553-f2b3-4433-b3ff-0d9613f08375" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 383.5 384">
<defs>
<style>
.ecae9e89-1a50-4e7d-886b-c0873462098f {
fill: #42a5f5;
}
</style>
</defs>
<title>exit</title>
<g id="be098581-bbc7-4930-ae81-d0f1e45068cd" data-name="logout">
<polygon class="ecae9e89-1a50-4e7d-886b-c0873462098f" points="68.5 0 68.5 90 110.5 90 110.5 42 341.5 42 341.5 342 110.5 342 110.5 294 68.5 294 68.5 384 383.5 384 383.5 0 68.5 0"/>
<polygon class="ecae9e89-1a50-4e7d-886b-c0873462098f" points="185.5 270 273 192 185.5 114.5 185.5 171 0 171 0 213 185.5 213 185.5 270"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 672 B

After

Width:  |  Height:  |  Size: 676 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -5800,8 +5800,8 @@ __webpack_require__.r(__webpack_exports__);
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(/*! d:\Projects\zano\src\gui\qt-daemon\html_source\src\polyfills.ts */"./src/polyfills.ts");
module.exports = __webpack_require__(/*! d:\Projects\zano\src\gui\qt-daemon\html_source\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\jit-polyfills.js */"./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js");
__webpack_require__(/*! D:\Projects\Projects now\work\zano\src\gui\qt-daemon\html_source\src\polyfills.ts */"./src/polyfills.ts");
module.exports = __webpack_require__(/*! D:\Projects\Projects now\work\zano\src\gui\qt-daemon\html_source\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\jit-polyfills.js */"./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js");
/***/ })

View file

@ -1,17 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g id="settings">
<path class="st0" d="M384,213.3v-42.7h-65.9c-3.1-18.9-10.4-37-21.3-52.7l46.5-46.5l-30.5-30.3L266,87.7
c-15.7-11-33.8-18.3-52.7-21.3V0h-42.7v65.9c-18.9,3.1-37,10.4-52.7,21.3L71.3,41.2L41.2,71.3L87.7,118
c-11,15.7-18.3,33.8-21.3,52.7H0v42.7h65.9c3.1,18.9,10.4,37,21.3,52.7l-46.1,46.7l30.1,30.1l46.5-46.5
c15.7,11,33.8,18.3,52.7,21.3V384h42.7v-65.9c18.9-3.1,37-10.4,52.7-21.3l46.5,46.5l30.1-30.1l-46.5-46.5
c11-15.7,18.3-33.8,21.3-52.7H384V213.3z M102.6,192c0-49.4,40-89.4,89.4-89.4s89.4,40,89.4,89.4s-40,89.4-89.4,89.4
C142.7,281.3,102.7,241.3,102.6,192z"/>
<circle class="st0" cx="192" cy="192" r="41"/>
</g>
<svg id="a22f0928-30d8-4699-903e-959bbb5157b6" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384.00001 384.00001">
<defs>
<style>
.b2acf0b3-a12d-45f7-a117-55ab824eefa9 {
fill: #42a5f5;
}
</style>
</defs>
<title>settings</title>
<g id="aa4a36a4-78af-43f5-b1fa-6aab82396505" data-name="settings">
<path class="b2acf0b3-a12d-45f7-a117-55ab824eefa9" d="M384,213.33334V170.66667H318.08a127.9996,127.9996,0,0,0-21.33334-52.69334l46.50668-46.50667L312.74667,41.17333,266.02668,87.68a128.00008,128.00008,0,0,0-52.69334-21.33334V0H170.66667V65.92a128,128,0,0,0-52.69334,21.33333l-46.72-46.08-30.08,30.08,46.50668,46.72a128.00014,128.00014,0,0,0-21.33334,52.69334H0v42.66667H65.92a127.99993,127.99993,0,0,0,21.33333,52.69334l-46.08,46.72,30.08,30.08L117.76,296.32a127.99957,127.99957,0,0,0,52.69335,21.33333V384H213.12V318.08a127.99949,127.99949,0,0,0,52.69334-21.33334L312.32,343.25335l30.08-30.08-46.50668-46.50667a127.99973,127.99973,0,0,0,21.33334-52.69334H384ZM102.61334,192A89.38668,89.38668,0,1,1,192,281.38669,89.38664,89.38664,0,0,1,102.61334,192Z" transform="translate(0 0)"/>
<circle class="b2acf0b3-a12d-45f7-a117-55ab824eefa9" cx="192.00001" cy="192.00001" r="40.99999"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,8 @@
import { SafeHTMLPipe } from './safe-html.pipe';
describe('SafeHTMLPipe', () => {
it('create an instance', () => {
const pipe = new SafeHTMLPipe();
expect(pipe).toBeTruthy();
});
});

View file

@ -0,0 +1,15 @@
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
@Pipe({
name: 'safeHTML'
})
export class SafeHTMLPipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) { }
transform(html: string) {
return this.sanitizer.bypassSecurityTrustHtml(html);
}
}

View file

@ -40,6 +40,7 @@ import { IntToMoneyPipe } from './_helpers/pipes/int-to-money.pipe';
import { HistoryTypeMessagesPipe } from './_helpers/pipes/history-type-messages.pipe';
import { ContractStatusMessagesPipe } from './_helpers/pipes/contract-status-messages.pipe';
import { ContractTimeLeftPipe } from './_helpers/pipes/contract-time-left.pipe';
import { SafeHTMLPipe } from './_helpers/pipes/safe-html.pipe';
import { TooltipDirective } from './_helpers/directives/tooltip.directive';
import { InputValidateDirective } from './_helpers/directives/input-validate/input-validate.directive';
import { StakingSwitchComponent } from './_helpers/directives/staking-switch/staking-switch.component';
@ -118,7 +119,8 @@ export function highchartsFactory() {
ContactsComponent,
AddContactsComponent,
ContactSendComponent,
ExportImportComponent
ExportImportComponent,
SafeHTMLPipe
],
imports: [
BrowserModule,

View file

@ -59,16 +59,15 @@ export class HistoryComponent implements OnInit, OnDestroy, AfterViewChecked {
time(item: Transaction) {
const now = new Date().getTime();
const unlockTime = now + ((item.unlock_time - this.variablesService.height_app) * 60 * 1000);
const unlockTime = now + ((item.unlock_time - this.variablesService.height_max) * 60 * 1000);
return unlockTime;
}
isLocked(item: Transaction) {
if ((item.unlock_time > 500000000) && (item.unlock_time > new Date().getTime() / 1000)) {
console.log(new Date().getTime());
return true;
}
if ((item.unlock_time < 500000000) && (item.unlock_time > this.variablesService.height_app)) {
if ((item.unlock_time < 500000000) && (item.unlock_time > this.variablesService.height_max)) {
return true;
}
return false;

View file

@ -2,7 +2,7 @@
<div class="wrap-login">
<div class="logo"></div>
<div class="logo" [innerHTML]="logo | safeHTML"></div>
<form *ngIf="type === 'reg'" class="form-login" [formGroup]="regForm" (ngSubmit)="onSubmitCreatePass()">

View file

@ -14,9 +14,12 @@
max-width: 40rem;
.logo {
background: url(../../assets/icons/logo.svg) no-repeat center;
width: 100%;
height: 15rem;
display: flex;
justify-content: center;
&::ng-deep svg {
width: 14rem;
}
}
.form-login {

View file

@ -6,6 +6,8 @@ import {VariablesService} from '../_helpers/services/variables.service';
import {ModalService} from '../_helpers/services/modal.service';
import {Wallet} from '../_helpers/models/wallet.model';
import icons from '../../assets/icons/icons.json';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
@ -28,6 +30,8 @@ export class LoginComponent implements OnInit, OnDestroy {
type = 'reg';
logo = icons.logo;
constructor(
private route: ActivatedRoute,
private router: Router,

View file

@ -39,22 +39,35 @@
</div>
<div class="sidebar-settings">
<div class="wrap-button" routerLinkActive="active" *ngIf="variablesService.appPass === ''; else contactsShow" tooltip="{{ 'SIDEBAR.CONTACTS_TOOLTIP' | translate }}" placement="top" tooltipClass="table-tooltip account-tooltip" [delay]="500">
<button (click)="contactsRoute()" [class.disabled]="variablesService.daemon_state !== 2 || variablesService.appPass === ''" [disabled]="variablesService.daemon_state !== 2 || variablesService.appPass === ''">
<button (click)="contactsRoute()" [class.disabled]="variablesService.daemon_state !== 2 || variablesService.appPass === ''"
[disabled]="variablesService.daemon_state !== 2 || variablesService.appPass === ''">
<i class="icon contacts"></i>
<span>{{ 'SIDEBAR.CONTACTS' | translate }}</span>
</button>
</div>
<ng-template #contactsShow>
<div class="wrap-button" routerLinkActive="active">
<button (click)="contactsRoute()">
<i class="icon contacts"></i>
<button (click)="contactsRoute()"
(mouseover)="menuItem = true"
(mouseleave)="menuItem = false"
>
<i class="icon contacts" *ngIf="!menuItem; else svgContacts"></i>
<ng-template #svgContacts>
<div class="animated" [innerHTML]="contacts | safeHTML"></div>
</ng-template>
<span>{{ 'SIDEBAR.CONTACTS' | translate }}</span>
</button>
</div>
</ng-template>
<div class="wrap-button" routerLinkActive="active">
<button [routerLink]="['/settings']">
<i class="icon settings"></i>
<button [routerLink]="['/settings']"
(mouseover)="menuItemHovered = true"
(mouseleave)="menuItemHovered = false"
>
<i class="icon settings" *ngIf="!menuItemHovered; else svgSetting"></i>
<ng-template #svgSetting>
<div class="animated" [innerHTML]="settings | safeHTML"></div>
</ng-template>
<span>{{ 'SIDEBAR.SETTINGS' | translate }}</span>
</button>
</div>
@ -66,8 +79,15 @@
</div>
<ng-template #masterPass>
<div class="wrap-button">
<button (click)="logOut()">
<i class="icon logout"></i>
<button
(mouseover)="itemHovered = true"
(mouseleave)="itemHovered = false"
(click)="logOut()">
<i class="icon logout" *ngIf="!itemHovered; else svgLogout"></i>
<ng-template #svgLogout>
<div class="animated" [innerHTML]="exit | safeHTML"></div>
</ng-template>
<span>{{ 'SIDEBAR.LOG_OUT' | translate }}</span>
</button>
</div>

View file

@ -7,6 +7,23 @@
max-width: 25rem;
}
.animated {
display: flex;
justify-content: center;
align-items: center;
margin-right: 1.2rem;
&::ng-deep svg {
width: 2rem;
height: 2rem;
path, circle, polygon {
fill: #4db1ff;
}
}
}
.sidebar-accounts {
position: relative;
display: flex;
@ -204,8 +221,8 @@
.icon {
margin-right: 1.2rem;
width: 1.7rem;
height: 1.7rem;
width: 2rem;
height: 2rem;
&.contacts {
mask: url(../../assets/icons/contacts.svg) no-repeat center;

View file

@ -4,6 +4,8 @@ import {VariablesService} from '../_helpers/services/variables.service';
import {BackendService} from '../_helpers/services/backend.service';
import { ModalService } from '../_helpers/services/modal.service';
import icons from '../../assets/icons/icons.json';
@Component({
selector: 'app-sidebar',
templateUrl: './sidebar.component.html',
@ -14,6 +16,10 @@ export class SidebarComponent implements OnInit, OnDestroy {
walletActive: number;
contacts = icons.contacts;
settings = icons.settings;
exit = icons.exit;
constructor(
private route: ActivatedRoute,
private router: Router,

View file

@ -33,8 +33,11 @@
<div class="tabs">
<div class="tabs-header">
<ng-container *ngFor="let tab of tabs; let index = index">
<div class="tab" [class.active]="tab.active" [class.disabled]="(tab.link === '/send' || tab.link === '/contracts' || tab.link === '/staking') && (variablesService.daemon_state !== 2 || !variablesService.currentWallet.loaded)" (click)="changeTab(index)">
<i class="icon" [ngClass]="tab.icon"></i>
<div class="tab" [class.active]="tab.active" [class.disabled]="(tab.link === '/send' || tab.link === '/contracts' || tab.link === '/staking') && (variablesService.daemon_state !== 2 || !variablesService.currentWallet.loaded)" (click)="changeTab(index)" (mouseover)="itemHovered(index, true)" (mouseleave)="itemHovered(index, false)">
<i class="icon" [ngClass]="tab.icon" *ngIf="!tab.itemHovered; else svgAnimated"></i>
<ng-template #svgAnimated>
<div class="animated" [innerHTML]="tab.animated | safeHTML"></div>
</ng-template>
<span>{{ tab.title | translate }}</span>
<span class="indicator" *ngIf="tab.indicator">{{variablesService.currentWallet.new_contracts}}</span>
</div>

View file

@ -158,10 +158,27 @@
padding: 0 1rem;
height: 5rem;
.animated {
display: flex;
justify-content: center;
align-items: center;
margin-right: 1.3rem;
}
.animated ::ng-deep svg {
width: 2rem;
height: 2rem;
path, circle, polygon {
fill: #4db1ff;
}
}
.icon {
margin-right: 1.3rem;
width: 1.7rem;
height: 1.7rem;
width: 2rem;
height: 2rem;
&.send {
mask: url(../../assets/icons/send.svg) no-repeat center;

View file

@ -6,6 +6,8 @@ import {TranslateService} from '@ngx-translate/core';
import {IntToMoneyPipe} from '../_helpers/pipes/int-to-money.pipe';
import {Subscription} from 'rxjs';
import icons from '../../assets/icons/icons.json';
@Component({
selector: 'app-wallet',
templateUrl: './wallet.component.html',
@ -28,42 +30,54 @@ export class WalletComponent implements OnInit, OnDestroy {
icon: 'history',
link: '/history',
indicator: false,
active: true
active: true,
animated: icons.history,
itemHovered: false
},
{
title: 'WALLET.TABS.SEND',
icon: 'send',
link: '/send',
indicator: false,
active: false
active: false,
animated: icons.send,
itemHovered: false
},
{
title: 'WALLET.TABS.RECEIVE',
icon: 'receive',
link: '/receive',
indicator: false,
active: false
active: false,
animated: icons.receive,
itemHovered: false
},
{
title: 'WALLET.TABS.CONTRACTS',
icon: 'contracts',
link: '/contracts',
indicator: 1,
active: false
active: false,
animated: icons.contracts,
itemHovered: false
},
/*{
title: 'WALLET.TABS.MESSAGES',
icon: 'messages',
link: '/messages',
indicator: 32,
active: false
active: false,
animated: icons.messages,
itemHovered: false
},*/
{
title: 'WALLET.TABS.STAKING',
icon: 'staking',
link: '/staking',
indicator: false,
active: false
active: false,
animated: icons.staking,
itemHovered: false
}
];
aliasSubscription: Subscription;
@ -128,6 +142,10 @@ export class WalletComponent implements OnInit, OnDestroy {
});
}
itemHovered(index, state: boolean) {
this.tabs[index].itemHovered = state;
}
copyAddress() {
this.backend.setClipboard(this.variablesService.currentWallet.address);
this.copyAnimation = true;

View file

@ -1,19 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
<!-- Generator: Adobe Illustrator 23.0.5, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st0{fill:#42A5F5;}
</style>
<title>icons_5</title>
<g id="f31d9964-f67b-451c-9eb6-78b833647305">
<path class="st0" d="M299.9,197.6c9.3-16.7,14.2-35.5,14.1-54.6c0-70-43.4-105-97-105s-97,35-97,105c-0.1,19.1,4.8,38,14.2,54.6
C89.2,218.8,68.5,274.1,50,346l334-0.1C365.5,274,344.8,218.8,299.9,197.6z M178.1,94c11.6-11.6,27.6-14,38.9-14s27.3,2.4,38.9,14
c13.3,13.2,16.1,34,16.1,49c0,34.7-24.7,63-55,63s-55-28.3-55-63C162,115.7,170.7,101.3,178.1,94z M128.8,256.5
c10.1-14.3,21.1-22.1,36.1-25c31.4,22,73.1,22,104.5-0.1c14.9,2.9,25.9,10.8,35.9,25c8.9,12.6,16.3,29.3,22.7,47.5L106.1,304
C112.5,285.8,119.9,269.1,128.8,256.5z"/>
<path class="st0" d="M32.5,261H0v42h18.2C23,287,27.6,273.3,32.5,261z"/>
<path class="st0" d="M83,182c-0.9-3.6-1.7-7.3-2.4-11H0v42h56.8C64.2,201.6,73,191.2,83,182z"/>
<path class="st0" d="M88.8,81H0v42h79C80.4,108.6,83.7,94.5,88.8,81z"/>
</g>
<path class="st0" d="M299.8688965,197.5991211C309.2000122,180.9190063,314.0674133,162.1126099,314,143c0-70-43.4283447-105-97-105
s-97,35-97,105c-0.067482,19.1287231,4.8083801,37.9504089,14.1549072,54.6403809
C89.2226563,218.8474121,68.4660568,274.09021,50,346l334-0.0964355
C365.5390625,274.013916,344.7792969,218.8364258,299.8688965,197.5991211z M178.0637207,93.9938965
C189.6651611,82.4277267,205.6410065,80,217,80s27.3348389,2.4277267,38.9362793,13.9938965
C269.2130127,107.2301025,272,127.9494629,272,143c0,34.7382813-24.6730042,63-55,63s-55-28.2617188-55-63
C162,115.7322998,170.7354736,101.2995605,178.0637207,93.9938965z M128.7593994,256.5493164
c10.1036377-14.295166,21.1329346-22.1210938,36.0562744-25.0251465
c31.352066,21.9882507,73.1230164,21.9658966,104.4515381-0.0559082
c14.8673096,2.9362793,25.869751,10.7570801,35.944458,24.9881592
c8.9063721,12.5805664,16.3375244,29.3043213,22.7064209,47.4633789l-221.8294678,0.0639954
C112.4510498,285.8366699,119.87146,269.1243896,128.7593994,256.5493164z"/>
<path class="st0" d="M32.4565392,261H0v42h18.2427998C22.95117,287.0407715,27.6054707,273.2824707,32.4565392,261z"/>
<path class="st0" d="M82.9628906,181.9945068C82.0220032,178.3674316,81.2279968,174.6973877,80.5518799,171H0v42h56.8131104
C64.2091751,201.6196442,72.9933243,191.2043915,82.9628906,181.9945068z"/>
<path class="st0" d="M88.7985764,81H0v42h78.9995117C80.3876266,108.6271896,83.6829224,94.5031357,88.7985764,81z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because one or more lines are too long

View file

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g id="logout">
<polygon class="st0" points="68.5,0 68.5,90 110.5,90 110.5,42 341.5,42 341.5,342 110.5,342 110.5,294 68.5,294 68.5,384
383.5,384 383.5,0 "/>
<polygon class="st0" points="194.5,270 282,192 194.5,114.5 194.5,171 0,171 0,213 194.5,213 "/>
</g>
<svg id="ab50e553-f2b3-4433-b3ff-0d9613f08375" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 383.5 384">
<defs>
<style>
.ecae9e89-1a50-4e7d-886b-c0873462098f {
fill: #42a5f5;
}
</style>
</defs>
<title>exit</title>
<g id="be098581-bbc7-4930-ae81-d0f1e45068cd" data-name="logout">
<polygon class="ecae9e89-1a50-4e7d-886b-c0873462098f" points="68.5 0 68.5 90 110.5 90 110.5 42 341.5 42 341.5 342 110.5 342 110.5 294 68.5 294 68.5 384 383.5 384 383.5 0 68.5 0"/>
<polygon class="ecae9e89-1a50-4e7d-886b-c0873462098f" points="185.5 270 273 192 185.5 114.5 185.5 171 0 171 0 213 185.5 213 185.5 270"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 672 B

After

Width:  |  Height:  |  Size: 676 B

View file

@ -1,17 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g id="settings">
<path class="st0" d="M384,213.3v-42.7h-65.9c-3.1-18.9-10.4-37-21.3-52.7l46.5-46.5l-30.5-30.3L266,87.7
c-15.7-11-33.8-18.3-52.7-21.3V0h-42.7v65.9c-18.9,3.1-37,10.4-52.7,21.3L71.3,41.2L41.2,71.3L87.7,118
c-11,15.7-18.3,33.8-21.3,52.7H0v42.7h65.9c3.1,18.9,10.4,37,21.3,52.7l-46.1,46.7l30.1,30.1l46.5-46.5
c15.7,11,33.8,18.3,52.7,21.3V384h42.7v-65.9c18.9-3.1,37-10.4,52.7-21.3l46.5,46.5l30.1-30.1l-46.5-46.5
c11-15.7,18.3-33.8,21.3-52.7H384V213.3z M102.6,192c0-49.4,40-89.4,89.4-89.4s89.4,40,89.4,89.4s-40,89.4-89.4,89.4
C142.7,281.3,102.7,241.3,102.6,192z"/>
<circle class="st0" cx="192" cy="192" r="41"/>
</g>
<svg id="a22f0928-30d8-4699-903e-959bbb5157b6" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384.00001 384.00001">
<defs>
<style>
.b2acf0b3-a12d-45f7-a117-55ab824eefa9 {
fill: #42a5f5;
}
</style>
</defs>
<title>settings</title>
<g id="aa4a36a4-78af-43f5-b1fa-6aab82396505" data-name="settings">
<path class="b2acf0b3-a12d-45f7-a117-55ab824eefa9" d="M384,213.33334V170.66667H318.08a127.9996,127.9996,0,0,0-21.33334-52.69334l46.50668-46.50667L312.74667,41.17333,266.02668,87.68a128.00008,128.00008,0,0,0-52.69334-21.33334V0H170.66667V65.92a128,128,0,0,0-52.69334,21.33333l-46.72-46.08-30.08,30.08,46.50668,46.72a128.00014,128.00014,0,0,0-21.33334,52.69334H0v42.66667H65.92a127.99993,127.99993,0,0,0,21.33333,52.69334l-46.08,46.72,30.08,30.08L117.76,296.32a127.99957,127.99957,0,0,0,52.69335,21.33333V384H213.12V318.08a127.99949,127.99949,0,0,0,52.69334-21.33334L312.32,343.25335l30.08-30.08-46.50668-46.50667a127.99973,127.99973,0,0,0,21.33334-52.69334H384ZM102.61334,192A89.38668,89.38668,0,1,1,192,281.38669,89.38664,89.38664,0,0,1,102.61334,192Z" transform="translate(0 0)"/>
<circle class="b2acf0b3-a12d-45f7-a117-55ab824eefa9" cx="192.00001" cy="192.00001" r="40.99999"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -16,6 +16,8 @@
"lib": [
"es2018",
"dom"
]
],
"resolveJsonModule": true,
"esModuleInterop": true
}
}

View file

@ -35,7 +35,7 @@ using namespace epee;
#define CURRENT_P2P_STORAGE_ARCHIVE_VER (CURRENCY_FORMATION_VERSION+13)
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4355)
namespace nodetool
@ -300,4 +300,4 @@ namespace nodetool
#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL NULL
POP_WARNINGS
POP_VS_WARNINGS

View file

@ -31,10 +31,10 @@
#include <boost/algorithm/string/replace.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/basic_archive.hpp>
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4800)
#include <boost/archive/basic_binary_iarchive.hpp>
POP_WARNINGS
POP_VS_WARNINGS
#include <boost/archive/basic_binary_iprimitive.hpp>
#include <boost/archive/basic_binary_oarchive.hpp>
#include <boost/archive/basic_binary_oprimitive.hpp>

View file

@ -16,7 +16,7 @@
#include "common/varint.h"
#include "warnings.h"
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4244)
DISABLE_VS_WARNINGS(4100)
@ -172,4 +172,4 @@ struct binary_archive<true> : public binary_archive_base<std::ostream, true>
}
};
POP_WARNINGS
POP_VS_WARNINGS

View file

@ -331,7 +331,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
}
else
{
bool r = open_wallet(epee::string_encoding::convert_to_ansii(m_wallet_file), pwd_container.password());
bool r = open_wallet(m_wallet_file, pwd_container.password());
CHECK_AND_ASSERT_MES(r, false, "could not open account");
}
@ -379,7 +379,7 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas
m_wallet->set_do_rise_transfer(false);
try
{
m_wallet->generate(epee::string_encoding::convert_to_unicode(m_wallet_file), password);
m_wallet->generate(epee::string_encoding::utf8_to_wstring(m_wallet_file), password);
message_writer(epee::log_space::console_color_white, true) << "Generated new wallet: " << m_wallet->get_account().get_public_address_str();
std::cout << "view key: " << string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_view_secret_key) << std::endl << std::flush;
if(m_do_not_set_date)
@ -421,7 +421,7 @@ bool simple_wallet::restore_wallet(const std::string &wallet_file, const std::st
m_wallet->set_do_rise_transfer(false);
try
{
m_wallet->restore(epee::string_encoding::convert_to_unicode(wallet_file), password, restore_seed);
m_wallet->restore(epee::string_encoding::utf8_to_wstring(wallet_file), password, restore_seed);
message_writer(epee::log_space::console_color_white, true) << "Wallet restored: " << m_wallet->get_account().get_public_address_str();
std::cout << "view key: " << string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_view_secret_key) << std::endl << std::flush;
if (m_do_not_set_date)
@ -457,7 +457,7 @@ bool simple_wallet::open_wallet(const string &wallet_file, const std::string& pa
{
try
{
m_wallet->load(epee::string_encoding::convert_to_unicode(m_wallet_file), password);
m_wallet->load(epee::string_encoding::utf8_to_wstring(m_wallet_file), password);
message_writer(epee::log_space::console_color_white, true) << "Opened" << (m_wallet->is_watch_only() ? " watch-only" : "") << " wallet: " << m_wallet->get_account().get_public_address_str();
if (m_print_brain_wallet)
@ -1512,7 +1512,11 @@ bool simple_wallet::submit_transfer(const std::vector<std::string> &args)
return true;
}
//----------------------------------------------------------------------------------------------------
#ifdef WIN32
int wmain( int argc, wchar_t* argv_w[ ], wchar_t* envp[ ] )
#else
int main(int argc, char* argv[])
#endif
{
#ifdef WIN32
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
@ -1528,6 +1532,18 @@ int main(int argc, char* argv[])
std::fflush(nullptr);
});
#ifdef WIN32
// windows: convert argv_w into UTF-8-encoded std::string the same way it is in Linux and macOS
std::vector<std::string> argv_str(argc, "");
std::vector<const char*> argv_vec(argc, nullptr);
for (size_t i = 0; i < argc; ++i)
{
argv_str[i] = epee::string_encoding::wstring_to_utf8( argv_w[i] );
argv_vec[i] = argv_str[i].c_str();
}
const char* const* argv = argv_vec.data();
#endif
string_tools::set_module_name_and_folder(argv[0]);
po::options_description desc_general("General options");
@ -1662,7 +1678,7 @@ int main(int argc, char* argv[])
try
{
LOG_PRINT_L0("Loading wallet...");
wal.load(epee::string_encoding::convert_to_unicode(wallet_file), pwd_container.password());
wal.load(epee::string_encoding::utf8_to_wstring(wallet_file), pwd_container.password());
}
catch (const tools::error::wallet_load_notice_wallet_restored& e)
{

View file

@ -7,6 +7,6 @@
#define PROJECT_REVISION "0"
#define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION
#define PROJECT_VERSION_BUILD_NO 59
#define PROJECT_VERSION_BUILD_NO 62
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"

View file

@ -87,8 +87,8 @@ bool gen_checkpoints_attachments_basic::generate(std::vector<test_event_entry>&
tx_comment cm;
cm.comment = "This is tx comment.";
tx_message ms;
ms.msg = "This is tx message.";
std::string ms;
ms = "This is tx message.";
std::vector<currency::attachment_v> attachments;
attachments.push_back(cm);
@ -628,7 +628,7 @@ bool gen_no_attchments_in_coinbase::init_config_set_cp(currency::core& c, size_t
crc.pos_minimum_heigh = 1;
c.get_blockchain_storage().set_core_runtime_config(crc);
m_checkpoints.add_checkpoint(12, "2cb91dade404a4b1158d3250fe042399ecb12d1152b49900ea40d700bf4060ad");
m_checkpoints.add_checkpoint(12, "2a6e13df811eccce121c0de4dbdcc640de1d37c8459c2c8ea02af39717779836");
c.set_checkpoints(currency::checkpoints(m_checkpoints));
return true;

View file

@ -295,7 +295,7 @@ inline bool build_custom_escrow_proposal(const std::vector<test_event_entry>& ev
attachments.push_back(sa);
if (custom_config_mask & eccf_proposal_additional_attach)
attachments.push_back(tx_message({ get_random_text(1024) }));
attachments.push_back(std::string(get_random_text(1024)));
r = fill_tx_sources(sources, events, head, a_keys, a_fee_proposal, nmix, used_sources);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
@ -404,7 +404,7 @@ inline bool build_custom_escrow_release_template(
std::vector<attachment_v> attachments;
if (release_type == BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_BURN)
{
attachments.push_back(tx_message({ "We don't need no water -- so let all the coins burn!" })); // attachments are allowed and must be normally handled, so one of release template will always have them
attachments.push_back(std::string("We don't need no water -- so let all the coins burn!")); // attachments are allowed and must be normally handled, so one of release template will always have them
attachments.push_back(tx_comment({ "Burn, all the coins, burn!" }));
}

View file

@ -1622,7 +1622,7 @@ multisig_and_checkpoints::multisig_and_checkpoints()
bool multisig_and_checkpoints::set_cp(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
{
currency::checkpoints checkpoints;
checkpoints.add_checkpoint(15, "726c5900f2ed7985619a54ecad3a5f5a11176a0873c51acb46ac60126a71c30a");
checkpoints.add_checkpoint(15, "a8e535abb31cd2c07ebd65dbb8d4160954677a0cebcd3dadf81642297cc557af");
c.set_checkpoints(std::move(checkpoints));
return true;

View file

@ -791,12 +791,12 @@ bool gen_crypted_attachments::generate(std::vector<test_event_entry>& events) co
pr.acc_addr = miner_account.get_keys().m_account_address;
cm.comment = "Comandante Che Guevara";
ms.msg = "Hasta Siempre, Comandante";
//ms.msg = "Hasta Siempre, Comandante";
std::vector<currency::attachment_v> attachments;
attachments.push_back(pr);
attachments.push_back(cm);
attachments.push_back(ms);
//attachments.push_back(ms);
MAKE_TX_LIST_START(events, txs_list, miner_account, bob_account, MK_TEST_COINS(1), blk_5);
MAKE_TX_LIST_ATTACH(events, txs_list, miner_account, bob_account, MK_TEST_COINS(1), blk_5, attachments);
@ -934,7 +934,7 @@ bool gen_crypted_attachments::check_crypted_tx(currency::core& c, size_t ev_inde
std::vector<payload_items_v> at;
bool r = currency::decrypt_payload_items(true, *ptx_from_bc, bob_acc.get_keys(), at);
CHECK_EQ(r, true);
CHECK_EQ(at.size(), 8); // custom attachments: 1) tx_payer, 2) tx_comment, 3) tx_message; system attachments: 4) tx_crypto_checksum; system extra: 5) tx pub key, 6) extra_attachment_info
CHECK_EQ(at.size(), 7); // custom attachments: 1) tx_payer, 2) tx_comment, 3) std::string; system attachments: 4) tx_crypto_checksum; system extra: 5) tx pub key, 6) extra_attachment_info
currency::tx_payer decrypted_pr = AUTO_VAL_INIT(decrypted_pr);
r = get_type_in_variant_container(at, decrypted_pr);
@ -958,16 +958,16 @@ bool gen_crypted_attachments::check_crypted_tx(currency::core& c, size_t ev_inde
return false;
}
currency::tx_message decrypted_message = AUTO_VAL_INIT(decrypted_message);
r = get_type_in_variant_container(at, decrypted_message);
CHECK_AND_ASSERT_MES(r, false, "get_type_in_variant_container failed");
if (ms.msg != decrypted_message.msg)
{
LOG_ERROR("decrypted wrong data: "
<< decrypted_message.msg
<< "expected:" << ms.msg);
return false;
}
// currency::tx_message decrypted_message = AUTO_VAL_INIT(decrypted_message);
// r = get_type_in_variant_container(at, decrypted_message);
// CHECK_AND_ASSERT_MES(r, false, "get_type_in_variant_container failed");
// if (ms.msg != decrypted_message.msg)
// {
// LOG_ERROR("decrypted wrong data: "
// << decrypted_message.msg
// << "expected:" << ms.msg);
// return false;
// }
// now cancel attachment

View file

@ -118,7 +118,7 @@ struct gen_crypted_attachments : test_chain_unit_enchanced
mutable uint64_t offers_before_canel;
mutable currency::tx_payer pr;
mutable currency::tx_comment cm;
mutable currency::tx_message ms;
//mutable currency::tx_message ms;
};
struct gen_tx_extra_double_entry : test_chain_unit_enchanced

View file

@ -1439,8 +1439,8 @@ bool gen_wallet_decrypted_attachments::generate(std::vector<test_event_entry>& e
a_tx_payer.acc_addr = miner_acc.get_keys().m_account_address;
currency::tx_comment a_tx_comment = AUTO_VAL_INIT(a_tx_comment);
a_tx_comment.comment = "Comandante Che Guevara";
currency::tx_message a_tx_message = AUTO_VAL_INIT(a_tx_message);
a_tx_message.msg = "Hasta Siempre, Comandante";
std::string a_tx_message = AUTO_VAL_INIT(a_tx_message);
a_tx_message = "Hasta Siempre, Comandante";
{

View file

@ -15,7 +15,7 @@
#include "../io.h"
#include "warnings.h"
PUSH_WARNINGS
PUSH_GCC_WARNINGS
DISABLE_GCC_WARNING(strict-aliasing)
@ -250,4 +250,4 @@ error:
}
return error ? 1 : 0;
}
POP_WARNINGS
POP_GCC_WARNINGS

View file

@ -16,7 +16,7 @@ using namespace std;
using namespace crypto;
typedef crypto::hash chash;
PUSH_WARNINGS
PUSH_VS_WARNINGS
DISABLE_VS_WARNINGS(4297)
extern "C" {
static void hash_tree(const void *data, size_t length, char *hash) {
@ -26,7 +26,7 @@ extern "C" {
tree_hash((const char (*)[32]) data, length >> 5, hash);
}
}
POP_WARNINGS
POP_VS_WARNINGS
extern "C" typedef void hash_f(const void *, size_t, char *);
struct hash_func {

View file

@ -0,0 +1,60 @@
// Copyright (c) 2019 The Zano developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#pragma once
#include <string>
#include "include_base_utils.h"
#include "crypto/blake2.h"
inline
void test_blake2()
{
std::string message = "The quick brown fox jumps over the lazy dog";
static uint8_t buff[64] = {};
static uint8_t buff2[2] = {};
performance_timer timer;
timer.start();
for (size_t i = 0; i != 100000; i++)
{
*((size_t*)message.data()) = i;
blake2(buff, sizeof(buff), message.data(), message.size(), nullptr, 0);
}
std::cout << "x100000 blake2 operations, out 64 bytes. Elapsed time: " << timer.elapsed_ms() << " msec" << std::endl;
timer.start();
for (size_t i = 0; i != 1000000; i++)
{
*((size_t*)message.data()) = i;
blake2(buff, sizeof(buff), message.data(), message.size(), nullptr, 0);
}
std::cout << "x1000000 blake2 operations, out 64 bytes. Elapsed time: " << timer.elapsed_ms() << " msec" << std::endl;
timer.start();
for (size_t i = 0; i != 1000000; i++)
{
*((size_t*)message.data()) = i;
blake2(buff2, sizeof(buff2), message.data(), message.size(), nullptr, 0);
}
std::cout << "x1000000 blake2 operations, out 2 bytes. Elapsed time: " << timer.elapsed_ms() << " msec" << std::endl;
static crypto::hash h = AUTO_VAL_INIT(h);
timer.start();
for (size_t i = 0; i != 1000000; i++)
{
*((size_t*)message.data()) = i;
crypto::cn_fast_hash(message.data(), message.size(), h);
}
std::cout << "x1000000 cn_fast_hash operations, out 32 bytes. Elapsed time: " << timer.elapsed_ms() << " msec" << std::endl;
//std::cout << epee::string_tools::pod_to_hex(buff);
}

View file

@ -18,6 +18,7 @@
#include "core_market_performance_test.h"
#include "serialization_performance_test.h"
#include "keccak_test.h"
#include "blake2_test.h"
int main(int argc, char** argv)
{
@ -32,8 +33,10 @@ int main(int argc, char** argv)
set_process_affinity(1);
set_thread_high_priority();
performance_timer timer;
timer.start();
test_blake2();
//performance_timer timer;
//timer.start();
//generate_scratchpad();
//generate_light_scratchpad();
@ -68,12 +71,12 @@ int main(int argc, char** argv)
*/
//TEST_PERFORMANCE0(test_is_out_to_acc);
//TEST_PERFORMANCE0(test_generate_key_image_helper);
TEST_PERFORMANCE0(test_generate_key_derivation);
//TEST_PERFORMANCE0(test_generate_key_derivation);
//TEST_PERFORMANCE0(test_generate_key_image);
//TEST_PERFORMANCE0(test_derive_public_key);
//TEST_PERFORMANCE0(test_derive_secret_key);
std::cout << "Tests finished. Elapsed time: " << timer.elapsed_ms() / 1000 << " sec" << std::endl;
//std::cout << "Tests finished. Elapsed time: " << timer.elapsed_ms() / 1000 << " sec" << std::endl;
return 0;
}