mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-26 01:54:12 +01:00
Compare commits
340 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d787e00a3b | ||
|
|
e6e87891a9 | ||
|
|
930a07c3f5 | ||
|
|
5a3e82f9f5 | ||
|
|
9cbae55a6e | ||
|
|
cf7c1874fe | ||
|
|
47908a8907 | ||
|
|
d2e2cb0d27 | ||
|
|
98ba262a48 | ||
|
|
bd7d9140f9 | ||
|
|
b1a657a00d | ||
|
|
d9711a5798 | ||
|
|
10abe4f26e | ||
|
|
84e7ad922b | ||
|
|
4698dd9a02 | ||
|
|
c90ea2bd6d | ||
|
|
fdec7fe203 | ||
|
|
18cb92ab18 | ||
|
|
86c0af514b | ||
|
|
2aadc8bb5b | ||
|
|
ae42d69d72 | ||
|
|
5284e1b60e | ||
|
|
05563e9ef2 | ||
|
|
458cf9070b | ||
|
|
245e1b4fdb | ||
|
|
87c1947d49 | ||
|
|
8b8d59eefb | ||
|
|
dbe79d3451 | ||
|
|
10152506fe | ||
|
|
aaac71d38f | ||
|
|
415535e47b | ||
|
|
3475caf8f5 | ||
|
|
f1307515b7 | ||
|
|
ab931be45b | ||
|
|
d9574c2f14 | ||
|
|
1d23c74361 | ||
|
|
0654e1c4ef | ||
|
|
ed4e8830d7 | ||
|
|
c9f70b381d | ||
|
|
b4671902f2 | ||
|
|
76e97c4002 | ||
|
|
1aefe491fb | ||
|
|
04a9217dcf | ||
|
|
fa446a563e | ||
|
|
2eb09b66ef | ||
|
|
80be6e69a9 | ||
|
|
009d5fb41f | ||
|
|
f86655fddd | ||
|
|
0ded557af6 | ||
|
|
72b9861635 | ||
|
|
5f88e8887a | ||
|
|
ddb68acebe | ||
|
|
2d96276e24 | ||
|
|
86c2bdfd5d | ||
|
|
cba3a1741a | ||
|
|
5568d82c26 | ||
|
|
1c0bf23ba2 | ||
|
|
8250760617 | ||
|
|
59948a6e1c | ||
|
|
55c43da5d8 | ||
|
|
809ee79592 | ||
|
|
629e37dde1 | ||
|
|
bc530fe89f | ||
|
|
fc73ad644f | ||
|
|
9c17a685bd | ||
|
|
986b5e257e | ||
|
|
97ee01ad89 | ||
|
|
d12e53ea09 | ||
|
|
8220180133 | ||
|
|
a206a23980 | ||
|
|
0a87c91692 | ||
|
|
865c3a2383 | ||
|
|
f03304a9c7 | ||
|
|
bdde31d787 | ||
|
|
0575c0a667 | ||
|
|
bfd471f53e | ||
|
|
6f8ba620c2 | ||
|
|
84d7c981dc | ||
|
|
24324d83e8 | ||
|
|
b7ccd48dd8 | ||
|
|
94073ecf7b | ||
|
|
776d0f3459 | ||
|
|
262430f705 | ||
|
|
e4ff4e6898 | ||
|
|
593f74b9cb | ||
|
|
298a771494 | ||
|
|
2d8b65e837 | ||
|
|
51d9b435cd | ||
|
|
f35e21e2e4 | ||
|
|
683bcb9154 | ||
|
|
11c570cfb4 | ||
|
|
c4679ad0f1 | ||
|
|
2f7a9997c8 | ||
|
|
8595d31ee8 | ||
|
|
026c5f7617 | ||
|
|
222e3de4be | ||
|
|
910bd45756 | ||
|
|
a0cd439788 | ||
|
|
838e8c9166 | ||
|
|
695aa2d5a2 | ||
|
|
e2a186af10 | ||
|
|
5d4b0c9026 | ||
|
|
461764cbbe | ||
|
|
de374ba6b1 | ||
|
|
3b8848fa4e | ||
|
|
3cac997e19 | ||
|
|
be7eecafd2 | ||
|
|
c891967b6f | ||
|
|
2ea321d85a | ||
|
|
c285051c08 | ||
|
|
2ce73dbe85 | ||
|
|
07c46dac87 | ||
|
|
d9c6b09ac4 | ||
|
|
2ea5fa0710 | ||
|
|
bcd88403e2 | ||
|
|
d1e4a866ad | ||
|
|
5cbf75324d | ||
|
|
2bda554be4 | ||
|
|
2fad3d34b7 | ||
|
|
cc8005b4e7 | ||
|
|
77cd030ac3 | ||
|
|
ed54768f5f | ||
|
|
83082f04a4 | ||
|
|
687c5ef794 | ||
|
|
103849419a | ||
|
|
7d5d89856d | ||
|
|
0a27bd065e | ||
|
|
1b5e57e935 | ||
|
|
b22c884231 | ||
|
|
a2ae4a8a0f | ||
|
|
dc8adc3b48 | ||
|
|
5ccee900a0 | ||
|
|
178152f604 | ||
|
|
369010406e | ||
|
|
a790fa46f4 | ||
|
|
6ce5af574f | ||
|
|
81b2d877fb | ||
|
|
3764c12b1f | ||
|
|
9b8eb4d690 | ||
|
|
8d13ca1f11 | ||
|
|
645cc8cf49 | ||
|
|
1c21b7943d | ||
|
|
172f006020 | ||
|
|
6aeb45187b | ||
|
|
a43a7dfa58 | ||
|
|
efae3da41d | ||
|
|
fe37c35018 | ||
|
|
4b36f34d6d | ||
|
|
3df62878c3 | ||
|
|
71cc095cb2 | ||
|
|
43e4a2a289 | ||
|
|
fdbf76d4f4 | ||
|
|
c8ad9b8375 | ||
|
|
41016bfc46 | ||
|
|
c39b06866e | ||
|
|
2323664a37 | ||
|
|
4968232490 | ||
|
|
00728c24e7 | ||
|
|
90e165aa0c | ||
|
|
7629d36a53 | ||
|
|
8555125a1a | ||
|
|
3f64753779 | ||
|
|
14002c8eba | ||
|
|
a2120986ff | ||
|
|
f1e1fb4bde | ||
|
|
8c9479c6bb | ||
|
|
6690680538 | ||
|
|
d743f03552 | ||
|
|
2742fdfda2 | ||
|
|
0a61b0df12 | ||
|
|
343328c6b8 | ||
|
|
d3631907d6 | ||
|
|
87cfcfd374 | ||
|
|
522dfe3422 | ||
|
|
c545563d46 | ||
|
|
7a37c906a1 | ||
|
|
5b721607b1 | ||
|
|
2ef9cfa5b8 | ||
|
|
7d7797b141 | ||
|
|
401926283a | ||
|
|
2201a0808e | ||
|
|
05454818dc | ||
|
|
43deefa435 | ||
|
|
21ca2d833b | ||
|
|
bb3fd02930 | ||
|
|
c923cdbd5b | ||
|
|
019b456605 | ||
|
|
7d489192fd | ||
|
|
44a0de1861 | ||
|
|
a01d5876fa | ||
|
|
15399da9fe | ||
|
|
6da916d4ac | ||
|
|
e540144b2e | ||
|
|
76793dc969 | ||
|
|
6ac7f9f144 | ||
|
|
08fee75201 | ||
|
|
85de7d7c0c | ||
|
|
d4c6b90ca3 | ||
|
|
4bd188c438 | ||
|
|
2d12315c94 | ||
|
|
7f71fd13ae | ||
|
|
01cd2fdaf3 | ||
|
|
819adfff6f | ||
|
|
f5d2bc8a36 | ||
|
|
9db7bf5f52 | ||
|
|
410b618d18 | ||
|
|
4287732797 | ||
|
|
0cff7a8aa7 | ||
|
|
fb83d28768 | ||
|
|
342e1b7338 | ||
|
|
c2fa70ddfd | ||
|
|
8a38d5663a | ||
|
|
dd9e71843b | ||
|
|
94cfec07fd | ||
|
|
e6b7ab5749 | ||
|
|
0c50722270 | ||
|
|
b34e8c3c36 | ||
|
|
2c06be915d | ||
|
|
73aa262647 | ||
|
|
6ff5f718b6 | ||
|
|
e1cb7ce017 | ||
|
|
01bed1828b | ||
|
|
a75560d828 | ||
|
|
ec82517c89 | ||
|
|
31ffe954b6 | ||
|
|
872d60f6e4 | ||
|
|
757f0769d8 | ||
|
|
17b2740289 | ||
|
|
f6f8237a74 | ||
|
|
0bd084011a | ||
|
|
2689f4d02b | ||
|
|
3dd20ff2f8 | ||
|
|
f79751c299 | ||
|
|
813505cc13 | ||
|
|
9f35575ca3 | ||
|
|
520f367319 | ||
|
|
b6dc3b517b | ||
|
|
f0c11b1917 | ||
|
|
40cd036941 | ||
|
|
793200e5e9 | ||
|
|
6966768a55 | ||
|
|
7d46f9250c | ||
|
|
3b7cd5d89a | ||
|
|
fe98cf8dc5 | ||
|
|
e96cd730d1 | ||
|
|
e8bff10f07 | ||
|
|
ae922a36a4 | ||
|
|
673a6d15d9 | ||
|
|
0bbc812f48 | ||
|
|
d01eaf0421 | ||
|
|
a30b56ebe7 | ||
|
|
6e5d67e827 | ||
|
|
20c6bfad1e | ||
|
|
50d49d9c2e | ||
|
|
d882773789 | ||
|
|
d77eac25b2 | ||
|
|
f077bc0f48 | ||
|
|
06c4716396 | ||
|
|
8700fae12a | ||
|
|
340120853f | ||
|
|
3c3fc50c79 | ||
|
|
6344edc36f | ||
|
|
445520bf38 | ||
|
|
8efd8f7f47 | ||
|
|
36bb88e1b9 | ||
|
|
161c38ba60 | ||
|
|
68b973a913 | ||
|
|
24ba1b64e9 | ||
|
|
6a4a35549b | ||
|
|
e5681bb121 | ||
|
|
bed005b639 | ||
|
|
f93d5f9ffe | ||
|
|
2ca1758832 | ||
|
|
1da44d2e96 | ||
|
|
42605ce8bc | ||
|
|
124baa4ccb | ||
|
|
2d98de1b3a | ||
|
|
966cca4bd4 | ||
|
|
2cffa7ce31 | ||
|
|
d7d80a74d5 | ||
|
|
6557910ccf | ||
|
|
c2430126d7 | ||
|
|
cb420a1dfc | ||
|
|
0184604aaf | ||
|
|
75199de534 | ||
|
|
c6ab3cf6d9 | ||
|
|
e480659765 | ||
|
|
2b63e68bbf | ||
|
|
5253d1ab77 | ||
|
|
64a474a49b | ||
|
|
c4319e678f | ||
|
|
c85dfb148a | ||
|
|
98500d70a8 | ||
|
|
fa9dbd6b62 | ||
|
|
75990a46a7 | ||
|
|
c41226d847 | ||
|
|
082e725b33 | ||
|
|
53d508072b | ||
|
|
8be979d9ae | ||
|
|
cb0f89646f | ||
|
|
9a36562347 | ||
|
|
312c2c42b6 | ||
|
|
e2c2648c14 | ||
|
|
adb50ffe32 | ||
|
|
e899779450 | ||
|
|
e39bc50eb4 | ||
|
|
651d335569 | ||
|
|
4ea3f3da1a | ||
|
|
b075bbf986 | ||
|
|
107d9e288d | ||
|
|
52f4cb4859 | ||
|
|
c5c7911dab | ||
|
|
b349e3dca8 | ||
|
|
70e79525c9 | ||
|
|
956468c29a | ||
|
|
b4e235f9f2 | ||
|
|
8b4cefd324 | ||
|
|
8acda009d9 | ||
|
|
300d4608f2 | ||
|
|
e4c05d3177 | ||
|
|
b7362c07ae | ||
|
|
4ac57f013e | ||
|
|
5750932cdf | ||
|
|
fe9f3d626d | ||
|
|
32d490313b | ||
|
|
a0c17c03eb | ||
|
|
e8474beb6f | ||
|
|
dc73b326f9 | ||
|
|
dd519206a6 | ||
|
|
fa2a0338d3 | ||
|
|
e39dfe8ea6 | ||
|
|
99cef996c7 | ||
|
|
0cc05617d1 | ||
|
|
661f878002 | ||
|
|
429187c6a8 | ||
|
|
6d97df0e99 | ||
|
|
dba0fd9b6a | ||
|
|
8dca7864f7 | ||
|
|
465e1d99f2 | ||
|
|
e071a3f6c0 |
16
README.md
Normal file
16
README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
Bitcoin integration/staging tree
|
||||
|
||||
Development process
|
||||
===================
|
||||
|
||||
Developers work in their own trees, then submit pull requests when they think their feature or bug fix is ready.
|
||||
|
||||
If it is a simple/trivial/non-controversial change, then one of the bitcoin development team members simply pulls it.
|
||||
|
||||
If it is a more complicated or potentially controversial change, then the patch submitter will be asked to start a discussion (if they haven't already) on the development forums: http://www.bitcoin.org/smf/index.php?board=6.0
|
||||
The patch will be accepted if there is broad consensus that it is a good thing. Developers should expect to rework and resubmit patches if they don't match the project's coding conventions (see coding.txt) or are controversial.
|
||||
|
||||
The master branch is regularly built and tested (by who? need people willing to be quality assurance testers), and periodically pushed to the subversion repo to become the official, stable, released bitcoin.
|
||||
|
||||
|
||||
Feature branches are created when there are major new features being worked on by several people.
|
||||
2
base58.h
2
base58.h
@@ -152,7 +152,7 @@ inline bool DecodeBase58Check(const string& str, vector<unsigned char>& vchRet)
|
||||
|
||||
|
||||
|
||||
static const unsigned char ADDRESSVERSION = 0;
|
||||
#define ADDRESSVERSION ((unsigned char)(fTestNet ? 111 : 0))
|
||||
|
||||
inline string Hash160ToAddress(uint160 hash160)
|
||||
{
|
||||
|
||||
17
bignum.h
17
bignum.h
@@ -401,7 +401,16 @@ public:
|
||||
|
||||
CBigNum& operator>>=(unsigned int shift)
|
||||
{
|
||||
// Note: BN_rshift segfaults on 64-bit ubuntu 9.10 if 2^shift is greater than the number
|
||||
// Note: BN_rshift segfaults on 64-bit if 2^shift is greater than the number
|
||||
// if built on ubuntu 9.04 or 9.10, probably depends on version of openssl
|
||||
CBigNum a = 1;
|
||||
a <<= shift;
|
||||
if (BN_cmp(&a, this) > 0)
|
||||
{
|
||||
*this = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
if (!BN_rshift(this, this, shift))
|
||||
throw bignum_error("CBigNum:operator>>= : BN_rshift failed");
|
||||
return *this;
|
||||
@@ -510,10 +519,8 @@ inline const CBigNum operator<<(const CBigNum& a, unsigned int shift)
|
||||
|
||||
inline const CBigNum operator>>(const CBigNum& a, unsigned int shift)
|
||||
{
|
||||
CBigNum r;
|
||||
// Note: BN_rshift segfaults on 64-bit ubuntu 9.10 if 2^shift is greater than the number
|
||||
if (!BN_rshift(&r, &a, shift))
|
||||
throw bignum_error("CBigNum:operator>> : BN_rshift failed");
|
||||
CBigNum r = a;
|
||||
r >>= shift;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
2
bugs.txt
2
bugs.txt
@@ -1,2 +0,0 @@
|
||||
Known bugs:
|
||||
- Window flickers when blocks are added (problem with repainting?)
|
||||
103
build-msw.txt
103
build-msw.txt
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
Copyright (c) 2009-2011 Bitcoin Developers
|
||||
Distributed under the MIT/X11 software license, see the accompanying
|
||||
file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
This product includes software developed by the OpenSSL Project for use in
|
||||
@@ -11,27 +11,25 @@ WINDOWS BUILD NOTES
|
||||
|
||||
Compilers Supported
|
||||
-------------------
|
||||
MinGW GCC (recommended)
|
||||
MinGW GCC http://tdm-gcc.tdragon.net/
|
||||
TDM-GCC with gcc 4.5.1 was used to build this release.
|
||||
MSYS 1.0.11 was also used (sh needed to compile some dependencies)
|
||||
|
||||
MSVC 6.0 SP6: You'll need Boost version 1.34 because they dropped support
|
||||
for MSVC 6.0 after that. However, they didn't add Asio until 1.35.
|
||||
You should still be able to build with MSVC 6.0 by adding Asio to 1.34 by
|
||||
unpacking boost_asio_*.zip into the boost directory:
|
||||
http://sourceforge.net/projects/asio/files/asio
|
||||
|
||||
MSVC 8.0 (2005) SP1 has been tested. Note: MSVC 7.0 and up have a habit of
|
||||
linking to runtime DLLs that are not installed on XP by default.
|
||||
Candidate releases were built with MSVC 10.0 (2010), but
|
||||
compiling with Visual C++ caused rendering artifacts when
|
||||
bitcoin was run.
|
||||
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
Libraries you need to download separately and build:
|
||||
|
||||
default path download
|
||||
wxWidgets-2.9 \wxwidgets http://www.wxwidgets.org/downloads/
|
||||
OpenSSL \openssl http://www.openssl.org/source/
|
||||
Berkeley DB \db http://www.oracle.com/technology/software/products/berkeley-db/index.html
|
||||
Boost \boost http://www.boost.org/users/download/
|
||||
default path download
|
||||
wxWidgets \wxwidgets-2.9.1-mgw http://www.wxwidgets.org/downloads/
|
||||
OpenSSL \openssl-1.0.0c-mgw http://www.openssl.org/source/
|
||||
Berkeley DB \db-4.7.25.NC-mgw http://www.oracle.com/technology/software/products/berkeley-db/index.html
|
||||
Boost \boost-1.43.0-mgw http://www.boost.org/users/download/
|
||||
|
||||
Their licenses:
|
||||
wxWidgets LGPL 2.1 with very liberal exceptions
|
||||
@@ -40,11 +38,10 @@ Berkeley DB New BSD license with additional requirement that linked software
|
||||
Boost MIT-like license
|
||||
|
||||
Versions used in this release:
|
||||
MinGW GCC 3.4.5
|
||||
wxWidgets 2.9.0
|
||||
OpenSSL 0.9.8k
|
||||
wxWidgets 2.9.1
|
||||
OpenSSL 1.0.0c
|
||||
Berkeley DB 4.7.25.NC
|
||||
Boost 1.42.1
|
||||
Boost 1.43.0
|
||||
|
||||
|
||||
Notes
|
||||
@@ -53,62 +50,50 @@ The UI layout is edited with wxFormBuilder. The project file is
|
||||
uiproject.fbp. It generates uibase.cpp and uibase.h, which define base
|
||||
classes that do the rote work of constructing all the UI elements.
|
||||
|
||||
The release is built with GCC and then "strip bitcoin.exe" to strip the debug
|
||||
symbols, which reduces the executable size by about 90%.
|
||||
|
||||
|
||||
wxWidgets
|
||||
---------
|
||||
cd \wxwidgets\build\msw
|
||||
make -f makefile.gcc
|
||||
or
|
||||
nmake -f makefile.vc
|
||||
|
||||
DOS shell:
|
||||
cd \wxWidgets-2.9.1-mgw\build\msw
|
||||
mingw32-make -f makefile.gcc
|
||||
|
||||
OpenSSL
|
||||
-------
|
||||
Bitcoin does not use any encryption. If you want to do a no-everything
|
||||
build of OpenSSL to exclude encryption routines, a few patches are required.
|
||||
(instructions for OpenSSL v0.9.8k)
|
||||
MSYS shell:
|
||||
un-tar sources with MSYS 'tar xfz' to avoid issue with symlinks (OpenSSL ticket 2377)
|
||||
change 'MAKE' env. variable from 'C:\MinGW32\bin\mingw32-make.exe' to '/c/MinGW32/bin/mingw32-make.exe'
|
||||
|
||||
Edit engines\e_gmp.c and engines\e_capi.c and add this #ifndef around
|
||||
the openssl/rsa.h include:
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
#include <openssl/rsa.h>
|
||||
#endif
|
||||
cd /c/openssl-1.0.0c-mgw
|
||||
./config
|
||||
make
|
||||
|
||||
Edit ms\mingw32.bat and replace the Configure line's parameters with this
|
||||
no-everything list. You have to put this in the batch file because batch
|
||||
files can't take more than nine command line parameters.
|
||||
perl Configure mingw threads no-rc2 no-rc4 no-rc5 no-idea no-des no-bf no-cast no-aes no-camellia no-seed no-rsa no-dh
|
||||
|
||||
Also REM out the following line in ms\mingw32.bat after the mingw32-make
|
||||
line. The build fails after it's already finished building libeay32, which
|
||||
is all we care about, but the failure aborts the script before it runs
|
||||
dllwrap to generate libeay32.dll.
|
||||
REM if errorlevel 1 goto end
|
||||
|
||||
Build
|
||||
cd \openssl
|
||||
ms\mingw32.bat
|
||||
|
||||
If you want to use it with MSVC, generate the .lib file
|
||||
lib /machine:i386 /def:ms\libeay32.def /out:out\libeay32.lib
|
||||
perl util/mkdef.pl 32 libeay enable-static-engine > libeay32.def
|
||||
dllwrap --dllname libeay32.dll --output-lib libeay32.a --def libeay32.def libcrypto.a -lws2_32 -lgdi32
|
||||
|
||||
after that openssl libeay is in main source dir (openssl-1.0.0c-mgw)
|
||||
|
||||
Berkeley DB
|
||||
-----------
|
||||
Using MinGW and MSYS:
|
||||
cd \db\build_unix
|
||||
MSYS shell:
|
||||
cd /c/db-4.7.25.NC-mgw/build_unix
|
||||
sh ../dist/configure --enable-mingw --enable-cxx
|
||||
make
|
||||
|
||||
|
||||
Boost
|
||||
-----
|
||||
download bjam.exe from
|
||||
http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941
|
||||
cd \boost
|
||||
DOS prompt:
|
||||
downloaded boost jam 3.1.18
|
||||
cd \boost-1.43.0-mgw
|
||||
bjam toolset=gcc --build-type=complete stage
|
||||
or
|
||||
bjam toolset=msvc --build-type=complete stage
|
||||
|
||||
Note:
|
||||
building with boost 1.45.0 failed because of boost ticket 4614, 4258
|
||||
builds fine with boost 1.43.0
|
||||
|
||||
Bitcoin
|
||||
-------
|
||||
DOS prompt:
|
||||
cd \bitcoin
|
||||
mingw32-make bitcoin.exe bitcoind.exe -f makefile.mingw
|
||||
strip bitcoin.exe
|
||||
strip bitcoind.exe
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
Copyright (c) 2010 Laszlo Hanyecz
|
||||
Distributed under the MIT/X11 software license, see the accompanying
|
||||
file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
This product includes software developed by the OpenSSL Project for use in
|
||||
|
||||
@@ -9,6 +9,14 @@ cryptographic software written by Eric Young (eay@cryptsoft.com).
|
||||
UNIX BUILD NOTES
|
||||
================
|
||||
|
||||
To Build
|
||||
--------
|
||||
|
||||
make -f makefile.unix # Bitcoin with wxWidgets GUI
|
||||
or
|
||||
make -f makefile.unix bitcoind # Headless bitcoin
|
||||
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
sudo apt-get install build-essential
|
||||
@@ -16,13 +24,13 @@ sudo apt-get install libgtk2.0-dev
|
||||
sudo apt-get install libssl-dev
|
||||
sudo apt-get install libdb4.7-dev
|
||||
sudo apt-get install libdb4.7++-dev
|
||||
sudo apt-get install libboost-all-dev
|
||||
Boost 1.40+: sudo apt-get install libboost-all-dev
|
||||
or Boost 1.37: sudo apt-get install libboost1.37-dev
|
||||
|
||||
We're now using wxWidgets 2.9, which uses UTF-8.
|
||||
If using Boost 1.37, append -mt to the boost libraries in the makefile.
|
||||
|
||||
There isn't currently a debian package of wxWidgets we can use. The 2.8
|
||||
packages for Karmic are UTF-16 unicode and won't work for us, and we've had
|
||||
trouble building 2.8 on 64-bit.
|
||||
We're using wxWidgets 2.9.0, which uses UTF-8. Don't try 2.8, it won't work.
|
||||
The build hasn't been updated to work with wxWidgets 2.9.1 yet.
|
||||
|
||||
You need to download wxWidgets from http://www.wxwidgets.org/downloads/
|
||||
and build it yourself. See the build instructions and configure parameters
|
||||
@@ -34,11 +42,11 @@ Berkeley DB New BSD license with additional requirement that linked software
|
||||
Boost MIT-like license
|
||||
|
||||
Versions used in this release:
|
||||
GCC 4.4.3
|
||||
OpenSSL 0.9.8k
|
||||
GCC 4.3.3
|
||||
OpenSSL 0.9.8g
|
||||
wxWidgets 2.9.0
|
||||
Berkeley DB 4.7.25.NC
|
||||
Boost 1.40.0
|
||||
Boost 1.37
|
||||
|
||||
|
||||
Notes
|
||||
@@ -55,7 +63,7 @@ wxWidgets
|
||||
---------
|
||||
cd /usr/local
|
||||
tar -xzvf wxWidgets-2.9.0.tar.gz
|
||||
cd /usr/local/wxWidgets-2.9.0
|
||||
cd wxWidgets-2.9.0
|
||||
mkdir buildgtk
|
||||
cd buildgtk
|
||||
../configure --with-gtk --enable-debug --disable-shared --enable-monolithic
|
||||
@@ -63,21 +71,19 @@ make
|
||||
sudo su
|
||||
make install
|
||||
ldconfig
|
||||
su <username>
|
||||
cd ..
|
||||
mkdir buildbase
|
||||
cd buildbase
|
||||
../configure --disable-gui --enable-debug --disable-shared --enable-monolithic
|
||||
|
||||
|
||||
Berkeley DB
|
||||
-----------
|
||||
You need Berkeley DB 4.7. Don't use 4.8, the database/log0000* files
|
||||
are incompatible. If you have to build Berkeley DB yourself:
|
||||
../dist/configure --enable-cxx
|
||||
make
|
||||
sudo su
|
||||
make install
|
||||
ldconfig
|
||||
|
||||
|
||||
Boost
|
||||
-----
|
||||
If you want to build Boost yourself,
|
||||
cd /usr/local/boost_1_40_0
|
||||
su
|
||||
If you need to build Boost yourself:
|
||||
sudo su
|
||||
./bootstrap.sh
|
||||
./bjam install
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
Changes after 0.1.5:
|
||||
--------------------
|
||||
+ Options dialog layout changed - added the UI options panel
|
||||
+ Minimize to tray feature
|
||||
+ Startup on system boot feature
|
||||
+ Ask before closing
|
||||
+ NSIS installer
|
||||
41
coding.txt
Normal file
41
coding.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
Please be consistent with the existing coding style.
|
||||
|
||||
Block style:
|
||||
|
||||
bool Function(char* psz, int n)
|
||||
{
|
||||
// Comment summarising what this section of code does
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
// When something fails, return early
|
||||
if (!Something())
|
||||
return false;
|
||||
...
|
||||
}
|
||||
|
||||
// Success return is usually at the end
|
||||
return true;
|
||||
}
|
||||
|
||||
- ANSI/Allman block style
|
||||
- 4 space indenting, no tabs
|
||||
- No extra spaces inside parenthesis; please don't do ( this )
|
||||
- No space after function names, one space after if, for and while
|
||||
|
||||
Variable names begin with the type in lowercase, like nSomeVariable.
|
||||
Please don't put the first word of the variable name in lowercase like
|
||||
someVariable.
|
||||
|
||||
Common types:
|
||||
n integer number: short, unsigned short, int, unsigned int,
|
||||
int64, uint64, sometimes char if used as a number
|
||||
d double, float
|
||||
f flag
|
||||
hash uint256
|
||||
p pointer or array, one p for each level of indirection
|
||||
psz pointer to null terminated string
|
||||
str string object
|
||||
v vector or similar list objects
|
||||
map map or multimap
|
||||
set set or multiset
|
||||
bn CBigNum
|
||||
67
cryptopp/License.txt
Normal file
67
cryptopp/License.txt
Normal file
@@ -0,0 +1,67 @@
|
||||
Compilation Copyright (c) 1995-2009 by Wei Dai. All rights reserved.
|
||||
This copyright applies only to this software distribution package
|
||||
as a compilation, and does not imply a copyright on any particular
|
||||
file in the package.
|
||||
|
||||
The following files are copyrighted by their respective original authors,
|
||||
and their use is subject to additional licenses included in these files.
|
||||
|
||||
mars.cpp - Copyright 1998 Brian Gladman.
|
||||
|
||||
All other files in this compilation are placed in the public domain by
|
||||
Wei Dai and other contributors.
|
||||
|
||||
I would like to thank the following authors for placing their works into
|
||||
the public domain:
|
||||
|
||||
Joan Daemen - 3way.cpp
|
||||
Leonard Janke - cast.cpp, seal.cpp
|
||||
Steve Reid - cast.cpp
|
||||
Phil Karn - des.cpp
|
||||
Andrew M. Kuchling - md2.cpp, md4.cpp
|
||||
Colin Plumb - md5.cpp
|
||||
Seal Woods - rc6.cpp
|
||||
Chris Morgan - rijndael.cpp
|
||||
Paulo Baretto - rijndael.cpp, skipjack.cpp, square.cpp
|
||||
Richard De Moliner - safer.cpp
|
||||
Matthew Skala - twofish.cpp
|
||||
Kevin Springle - camellia.cpp, shacal2.cpp, ttmac.cpp, whrlpool.cpp, ripemd.cpp
|
||||
|
||||
Permission to use, copy, modify, and distribute this compilation for
|
||||
any purpose, including commercial applications, is hereby granted
|
||||
without fee, subject to the following restrictions:
|
||||
|
||||
1. Any copy or modification of this compilation in any form, except
|
||||
in object code form as part of an application software, must include
|
||||
the above copyright notice and this license.
|
||||
|
||||
2. Users of this software agree that any modification or extension
|
||||
they provide to Wei Dai will be considered public domain and not
|
||||
copyrighted unless it includes an explicit copyright notice.
|
||||
|
||||
3. Wei Dai makes no warranty or representation that the operation of the
|
||||
software in this compilation will be error-free, and Wei Dai is under no
|
||||
obligation to provide any services, by way of maintenance, update, or
|
||||
otherwise. THE SOFTWARE AND ANY DOCUMENTATION ARE PROVIDED "AS IS"
|
||||
WITHOUT EXPRESS OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. IN NO EVENT WILL WEI DAI OR ANY OTHER CONTRIBUTOR BE LIABLE FOR
|
||||
DIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
4. Users will not use Wei Dai or any other contributor's name in any
|
||||
publicity or advertising, without prior written consent in each case.
|
||||
|
||||
5. Export of this software from the United States may require a
|
||||
specific license from the United States Government. It is the
|
||||
responsibility of any person or organization contemplating export
|
||||
to obtain such a license before exporting.
|
||||
|
||||
6. Certain parts of this software may be protected by patents. It
|
||||
is the users' responsibility to obtain the appropriate
|
||||
licenses before using those parts.
|
||||
|
||||
If this compilation is used in object code form in an application
|
||||
software, acknowledgement of the author is not required but would be
|
||||
appreciated. The contribution of any useful modifications or extensions
|
||||
to Wei Dai is not required but would also be appreciated.
|
||||
429
cryptopp/Readme.txt
Normal file
429
cryptopp/Readme.txt
Normal file
@@ -0,0 +1,429 @@
|
||||
Crypto++: a C++ Class Library of Cryptographic Schemes
|
||||
Version 5.6.0 (3/15/2009)
|
||||
|
||||
Crypto++ Library is a free C++ class library of cryptographic schemes.
|
||||
Currently the library contains the following algorithms:
|
||||
|
||||
algorithm type name
|
||||
|
||||
authenticated encryption schemes GCM, CCM, EAX
|
||||
|
||||
high speed stream ciphers Panama, Sosemanuk, Salsa20, XSalsa20
|
||||
|
||||
AES and AES candidates AES (Rijndael), RC6, MARS, Twofish, Serpent,
|
||||
CAST-256
|
||||
|
||||
IDEA, Triple-DES (DES-EDE2 and DES-EDE3),
|
||||
other block ciphers Camellia, SEED, RC5, Blowfish, TEA, XTEA,
|
||||
Skipjack, SHACAL-2
|
||||
|
||||
block cipher modes of operation ECB, CBC, CBC ciphertext stealing (CTS),
|
||||
CFB, OFB, counter mode (CTR)
|
||||
|
||||
message authentication codes VMAC, HMAC, CMAC, CBC-MAC, DMAC,
|
||||
Two-Track-MAC
|
||||
|
||||
SHA-1, SHA-2 (SHA-224, SHA-256, SHA-384, and
|
||||
hash functions SHA-512), Tiger, WHIRLPOOL, RIPEMD-128,
|
||||
RIPEMD-256, RIPEMD-160, RIPEMD-320
|
||||
|
||||
RSA, DSA, ElGamal, Nyberg-Rueppel (NR),
|
||||
public-key cryptography Rabin, Rabin-Williams (RW), LUC, LUCELG,
|
||||
DLIES (variants of DHAES), ESIGN
|
||||
|
||||
padding schemes for public-key PKCS#1 v2.0, OAEP, PSS, PSSR, IEEE P1363
|
||||
systems EMSA2 and EMSA5
|
||||
|
||||
Diffie-Hellman (DH), Unified Diffie-Hellman
|
||||
key agreement schemes (DH2), Menezes-Qu-Vanstone (MQV), LUCDIF,
|
||||
XTR-DH
|
||||
|
||||
elliptic curve cryptography ECDSA, ECNR, ECIES, ECDH, ECMQV
|
||||
|
||||
insecure or obsolescent MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL
|
||||
algorithms retained for backwards 3.0, WAKE, WAKE-OFB, DESX (DES-XEX3), RC2,
|
||||
compatibility and historical SAFER, 3-WAY, GOST, SHARK, CAST-128, Square
|
||||
value
|
||||
|
||||
Other features include:
|
||||
|
||||
* pseudo random number generators (PRNG): ANSI X9.17 appendix C, RandomPool
|
||||
* password based key derivation functions: PBKDF1 and PBKDF2 from PKCS #5,
|
||||
PBKDF from PKCS #12 appendix B
|
||||
* Shamir's secret sharing scheme and Rabin's information dispersal algorithm
|
||||
(IDA)
|
||||
* fast multi-precision integer (bignum) and polynomial operations
|
||||
* finite field arithmetics, including GF(p) and GF(2^n)
|
||||
* prime number generation and verification
|
||||
* useful non-cryptographic algorithms
|
||||
+ DEFLATE (RFC 1951) compression/decompression with gzip (RFC 1952) and
|
||||
zlib (RFC 1950) format support
|
||||
+ hex, base-32, and base-64 coding/decoding
|
||||
+ 32-bit CRC and Adler32 checksum
|
||||
* class wrappers for these operating system features (optional):
|
||||
+ high resolution timers on Windows, Unix, and Mac OS
|
||||
+ Berkeley and Windows style sockets
|
||||
+ Windows named pipes
|
||||
+ /dev/random, /dev/urandom, /dev/srandom
|
||||
+ Microsoft's CryptGenRandom on Windows
|
||||
* A high level interface for most of the above, using a filter/pipeline
|
||||
metaphor
|
||||
* benchmarks and validation testing
|
||||
* x86, x86-64 (x64), MMX, and SSE2 assembly code for the most commonly used
|
||||
algorithms, with run-time CPU feature detection and code selection
|
||||
* some versions are available in FIPS 140-2 validated form
|
||||
|
||||
You are welcome to use it for any purpose without paying me, but see
|
||||
License.txt for the fine print.
|
||||
|
||||
The following compilers are supported for this release. Please visit
|
||||
http://www.cryptopp.com the most up to date build instructions and porting notes.
|
||||
|
||||
* MSVC 6.0 - 2008
|
||||
* GCC 3.3 - 4.3
|
||||
* C++Builder 2009
|
||||
* Intel C++ Compiler 9 - 11
|
||||
* Sun Studio 12 (CC 5.9)
|
||||
|
||||
*** Important Usage Notes ***
|
||||
|
||||
1. If a constructor for A takes a pointer to an object B (except primitive
|
||||
types such as int and char), then A owns B and will delete B at A's
|
||||
destruction. If a constructor for A takes a reference to an object B,
|
||||
then the caller retains ownership of B and should not destroy it until
|
||||
A no longer needs it.
|
||||
|
||||
2. Crypto++ is thread safe at the class level. This means you can use
|
||||
Crypto++ safely in a multithreaded application, but you must provide
|
||||
synchronization when multiple threads access a common Crypto++ object.
|
||||
|
||||
*** MSVC-Specific Information ***
|
||||
|
||||
On Windows, Crypto++ can be compiled into 3 forms: a static library
|
||||
including all algorithms, a DLL with only FIPS Approved algorithms, and
|
||||
a static library with only algorithms not in the DLL.
|
||||
(FIPS Approved means Approved according to the FIPS 140-2 standard.)
|
||||
The DLL may be used by itself, or it may be used together with the second
|
||||
form of the static library. MSVC project files are included to build
|
||||
all three forms, and sample applications using each of the three forms
|
||||
are also included.
|
||||
|
||||
To compile Crypto++ with MSVC, open the "cryptest.dsw" (for MSVC 6 and MSVC .NET
|
||||
2003) or "cryptest.sln" (for MSVC .NET 2005) workspace file and build one or
|
||||
more of the following projects:
|
||||
|
||||
cryptdll - This builds the DLL. Please note that if you wish to use Crypto++
|
||||
as a FIPS validated module, you must use a pre-built DLL that has undergone
|
||||
the FIPS validation process instead of building your own.
|
||||
dlltest - This builds a sample application that only uses the DLL.
|
||||
cryptest Non-DLL-Import Configuration - This builds the full static library
|
||||
along with a full test driver.
|
||||
cryptest DLL-Import Configuration - This builds a static library containing
|
||||
only algorithms not in the DLL, along with a full test driver that uses
|
||||
both the DLL and the static library.
|
||||
|
||||
To use the Crypto++ DLL in your application, #include "dll.h" before including
|
||||
any other Crypto++ header files, and place the DLL in the same directory as
|
||||
your .exe file. dll.h includes the line #pragma comment(lib, "cryptopp")
|
||||
so you don't have to explicitly list the import library in your project
|
||||
settings. To use a static library form of Crypto++, specify it as
|
||||
an additional library to link with in your project settings.
|
||||
In either case you should check the compiler options to
|
||||
make sure that the library and your application are using the same C++
|
||||
run-time libraries and calling conventions.
|
||||
|
||||
*** DLL Memory Management ***
|
||||
|
||||
Because it's possible for the Crypto++ DLL to delete objects allocated
|
||||
by the calling application, they must use the same C++ memory heap. Three
|
||||
methods are provided to achieve this.
|
||||
1. The calling application can tell Crypto++ what heap to use. This method
|
||||
is required when the calling application uses a non-standard heap.
|
||||
2. Crypto++ can tell the calling application what heap to use. This method
|
||||
is required when the calling application uses a statically linked C++ Run
|
||||
Time Library. (Method 1 does not work in this case because the Crypto++ DLL
|
||||
is initialized before the calling application's heap is initialized.)
|
||||
3. Crypto++ can automatically use the heap provided by the calling application's
|
||||
dynamically linked C++ Run Time Library. The calling application must
|
||||
make sure that the dynamically linked C++ Run Time Library is initialized
|
||||
before Crypto++ is loaded. (At this time it is not clear if it is possible
|
||||
to control the order in which DLLs are initialized on Windows 9x machines,
|
||||
so it might be best to avoid using this method.)
|
||||
|
||||
When Crypto++ attaches to a new process, it searches all modules loaded
|
||||
into the process space for exported functions "GetNewAndDeleteForCryptoPP"
|
||||
and "SetNewAndDeleteFromCryptoPP". If one of these functions is found,
|
||||
Crypto++ uses methods 1 or 2, respectively, by calling the function.
|
||||
Otherwise, method 3 is used.
|
||||
|
||||
*** GCC-Specific Information ***
|
||||
|
||||
A makefile is included for you to compile Crypto++ with GCC. Make sure
|
||||
you are using GNU Make and GNU ld. The make process will produce two files,
|
||||
libcryptopp.a and cryptest.exe. Run "cryptest.exe v" for the validation
|
||||
suite.
|
||||
|
||||
*** Documentation and Support ***
|
||||
|
||||
Crypto++ is documented through inline comments in header files, which are
|
||||
processed through Doxygen to produce an HTML reference manual. You can find
|
||||
a link to the manual from http://www.cryptopp.com. Also at that site is
|
||||
the Crypto++ FAQ, which you should browse through before attempting to
|
||||
use this library, because it will likely answer many of questions that
|
||||
may come up.
|
||||
|
||||
If you run into any problems, please try the Crypto++ mailing list.
|
||||
The subscription information and the list archive are available on
|
||||
http://www.cryptopp.com. You can also email me directly by visiting
|
||||
http://www.weidai.com, but you will probably get a faster response through
|
||||
the mailing list.
|
||||
|
||||
*** History ***
|
||||
|
||||
1.0 - First public release. Withdrawn at the request of RSA DSI.
|
||||
- included Blowfish, BBS, DES, DH, Diamond, DSA, ElGamal, IDEA,
|
||||
MD5, RC4, RC5, RSA, SHA, WAKE, secret sharing, DEFLATE compression
|
||||
- had a serious bug in the RSA key generation code.
|
||||
|
||||
1.1 - Removed RSA, RC4, RC5
|
||||
- Disabled calls to RSAREF's non-public functions
|
||||
- Minor bugs fixed
|
||||
|
||||
2.0 - a completely new, faster multiprecision integer class
|
||||
- added MD5-MAC, HAVAL, 3-WAY, TEA, SAFER, LUC, Rabin, BlumGoldwasser,
|
||||
elliptic curve algorithms
|
||||
- added the Lucas strong probable primality test
|
||||
- ElGamal encryption and signature schemes modified to avoid weaknesses
|
||||
- Diamond changed to Diamond2 because of key schedule weakness
|
||||
- fixed bug in WAKE key setup
|
||||
- SHS class renamed to SHA
|
||||
- lots of miscellaneous optimizations
|
||||
|
||||
2.1 - added Tiger, HMAC, GOST, RIPE-MD160, LUCELG, LUCDIF, XOR-MAC,
|
||||
OAEP, PSSR, SHARK
|
||||
- added precomputation to DH, ElGamal, DSA, and elliptic curve algorithms
|
||||
- added back RC5 and a new RSA
|
||||
- optimizations in elliptic curves over GF(p)
|
||||
- changed Rabin to use OAEP and PSSR
|
||||
- changed many classes to allow copy constructors to work correctly
|
||||
- improved exception generation and handling
|
||||
|
||||
2.2 - added SEAL, CAST-128, Square
|
||||
- fixed bug in HAVAL (padding problem)
|
||||
- fixed bug in triple-DES (decryption order was reversed)
|
||||
- fixed bug in RC5 (couldn't handle key length not a multiple of 4)
|
||||
- changed HMAC to conform to RFC-2104 (which is not compatible
|
||||
with the original HMAC)
|
||||
- changed secret sharing and information dispersal to use GF(2^32)
|
||||
instead of GF(65521)
|
||||
- removed zero knowledge prover/verifier for graph isomorphism
|
||||
- removed several utility classes in favor of the C++ standard library
|
||||
|
||||
2.3 - ported to EGCS
|
||||
- fixed incomplete workaround of min/max conflict in MSVC
|
||||
|
||||
3.0 - placed all names into the "CryptoPP" namespace
|
||||
- added MD2, RC2, RC6, MARS, RW, DH2, MQV, ECDHC, CBC-CTS
|
||||
- added abstract base classes PK_SimpleKeyAgreementDomain and
|
||||
PK_AuthenticatedKeyAgreementDomain
|
||||
- changed DH and LUCDIF to implement the PK_SimpleKeyAgreementDomain
|
||||
interface and to perform domain parameter and key validation
|
||||
- changed interfaces of PK_Signer and PK_Verifier to sign and verify
|
||||
messages instead of message digests
|
||||
- changed OAEP to conform to PKCS#1 v2.0
|
||||
- changed benchmark code to produce HTML tables as output
|
||||
- changed PSSR to track IEEE P1363a
|
||||
- renamed ElGamalSignature to NR and changed it to track IEEE P1363
|
||||
- renamed ECKEP to ECMQVC and changed it to track IEEE P1363
|
||||
- renamed several other classes for clarity
|
||||
- removed support for calling RSAREF
|
||||
- removed option to compile old SHA (SHA-0)
|
||||
- removed option not to throw exceptions
|
||||
|
||||
3.1 - added ARC4, Rijndael, Twofish, Serpent, CBC-MAC, DMAC
|
||||
- added interface for querying supported key lengths of symmetric ciphers
|
||||
and MACs
|
||||
- added sample code for RSA signature and verification
|
||||
- changed CBC-CTS to be compatible with RFC 2040
|
||||
- updated SEAL to version 3.0 of the cipher specification
|
||||
- optimized multiprecision squaring and elliptic curves over GF(p)
|
||||
- fixed bug in MARS key setup
|
||||
- fixed bug with attaching objects to Deflator
|
||||
|
||||
3.2 - added DES-XEX3, ECDSA, DefaultEncryptorWithMAC
|
||||
- renamed DES-EDE to DES-EDE2 and TripleDES to DES-EDE3
|
||||
- optimized ARC4
|
||||
- generalized DSA to allow keys longer than 1024 bits
|
||||
- fixed bugs in GF2N and ModularArithmetic that can cause calculation errors
|
||||
- fixed crashing bug in Inflator when given invalid inputs
|
||||
- fixed endian bug in Serpent
|
||||
- fixed padding bug in Tiger
|
||||
|
||||
4.0 - added Skipjack, CAST-256, Panama, SHA-2 (SHA-256, SHA-384, and SHA-512),
|
||||
and XTR-DH
|
||||
- added a faster variant of Rabin's Information Dispersal Algorithm (IDA)
|
||||
- added class wrappers for these operating system features:
|
||||
- high resolution timers on Windows, Unix, and MacOS
|
||||
- Berkeley and Windows style sockets
|
||||
- Windows named pipes
|
||||
- /dev/random and /dev/urandom on Linux and FreeBSD
|
||||
- Microsoft's CryptGenRandom on Windows
|
||||
- added support for SEC 1 elliptic curve key format and compressed points
|
||||
- added support for X.509 public key format (subjectPublicKeyInfo) for
|
||||
RSA, DSA, and elliptic curve schemes
|
||||
- added support for DER and OpenPGP signature format for DSA
|
||||
- added support for ZLIB compressed data format (RFC 1950)
|
||||
- changed elliptic curve encryption to use ECIES (as defined in SEC 1)
|
||||
- changed MARS key schedule to reflect the latest specification
|
||||
- changed BufferedTransformation interface to support multiple channels
|
||||
and messages
|
||||
- changed CAST and SHA-1 implementations to use public domain source code
|
||||
- fixed bug in StringSource
|
||||
- optmized multi-precision integer code for better performance
|
||||
|
||||
4.1 - added more support for the recommended elliptic curve parameters in SEC 2
|
||||
- added Panama MAC, MARC4
|
||||
- added IV stealing feature to CTS mode
|
||||
- added support for PKCS #8 private key format for RSA, DSA, and elliptic
|
||||
curve schemes
|
||||
- changed Deflate, MD5, Rijndael, and Twofish to use public domain code
|
||||
- fixed a bug with flushing compressed streams
|
||||
- fixed a bug with decompressing stored blocks
|
||||
- fixed a bug with EC point decompression using non-trinomial basis
|
||||
- fixed a bug in NetworkSource::GeneralPump()
|
||||
- fixed a performance issue with EC over GF(p) decryption
|
||||
- fixed syntax to allow GCC to compile without -fpermissive
|
||||
- relaxed some restrictions in the license
|
||||
|
||||
4.2 - added support for longer HMAC keys
|
||||
- added MD4 (which is not secure so use for compatibility purposes only)
|
||||
- added compatibility fixes/workarounds for STLport 4.5, GCC 3.0.2,
|
||||
and MSVC 7.0
|
||||
- changed MD2 to use public domain code
|
||||
- fixed a bug with decompressing multiple messages with the same object
|
||||
- fixed a bug in CBC-MAC with MACing multiple messages with the same object
|
||||
- fixed a bug in RC5 and RC6 with zero-length keys
|
||||
- fixed a bug in Adler32 where incorrect checksum may be generated
|
||||
|
||||
5.0 - added ESIGN, DLIES, WAKE-OFB, PBKDF1 and PBKDF2 from PKCS #5
|
||||
- added key validation for encryption and signature public/private keys
|
||||
- renamed StreamCipher interface to SymmetricCipher, which is now implemented
|
||||
by both stream ciphers and block cipher modes including ECB and CBC
|
||||
- added keying interfaces to support resetting of keys and IVs without
|
||||
having to destroy and recreate objects
|
||||
- changed filter interface to support non-blocking input/output
|
||||
- changed SocketSource and SocketSink to use overlapped I/O on Microsoft Windows
|
||||
- grouped related classes inside structs to help templates, for example
|
||||
AESEncryption and AESDecryption are now AES::Encryption and AES::Decryption
|
||||
- where possible, typedefs have been added to improve backwards
|
||||
compatibility when the CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY macro is defined
|
||||
- changed Serpent, HAVAL and IDEA to use public domain code
|
||||
- implemented SSE2 optimizations for Integer operations
|
||||
- fixed a bug in HMAC::TruncatedFinal()
|
||||
- fixed SKIPJACK byte ordering following NIST clarification dated 5/9/02
|
||||
|
||||
5.01 - added known answer test for X9.17 RNG in FIPS 140 power-up self test
|
||||
- submitted to NIST/CSE, but not publicly released
|
||||
|
||||
5.02 - changed EDC test to MAC integrity check using HMAC/SHA1
|
||||
- improved performance of integrity check
|
||||
- added blinding to defend against RSA timing attack
|
||||
|
||||
5.03 - created DLL version of Crypto++ for FIPS 140-2 validation
|
||||
- fixed vulnerabilities in GetNextIV for CTR and OFB modes
|
||||
|
||||
5.0.4 - Removed DES, SHA-256, SHA-384, SHA-512 from DLL
|
||||
|
||||
5.1 - added PSS padding and changed PSSR to track IEEE P1363a draft standard
|
||||
- added blinding for RSA and Rabin to defend against timing attacks
|
||||
on decryption operations
|
||||
- changed signing and decryption APIs to support the above
|
||||
- changed WaitObjectContainer to allow waiting for more than 64
|
||||
objects at a time on Win32 platforms
|
||||
- fixed a bug in CBC and ECB modes with processing non-aligned data
|
||||
- fixed standard conformance bugs in DLIES (DHAES mode) and RW/EMSA2
|
||||
signature scheme (these fixes are not backwards compatible)
|
||||
- fixed a number of compiler warnings, minor bugs, and portability problems
|
||||
- removed Sapphire
|
||||
|
||||
5.2 - merged in changes for 5.01 - 5.0.4
|
||||
- added support for using encoding parameters and key derivation parameters
|
||||
with public key encryption (implemented by OAEP and DL/ECIES)
|
||||
- added Camellia, SHACAL-2, Two-Track-MAC, Whirlpool, RIPEMD-320,
|
||||
RIPEMD-128, RIPEMD-256, Base-32 coding, FIPS variant of CFB mode
|
||||
- added ThreadUserTimer for timing thread CPU usage
|
||||
- added option for password-based key derivation functions
|
||||
to iterate until a mimimum elapsed thread CPU time is reached
|
||||
- added option (on by default) for DEFLATE compression to detect
|
||||
uncompressible files and process them more quickly
|
||||
- improved compatibility and performance on 64-bit platforms,
|
||||
including Alpha, IA-64, x86-64, PPC64, Sparc64, and MIPS64
|
||||
- fixed ONE_AND_ZEROS_PADDING to use 0x80 instead 0x01 as padding.
|
||||
- fixed encoding/decoding of PKCS #8 privateKeyInfo to properly
|
||||
handle optional attributes
|
||||
|
||||
5.2.1 - fixed bug in the "dlltest" DLL testing program
|
||||
- fixed compiling with STLport using VC .NET
|
||||
- fixed compiling with -fPIC using GCC
|
||||
- fixed compiling with -msse2 on systems without memalign()
|
||||
- fixed inability to instantiate PanamaMAC
|
||||
- fixed problems with inline documentation
|
||||
|
||||
5.2.2 - added SHA-224
|
||||
- put SHA-256, SHA-384, SHA-512, RSASSA-PSS into DLL
|
||||
|
||||
5.2.3 - fixed issues with FIPS algorithm test vectors
|
||||
- put RSASSA-ISO into DLL
|
||||
|
||||
5.3 - ported to MSVC 2005 with support for x86-64
|
||||
- added defense against AES timing attacks, and more AES test vectors
|
||||
- changed StaticAlgorithmName() of Rijndael to "AES", CTR to "CTR"
|
||||
|
||||
5.4 - added Salsa20
|
||||
- updated Whirlpool to version 3.0
|
||||
- ported to GCC 4.1, Sun C++ 5.8, and Borland C++Builder 2006
|
||||
|
||||
5.5 - added VMAC and Sosemanuk (with x86-64 and SSE2 assembly)
|
||||
- improved speed of integer arithmetic, AES, SHA-512, Tiger, Salsa20,
|
||||
Whirlpool, and PANAMA cipher using assembly (x86-64, MMX, SSE2)
|
||||
- optimized Camellia and added defense against timing attacks
|
||||
- updated benchmarks code to show cycles per byte and to time key/IV setup
|
||||
- started using OpenMP for increased multi-core speed
|
||||
- enabled GCC optimization flags by default in GNUmakefile
|
||||
- added blinding and computational error checking for RW signing
|
||||
- changed RandomPool, X917RNG, GetNextIV, DSA/NR/ECDSA/ECNR to reduce
|
||||
the risk of reusing random numbers and IVs after virtual machine state
|
||||
rollback
|
||||
- changed default FIPS mode RNG from AutoSeededX917RNG<DES_EDE3> to
|
||||
AutoSeededX917RNG<AES>
|
||||
- fixed PANAMA cipher interface to accept 256-bit key and 256-bit IV
|
||||
- moved MD2, MD4, MD5, PanamaHash, ARC4, WAKE_CFB into the namespace "Weak"
|
||||
- removed HAVAL, MD5-MAC, XMAC
|
||||
|
||||
5.5.1 - fixed VMAC validation failure on 32-bit big-endian machines
|
||||
|
||||
5.5.2 - ported x64 assembly language code for AES, Salsa20, Sosemanuk, and Panama
|
||||
to MSVC 2005 (using MASM since MSVC doesn't support inline assembly on x64)
|
||||
- fixed Salsa20 initialization crash on non-SSE2 machines
|
||||
- fixed Whirlpool crash on Pentium 2 machines
|
||||
- fixed possible branch prediction analysis (BPA) vulnerability in
|
||||
MontgomeryReduce(), which may affect security of RSA, RW, LUC
|
||||
- fixed link error with MSVC 2003 when using "debug DLL" form of runtime library
|
||||
- fixed crash in SSE2_Add on P4 machines when compiled with
|
||||
MSVC 6.0 SP5 with Processor Pack
|
||||
- ported to MSVC 2008, GCC 4.2, Sun CC 5.9, Intel C++ Compiler 10.0,
|
||||
and Borland C++Builder 2007
|
||||
|
||||
5.6 - added AuthenticatedSymmetricCipher interface class and Filter wrappers
|
||||
- added CCM, GCM (with SSE2 assembly), EAX, CMAC, XSalsa20, and SEED
|
||||
- added support for variable length IVs
|
||||
- improved AES and SHA-256 speed on x86 and x64
|
||||
- fixed incorrect VMAC computation on message lengths
|
||||
that are >64 mod 128 (x86 assembly version is not affected)
|
||||
- fixed compiler error in vmac.cpp on x86 with GCC -fPIC
|
||||
- fixed run-time validation error on x86-64 with GCC 4.3.2 -O2
|
||||
- fixed HashFilter bug when putMessage=true
|
||||
- removed WORD64_AVAILABLE; compiler support for 64-bit int is now required
|
||||
- ported to GCC 4.3, C++Builder 2009, Sun CC 5.10, Intel C++ Compiler 11
|
||||
|
||||
Written by Wei Dai
|
||||
462
cryptopp/config.h
Normal file
462
cryptopp/config.h
Normal file
@@ -0,0 +1,462 @@
|
||||
#ifndef CRYPTOPP_CONFIG_H
|
||||
#define CRYPTOPP_CONFIG_H
|
||||
|
||||
//// Bitcoin: disable SSE2 on 32-bit
|
||||
#if !defined(_M_X64) && !defined(__x86_64__)
|
||||
#define CRYPTOPP_DISABLE_SSE2 1
|
||||
#endif
|
||||
//////////// end of Bitcoin changes
|
||||
|
||||
|
||||
// ***************** Important Settings ********************
|
||||
|
||||
// define this if running on a big-endian CPU
|
||||
#if !defined(IS_LITTLE_ENDIAN) && (defined(__BIG_ENDIAN__) || defined(__sparc) || defined(__sparc__) || defined(__hppa__) || defined(__mips__) || (defined(__MWERKS__) && !defined(__INTEL__)))
|
||||
# define IS_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
// define this if running on a little-endian CPU
|
||||
// big endian will be assumed if IS_LITTLE_ENDIAN is not defined
|
||||
#ifndef IS_BIG_ENDIAN
|
||||
# define IS_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
// define this if you want to disable all OS-dependent features,
|
||||
// such as sockets and OS-provided random number generators
|
||||
// #define NO_OS_DEPENDENCE
|
||||
|
||||
// Define this to use features provided by Microsoft's CryptoAPI.
|
||||
// Currently the only feature used is random number generation.
|
||||
// This macro will be ignored if NO_OS_DEPENDENCE is defined.
|
||||
#define USE_MS_CRYPTOAPI
|
||||
|
||||
// Define this to 1 to enforce the requirement in FIPS 186-2 Change Notice 1 that only 1024 bit moduli be used
|
||||
#ifndef DSA_1024_BIT_MODULUS_ONLY
|
||||
# define DSA_1024_BIT_MODULUS_ONLY 1
|
||||
#endif
|
||||
|
||||
// ***************** Less Important Settings ***************
|
||||
|
||||
// define this to retain (as much as possible) old deprecated function and class names
|
||||
// #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
|
||||
|
||||
#define GZIP_OS_CODE 0
|
||||
|
||||
// Try this if your CPU has 256K internal cache or a slow multiply instruction
|
||||
// and you want a (possibly) faster IDEA implementation using log tables
|
||||
// #define IDEA_LARGECACHE
|
||||
|
||||
// Define this if, for the linear congruential RNG, you want to use
|
||||
// the original constants as specified in S.K. Park and K.W. Miller's
|
||||
// CACM paper.
|
||||
// #define LCRNG_ORIGINAL_NUMBERS
|
||||
|
||||
// choose which style of sockets to wrap (mostly useful for cygwin which has both)
|
||||
#define PREFER_BERKELEY_STYLE_SOCKETS
|
||||
// #define PREFER_WINDOWS_STYLE_SOCKETS
|
||||
|
||||
// set the name of Rijndael cipher, was "Rijndael" before version 5.3
|
||||
#define CRYPTOPP_RIJNDAEL_NAME "AES"
|
||||
|
||||
// ***************** Important Settings Again ********************
|
||||
// But the defaults should be ok.
|
||||
|
||||
// namespace support is now required
|
||||
#ifdef NO_NAMESPACE
|
||||
# error namespace support is now required
|
||||
#endif
|
||||
|
||||
// Define this to workaround a Microsoft CryptoAPI bug where
|
||||
// each call to CryptAcquireContext causes a 100 KB memory leak.
|
||||
// Defining this will cause Crypto++ to make only one call to CryptAcquireContext.
|
||||
#define WORKAROUND_MS_BUG_Q258000
|
||||
|
||||
#ifdef CRYPTOPP_DOXYGEN_PROCESSING
|
||||
// Avoid putting "CryptoPP::" in front of everything in Doxygen output
|
||||
# define CryptoPP
|
||||
# define NAMESPACE_BEGIN(x)
|
||||
# define NAMESPACE_END
|
||||
// Get Doxygen to generate better documentation for these typedefs
|
||||
# define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
|
||||
#else
|
||||
# define NAMESPACE_BEGIN(x) namespace x {
|
||||
# define NAMESPACE_END }
|
||||
# define DOCUMENTED_TYPEDEF(x, y) typedef x y;
|
||||
#endif
|
||||
#define ANONYMOUS_NAMESPACE_BEGIN namespace {
|
||||
#define USING_NAMESPACE(x) using namespace x;
|
||||
#define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
|
||||
#define DOCUMENTED_NAMESPACE_END }
|
||||
|
||||
// What is the type of the third parameter to bind?
|
||||
// For Unix, the new standard is ::socklen_t (typically unsigned int), and the old standard is int.
|
||||
// Unfortunately there is no way to tell whether or not socklen_t is defined.
|
||||
// To work around this, TYPE_OF_SOCKLEN_T is a macro so that you can change it from the makefile.
|
||||
#ifndef TYPE_OF_SOCKLEN_T
|
||||
# if defined(_WIN32) || defined(__CYGWIN__)
|
||||
# define TYPE_OF_SOCKLEN_T int
|
||||
# else
|
||||
# define TYPE_OF_SOCKLEN_T ::socklen_t
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS)
|
||||
# define __USE_W32_SOCKETS
|
||||
#endif
|
||||
|
||||
typedef unsigned char byte; // put in global namespace to avoid ambiguity with other byte typedefs
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
typedef unsigned short word16;
|
||||
typedef unsigned int word32;
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef unsigned __int64 word64;
|
||||
#define W64LIT(x) x##ui64
|
||||
#else
|
||||
typedef unsigned long long word64;
|
||||
#define W64LIT(x) x##ULL
|
||||
#endif
|
||||
|
||||
// define large word type, used for file offsets and such
|
||||
typedef word64 lword;
|
||||
const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
// define hword, word, and dword. these are used for multiprecision integer arithmetic
|
||||
// Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
|
||||
#if (defined(_MSC_VER) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) && (defined(_M_X64) || defined(_M_IA64))) || (defined(__DECCXX) && defined(__alpha__)) || (defined(__INTEL_COMPILER) && defined(__x86_64__)) || (defined(__SUNPRO_CC) && defined(__x86_64__))
|
||||
typedef word32 hword;
|
||||
typedef word64 word;
|
||||
#else
|
||||
#define CRYPTOPP_NATIVE_DWORD_AVAILABLE
|
||||
#if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400
|
||||
// GCC 4.0.1 on MacOS X is missing __umodti3 and __udivti3
|
||||
// mode(TI) division broken on amd64 with GCC earlier than GCC 3.4
|
||||
typedef word32 hword;
|
||||
typedef word64 word;
|
||||
typedef __uint128_t dword;
|
||||
typedef __uint128_t word128;
|
||||
#define CRYPTOPP_WORD128_AVAILABLE
|
||||
#else
|
||||
// if we're here, it means we're on a 64-bit CPU but we don't have a way to obtain 128-bit multiplication results
|
||||
typedef word16 hword;
|
||||
typedef word32 word;
|
||||
typedef word64 dword;
|
||||
#endif
|
||||
#else
|
||||
// being here means the native register size is probably 32 bits or less
|
||||
#define CRYPTOPP_BOOL_SLOW_WORD64 1
|
||||
typedef word16 hword;
|
||||
typedef word32 word;
|
||||
typedef word64 dword;
|
||||
#endif
|
||||
#endif
|
||||
#ifndef CRYPTOPP_BOOL_SLOW_WORD64
|
||||
#define CRYPTOPP_BOOL_SLOW_WORD64 0
|
||||
#endif
|
||||
|
||||
const unsigned int WORD_SIZE = sizeof(word);
|
||||
const unsigned int WORD_BITS = WORD_SIZE * 8;
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
|
||||
// This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
#define CRYPTOPP_L1_CACHE_LINE_SIZE 64
|
||||
#else
|
||||
// L1 cache line size is 32 on Pentium III and earlier
|
||||
#define CRYPTOPP_L1_CACHE_LINE_SIZE 32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if _MSC_VER == 1200
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#if _MSC_VER > 1200 || defined(_mm_free)
|
||||
#define CRYPTOPP_MSVC6PP_OR_LATER // VC 6 processor pack or later
|
||||
#else
|
||||
#define CRYPTOPP_MSVC6_NO_PP // VC 6 without processor pack
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CRYPTOPP_ALIGN_DATA
|
||||
#if defined(CRYPTOPP_MSVC6PP_OR_LATER)
|
||||
#define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
|
||||
#elif defined(__GNUC__)
|
||||
#define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
|
||||
#else
|
||||
#define CRYPTOPP_ALIGN_DATA(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CRYPTOPP_SECTION_ALIGN16
|
||||
#if defined(__GNUC__) && !defined(__APPLE__)
|
||||
// the alignment attribute doesn't seem to work without this section attribute when -fdata-sections is turned on
|
||||
#define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
|
||||
#else
|
||||
#define CRYPTOPP_SECTION_ALIGN16
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__fastcall)
|
||||
#define CRYPTOPP_FASTCALL __fastcall
|
||||
#else
|
||||
#define CRYPTOPP_FASTCALL
|
||||
#endif
|
||||
|
||||
// VC60 workaround: it doesn't allow typename in some places
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
||||
#define CPP_TYPENAME
|
||||
#else
|
||||
#define CPP_TYPENAME typename
|
||||
#endif
|
||||
|
||||
// VC60 workaround: can't cast unsigned __int64 to float or double
|
||||
#if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER)
|
||||
#define CRYPTOPP_VC6_INT64 (__int64)
|
||||
#else
|
||||
#define CRYPTOPP_VC6_INT64
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define CRYPTOPP_NO_VTABLE __declspec(novtable)
|
||||
#else
|
||||
#define CRYPTOPP_NO_VTABLE
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// 4231: nonstandard extension used : 'extern' before template explicit instantiation
|
||||
// 4250: dominance
|
||||
// 4251: member needs to have dll-interface
|
||||
// 4275: base needs to have dll-interface
|
||||
// 4660: explicitly instantiating a class that's already implicitly instantiated
|
||||
// 4661: no suitable definition provided for explicit template instantiation request
|
||||
// 4786: identifer was truncated in debug information
|
||||
// 4355: 'this' : used in base member initializer list
|
||||
// 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
|
||||
# pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355 4910)
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
// 8037: non-const function called for const object. needed to work around BCB2006 bug
|
||||
# pragma warn -8037
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION)
|
||||
#define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
|
||||
#endif
|
||||
|
||||
#ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
|
||||
#define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_DISABLE_X86ASM // for backwards compatibility: this macro had both meanings
|
||||
#define CRYPTOPP_DISABLE_ASM
|
||||
#define CRYPTOPP_DISABLE_SSE2
|
||||
#endif
|
||||
|
||||
#if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
|
||||
#define CRYPTOPP_X86_ASM_AVAILABLE
|
||||
|
||||
#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300)
|
||||
#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
|
||||
#endif
|
||||
|
||||
// SSSE3 was actually introduced in GNU as 2.17, which was released 6/23/2006, but we can't tell what version of binutils is installed.
|
||||
// GCC 4.1.2 was released on 2/13/2007, so we'll use that as a proxy for the binutils version.
|
||||
#if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102)
|
||||
#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64)
|
||||
#define CRYPTOPP_X64_MASM_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__)
|
||||
#define CRYPTOPP_X64_ASM_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__))
|
||||
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
|
||||
#define CRYPTOPP_BOOL_ALIGN16_ENABLED 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_ALIGN16_ENABLED 0
|
||||
#endif
|
||||
|
||||
// how to allocate 16-byte aligned memory (for SSE2)
|
||||
#if defined(CRYPTOPP_MSVC6PP_OR_LATER)
|
||||
#define CRYPTOPP_MM_MALLOC_AVAILABLE
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
|
||||
#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
|
||||
#define CRYPTOPP_MEMALIGN_AVAILABLE
|
||||
#else
|
||||
#define CRYPTOPP_NO_ALIGNED_ALLOC
|
||||
#endif
|
||||
|
||||
// how to disable inlining
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
# define CRYPTOPP_NOINLINE_DOTDOTDOT
|
||||
# define CRYPTOPP_NOINLINE __declspec(noinline)
|
||||
#elif defined(__GNUC__)
|
||||
# define CRYPTOPP_NOINLINE_DOTDOTDOT
|
||||
# define CRYPTOPP_NOINLINE __attribute__((noinline))
|
||||
#else
|
||||
# define CRYPTOPP_NOINLINE_DOTDOTDOT ...
|
||||
# define CRYPTOPP_NOINLINE
|
||||
#endif
|
||||
|
||||
// how to declare class constants
|
||||
#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__INTEL_COMPILER)
|
||||
# define CRYPTOPP_CONSTANT(x) enum {x};
|
||||
#else
|
||||
# define CRYPTOPP_CONSTANT(x) static const int x;
|
||||
#endif
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
#define CRYPTOPP_BOOL_X64 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_X64 0
|
||||
#endif
|
||||
|
||||
// see http://predef.sourceforge.net/prearch.html
|
||||
#if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)
|
||||
#define CRYPTOPP_BOOL_X86 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_X86 0
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || defined(__powerpc__)
|
||||
#define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
|
||||
#endif
|
||||
|
||||
#define CRYPTOPP_VERSION 560
|
||||
|
||||
// ***************** determine availability of OS features ********************
|
||||
|
||||
#ifndef NO_OS_DEPENDENCE
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#define CRYPTOPP_WIN32_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
|
||||
#define CRYPTOPP_UNIX_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
|
||||
# define HIGHRES_TIMER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_UNIX_AVAILABLE
|
||||
# define HAS_BERKELEY_STYLE_SOCKETS
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||
# define HAS_WINDOWS_STYLE_SOCKETS
|
||||
#endif
|
||||
|
||||
#if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS))
|
||||
# define SOCKETS_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
|
||||
# define USE_WINDOWS_STYLE_SOCKETS
|
||||
#else
|
||||
# define USE_BERKELEY_STYLE_SOCKETS
|
||||
#endif
|
||||
|
||||
#if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
|
||||
# define WINDOWS_PIPES_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI)
|
||||
# define NONBLOCKING_RNG_AVAILABLE
|
||||
# define OS_RNG_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||
# define NONBLOCKING_RNG_AVAILABLE
|
||||
# define BLOCKING_RNG_AVAILABLE
|
||||
# define OS_RNG_AVAILABLE
|
||||
# define HAS_PTHREADS
|
||||
# define THREADS_AVAILABLE
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||
# define HAS_WINTHREADS
|
||||
# define THREADS_AVAILABLE
|
||||
#endif
|
||||
|
||||
#endif // NO_OS_DEPENDENCE
|
||||
|
||||
// ***************** DLL related ********************
|
||||
|
||||
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||
|
||||
#ifdef CRYPTOPP_EXPORTS
|
||||
#define CRYPTOPP_IS_DLL
|
||||
#define CRYPTOPP_DLL __declspec(dllexport)
|
||||
#elif defined(CRYPTOPP_IMPORTS)
|
||||
#define CRYPTOPP_IS_DLL
|
||||
#define CRYPTOPP_DLL __declspec(dllimport)
|
||||
#else
|
||||
#define CRYPTOPP_DLL
|
||||
#endif
|
||||
|
||||
#define CRYPTOPP_API __cdecl
|
||||
|
||||
#else // CRYPTOPP_WIN32_AVAILABLE
|
||||
|
||||
#define CRYPTOPP_DLL
|
||||
#define CRYPTOPP_API
|
||||
|
||||
#endif // CRYPTOPP_WIN32_AVAILABLE
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
|
||||
#elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
|
||||
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
|
||||
#else
|
||||
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
|
||||
#define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
|
||||
#else
|
||||
#define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
|
||||
#endif
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
|
||||
#elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
|
||||
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
|
||||
#else
|
||||
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
|
||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
|
||||
#else
|
||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
199
cryptopp/cpu.cpp
Normal file
199
cryptopp/cpu.cpp
Normal file
@@ -0,0 +1,199 @@
|
||||
// cpu.cpp - written and placed in the public domain by Wei Dai
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#ifndef CRYPTOPP_IMPORTS
|
||||
|
||||
#include "cpu.h"
|
||||
#include "misc.h"
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_MSVC6PP_OR_LATER
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
#ifdef CRYPTOPP_X86_ASM_AVAILABLE
|
||||
|
||||
#ifndef _MSC_VER
|
||||
typedef void (*SigHandler)(int);
|
||||
|
||||
static jmp_buf s_jmpNoCPUID;
|
||||
static void SigIllHandlerCPUID(int)
|
||||
{
|
||||
longjmp(s_jmpNoCPUID, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CpuId(word32 input, word32 *output)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
__try
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, input
|
||||
cpuid
|
||||
mov edi, output
|
||||
mov [edi], eax
|
||||
mov [edi+4], ebx
|
||||
mov [edi+8], ecx
|
||||
mov [edi+12], edx
|
||||
}
|
||||
}
|
||||
__except (1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
SigHandler oldHandler = signal(SIGILL, SigIllHandlerCPUID);
|
||||
if (oldHandler == SIG_ERR)
|
||||
return false;
|
||||
|
||||
bool result = true;
|
||||
if (setjmp(s_jmpNoCPUID))
|
||||
result = false;
|
||||
else
|
||||
{
|
||||
__asm__
|
||||
(
|
||||
// save ebx in case -fPIC is being used
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
"push %%ebx; cpuid; mov %%ebx, %%edi; pop %%ebx"
|
||||
#else
|
||||
"pushq %%rbx; cpuid; mov %%ebx, %%edi; popq %%rbx"
|
||||
#endif
|
||||
: "=a" (output[0]), "=D" (output[1]), "=c" (output[2]), "=d" (output[3])
|
||||
: "a" (input)
|
||||
);
|
||||
}
|
||||
|
||||
signal(SIGILL, oldHandler);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
static jmp_buf s_jmpNoSSE2;
|
||||
static void SigIllHandlerSSE2(int)
|
||||
{
|
||||
longjmp(s_jmpNoSSE2, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif _MSC_VER >= 1400 && CRYPTOPP_BOOL_X64
|
||||
|
||||
bool CpuId(word32 input, word32 *output)
|
||||
{
|
||||
__cpuid((int *)output, input);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_CPUID_AVAILABLE
|
||||
|
||||
static bool TrySSE2()
|
||||
{
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
return true;
|
||||
#elif defined(_MSC_VER)
|
||||
__try
|
||||
{
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
AS2(por xmm0, xmm0) // executing SSE2 instruction
|
||||
#elif CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
|
||||
__mm128i x = _mm_setzero_si128();
|
||||
return _mm_cvtsi128_si32(x) == 0;
|
||||
#endif
|
||||
}
|
||||
__except (1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#elif defined(__GNUC__)
|
||||
SigHandler oldHandler = signal(SIGILL, SigIllHandlerSSE2);
|
||||
if (oldHandler == SIG_ERR)
|
||||
return false;
|
||||
|
||||
bool result = true;
|
||||
if (setjmp(s_jmpNoSSE2))
|
||||
result = false;
|
||||
else
|
||||
{
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
__asm __volatile ("por %xmm0, %xmm0");
|
||||
#elif CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
|
||||
__mm128i x = _mm_setzero_si128();
|
||||
result = _mm_cvtsi128_si32(x) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
signal(SIGILL, oldHandler);
|
||||
return result;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool g_x86DetectionDone = false;
|
||||
bool g_hasISSE = false, g_hasSSE2 = false, g_hasSSSE3 = false, g_hasMMX = false, g_isP4 = false;
|
||||
word32 g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
|
||||
|
||||
void DetectX86Features()
|
||||
{
|
||||
word32 cpuid[4], cpuid1[4];
|
||||
if (!CpuId(0, cpuid))
|
||||
return;
|
||||
if (!CpuId(1, cpuid1))
|
||||
return;
|
||||
|
||||
g_hasMMX = (cpuid1[3] & (1 << 23)) != 0;
|
||||
if ((cpuid1[3] & (1 << 26)) != 0)
|
||||
g_hasSSE2 = TrySSE2();
|
||||
g_hasSSSE3 = g_hasSSE2 && (cpuid1[2] & (1<<9));
|
||||
|
||||
if ((cpuid1[3] & (1 << 25)) != 0)
|
||||
g_hasISSE = true;
|
||||
else
|
||||
{
|
||||
word32 cpuid2[4];
|
||||
CpuId(0x080000000, cpuid2);
|
||||
if (cpuid2[0] >= 0x080000001)
|
||||
{
|
||||
CpuId(0x080000001, cpuid2);
|
||||
g_hasISSE = (cpuid2[3] & (1 << 22)) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
std::swap(cpuid[2], cpuid[3]);
|
||||
if (memcmp(cpuid+1, "GenuineIntel", 12) == 0)
|
||||
{
|
||||
g_isP4 = ((cpuid1[0] >> 8) & 0xf) == 0xf;
|
||||
g_cacheLineSize = 8 * GETBYTE(cpuid1[1], 1);
|
||||
}
|
||||
else if (memcmp(cpuid+1, "AuthenticAMD", 12) == 0)
|
||||
{
|
||||
CpuId(0x80000005, cpuid);
|
||||
g_cacheLineSize = GETBYTE(cpuid[2], 0);
|
||||
}
|
||||
|
||||
if (!g_cacheLineSize)
|
||||
g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
|
||||
|
||||
g_x86DetectionDone = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
263
cryptopp/cpu.h
Normal file
263
cryptopp/cpu.h
Normal file
@@ -0,0 +1,263 @@
|
||||
#ifndef CRYPTOPP_CPU_H
|
||||
#define CRYPTOPP_CPU_H
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#define CRYPTOPP_X86_ASM_AVAILABLE
|
||||
#define CRYPTOPP_BOOL_X64 1
|
||||
#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
|
||||
#define NAMESPACE_END
|
||||
|
||||
#else
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef CRYPTOPP_MSVC6PP_OR_LATER
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || (_MSC_VER >= 1400 && CRYPTOPP_BOOL_X64)
|
||||
|
||||
#define CRYPTOPP_CPUID_AVAILABLE
|
||||
|
||||
// these should not be used directly
|
||||
extern CRYPTOPP_DLL bool g_x86DetectionDone;
|
||||
extern CRYPTOPP_DLL bool g_hasSSE2;
|
||||
extern CRYPTOPP_DLL bool g_hasISSE;
|
||||
extern CRYPTOPP_DLL bool g_hasMMX;
|
||||
extern CRYPTOPP_DLL bool g_hasSSSE3;
|
||||
extern CRYPTOPP_DLL bool g_isP4;
|
||||
extern CRYPTOPP_DLL word32 g_cacheLineSize;
|
||||
CRYPTOPP_DLL void CRYPTOPP_API DetectX86Features();
|
||||
|
||||
CRYPTOPP_DLL bool CRYPTOPP_API CpuId(word32 input, word32 *output);
|
||||
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
inline bool HasSSE2() {return true;}
|
||||
inline bool HasISSE() {return true;}
|
||||
inline bool HasMMX() {return true;}
|
||||
#else
|
||||
|
||||
inline bool HasSSE2()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_hasSSE2;
|
||||
}
|
||||
|
||||
inline bool HasISSE()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_hasISSE;
|
||||
}
|
||||
|
||||
inline bool HasMMX()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_hasMMX;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline bool HasSSSE3()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_hasSSSE3;
|
||||
}
|
||||
|
||||
inline bool IsP4()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_isP4;
|
||||
}
|
||||
|
||||
inline int GetCacheLineSize()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_cacheLineSize;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline int GetCacheLineSize()
|
||||
{
|
||||
return CRYPTOPP_L1_CACHE_LINE_SIZE;
|
||||
}
|
||||
|
||||
inline bool HasSSSE3() {return false;}
|
||||
inline bool IsP4() {return false;}
|
||||
|
||||
// assume MMX and SSE2 if intrinsics are enabled
|
||||
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_X64
|
||||
inline bool HasSSE2() {return true;}
|
||||
inline bool HasISSE() {return true;}
|
||||
inline bool HasMMX() {return true;}
|
||||
#else
|
||||
inline bool HasSSE2() {return false;}
|
||||
inline bool HasISSE() {return false;}
|
||||
inline bool HasMMX() {return false;}
|
||||
#endif
|
||||
|
||||
#endif // #ifdef CRYPTOPP_X86_ASM_AVAILABLE || _MSC_VER >= 1400
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
#define AS1(x) x*newline*
|
||||
#define AS2(x, y) x, y*newline*
|
||||
#define AS3(x, y, z) x, y, z*newline*
|
||||
#define ASS(x, y, a, b, c, d) x, y, a*64+b*16+c*4+d*newline*
|
||||
#define ASL(x) label##x:*newline*
|
||||
#define ASJ(x, y, z) x label##y*newline*
|
||||
#define ASC(x, y) x label##y*newline*
|
||||
#define AS_HEX(y) 0##y##h
|
||||
#elif defined(__GNUC__)
|
||||
// define these in two steps to allow arguments to be expanded
|
||||
#define GNU_AS1(x) #x ";"
|
||||
#define GNU_AS2(x, y) #x ", " #y ";"
|
||||
#define GNU_AS3(x, y, z) #x ", " #y ", " #z ";"
|
||||
#define GNU_ASL(x) "\n" #x ":"
|
||||
#define GNU_ASJ(x, y, z) #x " " #y #z ";"
|
||||
#define AS1(x) GNU_AS1(x)
|
||||
#define AS2(x, y) GNU_AS2(x, y)
|
||||
#define AS3(x, y, z) GNU_AS3(x, y, z)
|
||||
#define ASS(x, y, a, b, c, d) #x ", " #y ", " #a "*64+" #b "*16+" #c "*4+" #d ";"
|
||||
#define ASL(x) GNU_ASL(x)
|
||||
#define ASJ(x, y, z) GNU_ASJ(x, y, z)
|
||||
#define ASC(x, y) #x " " #y ";"
|
||||
#define CRYPTOPP_NAKED
|
||||
#define AS_HEX(y) 0x##y
|
||||
#else
|
||||
#define AS1(x) __asm {x}
|
||||
#define AS2(x, y) __asm {x, y}
|
||||
#define AS3(x, y, z) __asm {x, y, z}
|
||||
#define ASS(x, y, a, b, c, d) __asm {x, y, _MM_SHUFFLE(a, b, c, d)}
|
||||
#define ASL(x) __asm {label##x:}
|
||||
#define ASJ(x, y, z) __asm {x label##y}
|
||||
#define ASC(x, y) __asm {x label##y}
|
||||
#define CRYPTOPP_NAKED __declspec(naked)
|
||||
#define AS_HEX(y) 0x##y
|
||||
#endif
|
||||
|
||||
#define IF0(y)
|
||||
#define IF1(y) y
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
#define ASM_MOD(x, y) ((x) MOD (y))
|
||||
#define XMMWORD_PTR XMMWORD PTR
|
||||
#else
|
||||
// GNU assembler doesn't seem to have mod operator
|
||||
#define ASM_MOD(x, y) ((x)-((x)/(y))*(y))
|
||||
// GAS 2.15 doesn't support XMMWORD PTR. it seems necessary only for MASM
|
||||
#define XMMWORD_PTR
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#define AS_REG_1 ecx
|
||||
#define AS_REG_2 edx
|
||||
#define AS_REG_3 esi
|
||||
#define AS_REG_4 edi
|
||||
#define AS_REG_5 eax
|
||||
#define AS_REG_6 ebx
|
||||
#define AS_REG_7 ebp
|
||||
#define AS_REG_1d ecx
|
||||
#define AS_REG_2d edx
|
||||
#define AS_REG_3d esi
|
||||
#define AS_REG_4d edi
|
||||
#define AS_REG_5d eax
|
||||
#define AS_REG_6d ebx
|
||||
#define AS_REG_7d ebp
|
||||
#define WORD_SZ 4
|
||||
#define WORD_REG(x) e##x
|
||||
#define WORD_PTR DWORD PTR
|
||||
#define AS_PUSH_IF86(x) AS1(push e##x)
|
||||
#define AS_POP_IF86(x) AS1(pop e##x)
|
||||
#define AS_JCXZ jecxz
|
||||
#elif CRYPTOPP_BOOL_X64
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
#define AS_REG_1 rcx
|
||||
#define AS_REG_2 rdx
|
||||
#define AS_REG_3 r8
|
||||
#define AS_REG_4 r9
|
||||
#define AS_REG_5 rax
|
||||
#define AS_REG_6 r10
|
||||
#define AS_REG_7 r11
|
||||
#define AS_REG_1d ecx
|
||||
#define AS_REG_2d edx
|
||||
#define AS_REG_3d r8d
|
||||
#define AS_REG_4d r9d
|
||||
#define AS_REG_5d eax
|
||||
#define AS_REG_6d r10d
|
||||
#define AS_REG_7d r11d
|
||||
#else
|
||||
#define AS_REG_1 rdi
|
||||
#define AS_REG_2 rsi
|
||||
#define AS_REG_3 rdx
|
||||
#define AS_REG_4 rcx
|
||||
#define AS_REG_5 r8
|
||||
#define AS_REG_6 r9
|
||||
#define AS_REG_7 r10
|
||||
#define AS_REG_1d edi
|
||||
#define AS_REG_2d esi
|
||||
#define AS_REG_3d edx
|
||||
#define AS_REG_4d ecx
|
||||
#define AS_REG_5d r8d
|
||||
#define AS_REG_6d r9d
|
||||
#define AS_REG_7d r10d
|
||||
#endif
|
||||
#define WORD_SZ 8
|
||||
#define WORD_REG(x) r##x
|
||||
#define WORD_PTR QWORD PTR
|
||||
#define AS_PUSH_IF86(x)
|
||||
#define AS_POP_IF86(x)
|
||||
#define AS_JCXZ jrcxz
|
||||
#endif
|
||||
|
||||
// helper macro for stream cipher output
|
||||
#define AS_XMM_OUTPUT4(labelPrefix, inputPtr, outputPtr, x0, x1, x2, x3, t, p0, p1, p2, p3, increment)\
|
||||
AS2( test inputPtr, inputPtr)\
|
||||
ASC( jz, labelPrefix##3)\
|
||||
AS2( test inputPtr, 15)\
|
||||
ASC( jnz, labelPrefix##7)\
|
||||
AS2( pxor xmm##x0, [inputPtr+p0*16])\
|
||||
AS2( pxor xmm##x1, [inputPtr+p1*16])\
|
||||
AS2( pxor xmm##x2, [inputPtr+p2*16])\
|
||||
AS2( pxor xmm##x3, [inputPtr+p3*16])\
|
||||
AS2( add inputPtr, increment*16)\
|
||||
ASC( jmp, labelPrefix##3)\
|
||||
ASL(labelPrefix##7)\
|
||||
AS2( movdqu xmm##t, [inputPtr+p0*16])\
|
||||
AS2( pxor xmm##x0, xmm##t)\
|
||||
AS2( movdqu xmm##t, [inputPtr+p1*16])\
|
||||
AS2( pxor xmm##x1, xmm##t)\
|
||||
AS2( movdqu xmm##t, [inputPtr+p2*16])\
|
||||
AS2( pxor xmm##x2, xmm##t)\
|
||||
AS2( movdqu xmm##t, [inputPtr+p3*16])\
|
||||
AS2( pxor xmm##x3, xmm##t)\
|
||||
AS2( add inputPtr, increment*16)\
|
||||
ASL(labelPrefix##3)\
|
||||
AS2( test outputPtr, 15)\
|
||||
ASC( jnz, labelPrefix##8)\
|
||||
AS2( movdqa [outputPtr+p0*16], xmm##x0)\
|
||||
AS2( movdqa [outputPtr+p1*16], xmm##x1)\
|
||||
AS2( movdqa [outputPtr+p2*16], xmm##x2)\
|
||||
AS2( movdqa [outputPtr+p3*16], xmm##x3)\
|
||||
ASC( jmp, labelPrefix##9)\
|
||||
ASL(labelPrefix##8)\
|
||||
AS2( movdqu [outputPtr+p0*16], xmm##x0)\
|
||||
AS2( movdqu [outputPtr+p1*16], xmm##x1)\
|
||||
AS2( movdqu [outputPtr+p2*16], xmm##x2)\
|
||||
AS2( movdqu [outputPtr+p3*16], xmm##x3)\
|
||||
ASL(labelPrefix##9)\
|
||||
AS2( add outputPtr, increment*16)
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
1668
cryptopp/cryptlib.h
Normal file
1668
cryptopp/cryptlib.h
Normal file
File diff suppressed because it is too large
Load Diff
29
cryptopp/iterhash.h
Normal file
29
cryptopp/iterhash.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef CRYPTOPP_ITERHASH_H
|
||||
#define CRYPTOPP_ITERHASH_H
|
||||
|
||||
#include "secblock.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// *** trimmed down dependency from iterhash.h ***
|
||||
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, unsigned int T_StateSize, class T_Transform, unsigned int T_DigestSize = 0, bool T_StateAligned = false>
|
||||
class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform
|
||||
{
|
||||
public:
|
||||
CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize)
|
||||
unsigned int DigestSize() const {return DIGESTSIZE;};
|
||||
typedef T_HashWordType HashWordType;
|
||||
CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize)
|
||||
|
||||
protected:
|
||||
IteratedHashWithStaticTransform() {this->Init();}
|
||||
void HashEndianCorrectedBlock(const T_HashWordType *data) {T_Transform::Transform(this->m_state, data);}
|
||||
void Init() {T_Transform::InitState(this->m_state);}
|
||||
|
||||
T_HashWordType* StateBuf() {return this->m_state;}
|
||||
FixedSizeAlignedSecBlock<T_HashWordType, T_BlockSize/sizeof(T_HashWordType), T_StateAligned> m_state;
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
1134
cryptopp/misc.h
Normal file
1134
cryptopp/misc.h
Normal file
File diff suppressed because it is too large
Load Diff
2
cryptopp/obj/.gitignore
vendored
Normal file
2
cryptopp/obj/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
21
cryptopp/pch.h
Normal file
21
cryptopp/pch.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef CRYPTOPP_PCH_H
|
||||
#define CRYPTOPP_PCH_H
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
#else
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_PRECOMPILED_HEADERS
|
||||
#include "simple.h"
|
||||
#include "secblock.h"
|
||||
#include "misc.h"
|
||||
#include "smartptr.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
501
cryptopp/secblock.h
Normal file
501
cryptopp/secblock.h
Normal file
@@ -0,0 +1,501 @@
|
||||
// secblock.h - written and placed in the public domain by Wei Dai
|
||||
|
||||
#ifndef CRYPTOPP_SECBLOCK_H
|
||||
#define CRYPTOPP_SECBLOCK_H
|
||||
|
||||
#include "config.h"
|
||||
#include "misc.h"
|
||||
#include <assert.h>
|
||||
|
||||
#if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE) || defined(QNX)
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// ************** secure memory allocation ***************
|
||||
|
||||
template<class T>
|
||||
class AllocatorBase
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef size_t size_type;
|
||||
#ifdef CRYPTOPP_MSVCRT6
|
||||
typedef ptrdiff_t difference_type;
|
||||
#else
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
#endif
|
||||
typedef T * pointer;
|
||||
typedef const T * const_pointer;
|
||||
typedef T & reference;
|
||||
typedef const T & const_reference;
|
||||
|
||||
pointer address(reference r) const {return (&r);}
|
||||
const_pointer address(const_reference r) const {return (&r); }
|
||||
void construct(pointer p, const T& val) {new (p) T(val);}
|
||||
void destroy(pointer p) {p->~T();}
|
||||
size_type max_size() const {return ~size_type(0)/sizeof(T);} // switch to std::numeric_limits<T>::max later
|
||||
|
||||
protected:
|
||||
static void CheckSize(size_t n)
|
||||
{
|
||||
if (n > ~size_t(0) / sizeof(T))
|
||||
throw InvalidArgument("AllocatorBase: requested size would cause integer overflow");
|
||||
}
|
||||
};
|
||||
|
||||
#define CRYPTOPP_INHERIT_ALLOCATOR_TYPES \
|
||||
typedef typename AllocatorBase<T>::value_type value_type;\
|
||||
typedef typename AllocatorBase<T>::size_type size_type;\
|
||||
typedef typename AllocatorBase<T>::difference_type difference_type;\
|
||||
typedef typename AllocatorBase<T>::pointer pointer;\
|
||||
typedef typename AllocatorBase<T>::const_pointer const_pointer;\
|
||||
typedef typename AllocatorBase<T>::reference reference;\
|
||||
typedef typename AllocatorBase<T>::const_reference const_reference;
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
||||
// this pragma causes an internal compiler error if placed immediately before std::swap(a, b)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4700) // VC60 workaround: don't know how to get rid of this warning
|
||||
#endif
|
||||
|
||||
template <class T, class A>
|
||||
typename A::pointer StandardReallocate(A& a, T *p, typename A::size_type oldSize, typename A::size_type newSize, bool preserve)
|
||||
{
|
||||
if (oldSize == newSize)
|
||||
return p;
|
||||
|
||||
if (preserve)
|
||||
{
|
||||
typename A::pointer newPointer = a.allocate(newSize, NULL);
|
||||
memcpy_s(newPointer, sizeof(T)*newSize, p, sizeof(T)*STDMIN(oldSize, newSize));
|
||||
a.deallocate(p, oldSize);
|
||||
return newPointer;
|
||||
}
|
||||
else
|
||||
{
|
||||
a.deallocate(p, oldSize);
|
||||
return a.allocate(newSize, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template <class T, bool T_Align16 = false>
|
||||
class AllocatorWithCleanup : public AllocatorBase<T>
|
||||
{
|
||||
public:
|
||||
CRYPTOPP_INHERIT_ALLOCATOR_TYPES
|
||||
|
||||
pointer allocate(size_type n, const void * = NULL)
|
||||
{
|
||||
CheckSize(n);
|
||||
if (n == 0)
|
||||
return NULL;
|
||||
|
||||
if (CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16 && n*sizeof(T) >= 16)
|
||||
{
|
||||
byte *p;
|
||||
#ifdef CRYPTOPP_MM_MALLOC_AVAILABLE
|
||||
while (!(p = (byte *)_mm_malloc(sizeof(T)*n, 16)))
|
||||
#elif defined(CRYPTOPP_MEMALIGN_AVAILABLE)
|
||||
while (!(p = (byte *)memalign(16, sizeof(T)*n)))
|
||||
#elif defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16)
|
||||
while (!(p = (byte *)malloc(sizeof(T)*n)))
|
||||
#else
|
||||
while (!(p = (byte *)malloc(sizeof(T)*n + 16)))
|
||||
#endif
|
||||
CallNewHandler();
|
||||
|
||||
#ifdef CRYPTOPP_NO_ALIGNED_ALLOC
|
||||
size_t adjustment = 16-((size_t)p%16);
|
||||
p += adjustment;
|
||||
p[-1] = (byte)adjustment;
|
||||
#endif
|
||||
|
||||
assert(IsAlignedOn(p, 16));
|
||||
return (pointer)p;
|
||||
}
|
||||
|
||||
pointer p;
|
||||
while (!(p = (pointer)malloc(sizeof(T)*n)))
|
||||
CallNewHandler();
|
||||
return p;
|
||||
}
|
||||
|
||||
void deallocate(void *p, size_type n)
|
||||
{
|
||||
memset_z(p, 0, n*sizeof(T));
|
||||
|
||||
if (CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16 && n*sizeof(T) >= 16)
|
||||
{
|
||||
#ifdef CRYPTOPP_MM_MALLOC_AVAILABLE
|
||||
_mm_free(p);
|
||||
#elif defined(CRYPTOPP_NO_ALIGNED_ALLOC)
|
||||
p = (byte *)p - ((byte *)p)[-1];
|
||||
free(p);
|
||||
#else
|
||||
free(p);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
pointer reallocate(T *p, size_type oldSize, size_type newSize, bool preserve)
|
||||
{
|
||||
return StandardReallocate(*this, p, oldSize, newSize, preserve);
|
||||
}
|
||||
|
||||
// VS.NET STL enforces the policy of "All STL-compliant allocators have to provide a
|
||||
// template class member called rebind".
|
||||
template <class U> struct rebind { typedef AllocatorWithCleanup<U, T_Align16> other; };
|
||||
#if _MSC_VER >= 1500
|
||||
AllocatorWithCleanup() {}
|
||||
template <class U, bool A> AllocatorWithCleanup(const AllocatorWithCleanup<U, A> &) {}
|
||||
#endif
|
||||
};
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<byte>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<word16>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<word32>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<word64>;
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<word, true>; // for Integer
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
class NullAllocator : public AllocatorBase<T>
|
||||
{
|
||||
public:
|
||||
CRYPTOPP_INHERIT_ALLOCATOR_TYPES
|
||||
|
||||
pointer allocate(size_type n, const void * = NULL)
|
||||
{
|
||||
assert(false);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void deallocate(void *p, size_type n)
|
||||
{
|
||||
//// Bitcoin: don't know why this trips, probably a false alarm, depends on the compiler used.
|
||||
//assert(false);
|
||||
}
|
||||
|
||||
size_type max_size() const {return 0;}
|
||||
};
|
||||
|
||||
// This allocator can't be used with standard collections because
|
||||
// they require that all objects of the same allocator type are equivalent.
|
||||
// So this is for use with SecBlock only.
|
||||
template <class T, size_t S, class A = NullAllocator<T>, bool T_Align16 = false>
|
||||
class FixedSizeAllocatorWithCleanup : public AllocatorBase<T>
|
||||
{
|
||||
public:
|
||||
CRYPTOPP_INHERIT_ALLOCATOR_TYPES
|
||||
|
||||
FixedSizeAllocatorWithCleanup() : m_allocated(false) {}
|
||||
|
||||
pointer allocate(size_type n)
|
||||
{
|
||||
assert(IsAlignedOn(m_array, 8));
|
||||
|
||||
if (n <= S && !m_allocated)
|
||||
{
|
||||
m_allocated = true;
|
||||
return GetAlignedArray();
|
||||
}
|
||||
else
|
||||
return m_fallbackAllocator.allocate(n);
|
||||
}
|
||||
|
||||
pointer allocate(size_type n, const void *hint)
|
||||
{
|
||||
if (n <= S && !m_allocated)
|
||||
{
|
||||
m_allocated = true;
|
||||
return GetAlignedArray();
|
||||
}
|
||||
else
|
||||
return m_fallbackAllocator.allocate(n, hint);
|
||||
}
|
||||
|
||||
void deallocate(void *p, size_type n)
|
||||
{
|
||||
if (p == GetAlignedArray())
|
||||
{
|
||||
assert(n <= S);
|
||||
assert(m_allocated);
|
||||
m_allocated = false;
|
||||
memset(p, 0, n*sizeof(T));
|
||||
}
|
||||
else
|
||||
m_fallbackAllocator.deallocate(p, n);
|
||||
}
|
||||
|
||||
pointer reallocate(pointer p, size_type oldSize, size_type newSize, bool preserve)
|
||||
{
|
||||
if (p == GetAlignedArray() && newSize <= S)
|
||||
{
|
||||
assert(oldSize <= S);
|
||||
if (oldSize > newSize)
|
||||
memset(p + newSize, 0, (oldSize-newSize)*sizeof(T));
|
||||
return p;
|
||||
}
|
||||
|
||||
pointer newPointer = allocate(newSize, NULL);
|
||||
if (preserve)
|
||||
memcpy(newPointer, p, sizeof(T)*STDMIN(oldSize, newSize));
|
||||
deallocate(p, oldSize);
|
||||
return newPointer;
|
||||
}
|
||||
|
||||
size_type max_size() const {return STDMAX(m_fallbackAllocator.max_size(), S);}
|
||||
|
||||
private:
|
||||
#ifdef __BORLANDC__
|
||||
T* GetAlignedArray() {return m_array;}
|
||||
T m_array[S];
|
||||
#else
|
||||
T* GetAlignedArray() {return (CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16) ? (T*)(((byte *)m_array) + (0-(size_t)m_array)%16) : m_array;}
|
||||
CRYPTOPP_ALIGN_DATA(8) T m_array[(CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16) ? S+8/sizeof(T) : S];
|
||||
#endif
|
||||
A m_fallbackAllocator;
|
||||
bool m_allocated;
|
||||
};
|
||||
|
||||
//! a block of memory allocated using A
|
||||
template <class T, class A = AllocatorWithCleanup<T> >
|
||||
class SecBlock
|
||||
{
|
||||
public:
|
||||
typedef typename A::value_type value_type;
|
||||
typedef typename A::pointer iterator;
|
||||
typedef typename A::const_pointer const_iterator;
|
||||
typedef typename A::size_type size_type;
|
||||
|
||||
explicit SecBlock(size_type size=0)
|
||||
: m_size(size) {m_ptr = m_alloc.allocate(size, NULL);}
|
||||
SecBlock(const SecBlock<T, A> &t)
|
||||
: m_size(t.m_size) {m_ptr = m_alloc.allocate(m_size, NULL); memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T));}
|
||||
SecBlock(const T *t, size_type len)
|
||||
: m_size(len)
|
||||
{
|
||||
m_ptr = m_alloc.allocate(len, NULL);
|
||||
if (t == NULL)
|
||||
memset_z(m_ptr, 0, len*sizeof(T));
|
||||
else
|
||||
memcpy(m_ptr, t, len*sizeof(T));
|
||||
}
|
||||
|
||||
~SecBlock()
|
||||
{m_alloc.deallocate(m_ptr, m_size);}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
operator T *() const
|
||||
{return (T*)m_ptr;}
|
||||
#else
|
||||
operator const void *() const
|
||||
{return m_ptr;}
|
||||
operator void *()
|
||||
{return m_ptr;}
|
||||
|
||||
operator const T *() const
|
||||
{return m_ptr;}
|
||||
operator T *()
|
||||
{return m_ptr;}
|
||||
#endif
|
||||
|
||||
// T *operator +(size_type offset)
|
||||
// {return m_ptr+offset;}
|
||||
|
||||
// const T *operator +(size_type offset) const
|
||||
// {return m_ptr+offset;}
|
||||
|
||||
// T& operator[](size_type index)
|
||||
// {assert(index >= 0 && index < m_size); return m_ptr[index];}
|
||||
|
||||
// const T& operator[](size_type index) const
|
||||
// {assert(index >= 0 && index < m_size); return m_ptr[index];}
|
||||
|
||||
iterator begin()
|
||||
{return m_ptr;}
|
||||
const_iterator begin() const
|
||||
{return m_ptr;}
|
||||
iterator end()
|
||||
{return m_ptr+m_size;}
|
||||
const_iterator end() const
|
||||
{return m_ptr+m_size;}
|
||||
|
||||
typename A::pointer data() {return m_ptr;}
|
||||
typename A::const_pointer data() const {return m_ptr;}
|
||||
|
||||
size_type size() const {return m_size;}
|
||||
bool empty() const {return m_size == 0;}
|
||||
|
||||
byte * BytePtr() {return (byte *)m_ptr;}
|
||||
const byte * BytePtr() const {return (const byte *)m_ptr;}
|
||||
size_type SizeInBytes() const {return m_size*sizeof(T);}
|
||||
|
||||
//! set contents and size
|
||||
void Assign(const T *t, size_type len)
|
||||
{
|
||||
New(len);
|
||||
memcpy_s(m_ptr, m_size*sizeof(T), t, len*sizeof(T));
|
||||
}
|
||||
|
||||
//! copy contents and size from another SecBlock
|
||||
void Assign(const SecBlock<T, A> &t)
|
||||
{
|
||||
New(t.m_size);
|
||||
memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T));
|
||||
}
|
||||
|
||||
SecBlock<T, A>& operator=(const SecBlock<T, A> &t)
|
||||
{
|
||||
Assign(t);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// append to this object
|
||||
SecBlock<T, A>& operator+=(const SecBlock<T, A> &t)
|
||||
{
|
||||
size_type oldSize = m_size;
|
||||
Grow(m_size+t.m_size);
|
||||
memcpy_s(m_ptr+oldSize, m_size*sizeof(T), t.m_ptr, t.m_size*sizeof(T));
|
||||
return *this;
|
||||
}
|
||||
|
||||
// append operator
|
||||
SecBlock<T, A> operator+(const SecBlock<T, A> &t)
|
||||
{
|
||||
SecBlock<T, A> result(m_size+t.m_size);
|
||||
memcpy_s(result.m_ptr, result.m_size*sizeof(T), m_ptr, m_size*sizeof(T));
|
||||
memcpy_s(result.m_ptr+m_size, t.m_size*sizeof(T), t.m_ptr, t.m_size*sizeof(T));
|
||||
return result;
|
||||
}
|
||||
|
||||
bool operator==(const SecBlock<T, A> &t) const
|
||||
{
|
||||
return m_size == t.m_size && VerifyBufsEqual(m_ptr, t.m_ptr, m_size*sizeof(T));
|
||||
}
|
||||
|
||||
bool operator!=(const SecBlock<T, A> &t) const
|
||||
{
|
||||
return !operator==(t);
|
||||
}
|
||||
|
||||
//! change size, without preserving contents
|
||||
void New(size_type newSize)
|
||||
{
|
||||
m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, false);
|
||||
m_size = newSize;
|
||||
}
|
||||
|
||||
//! change size and set contents to 0
|
||||
void CleanNew(size_type newSize)
|
||||
{
|
||||
New(newSize);
|
||||
memset_z(m_ptr, 0, m_size*sizeof(T));
|
||||
}
|
||||
|
||||
//! change size only if newSize > current size. contents are preserved
|
||||
void Grow(size_type newSize)
|
||||
{
|
||||
if (newSize > m_size)
|
||||
{
|
||||
m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true);
|
||||
m_size = newSize;
|
||||
}
|
||||
}
|
||||
|
||||
//! change size only if newSize > current size. contents are preserved and additional area is set to 0
|
||||
void CleanGrow(size_type newSize)
|
||||
{
|
||||
if (newSize > m_size)
|
||||
{
|
||||
m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true);
|
||||
memset(m_ptr+m_size, 0, (newSize-m_size)*sizeof(T));
|
||||
m_size = newSize;
|
||||
}
|
||||
}
|
||||
|
||||
//! change size and preserve contents
|
||||
void resize(size_type newSize)
|
||||
{
|
||||
m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true);
|
||||
m_size = newSize;
|
||||
}
|
||||
|
||||
//! swap contents and size with another SecBlock
|
||||
void swap(SecBlock<T, A> &b)
|
||||
{
|
||||
std::swap(m_alloc, b.m_alloc);
|
||||
std::swap(m_size, b.m_size);
|
||||
std::swap(m_ptr, b.m_ptr);
|
||||
}
|
||||
|
||||
//private:
|
||||
A m_alloc;
|
||||
size_type m_size;
|
||||
T *m_ptr;
|
||||
};
|
||||
|
||||
typedef SecBlock<byte> SecByteBlock;
|
||||
typedef SecBlock<byte, AllocatorWithCleanup<byte, true> > AlignedSecByteBlock;
|
||||
typedef SecBlock<word> SecWordBlock;
|
||||
|
||||
//! a SecBlock with fixed size, allocated statically
|
||||
template <class T, unsigned int S, class A = FixedSizeAllocatorWithCleanup<T, S> >
|
||||
class FixedSizeSecBlock : public SecBlock<T, A>
|
||||
{
|
||||
public:
|
||||
explicit FixedSizeSecBlock() : SecBlock<T, A>(S) {}
|
||||
};
|
||||
|
||||
template <class T, unsigned int S, bool T_Align16 = true>
|
||||
class FixedSizeAlignedSecBlock : public FixedSizeSecBlock<T, S, FixedSizeAllocatorWithCleanup<T, S, NullAllocator<T>, T_Align16> >
|
||||
{
|
||||
};
|
||||
|
||||
//! a SecBlock that preallocates size S statically, and uses the heap when this size is exceeded
|
||||
template <class T, unsigned int S, class A = FixedSizeAllocatorWithCleanup<T, S, AllocatorWithCleanup<T> > >
|
||||
class SecBlockWithHint : public SecBlock<T, A>
|
||||
{
|
||||
public:
|
||||
explicit SecBlockWithHint(size_t size) : SecBlock<T, A>(size) {}
|
||||
};
|
||||
|
||||
template<class T, bool A, class U, bool B>
|
||||
inline bool operator==(const CryptoPP::AllocatorWithCleanup<T, A>&, const CryptoPP::AllocatorWithCleanup<U, B>&) {return (true);}
|
||||
template<class T, bool A, class U, bool B>
|
||||
inline bool operator!=(const CryptoPP::AllocatorWithCleanup<T, A>&, const CryptoPP::AllocatorWithCleanup<U, B>&) {return (false);}
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
NAMESPACE_BEGIN(std)
|
||||
template <class T, class A>
|
||||
inline void swap(CryptoPP::SecBlock<T, A> &a, CryptoPP::SecBlock<T, A> &b)
|
||||
{
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
#if defined(_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) || (defined(_STLPORT_VERSION) && !defined(_STLP_MEMBER_TEMPLATE_CLASSES))
|
||||
// working for STLport 5.1.3 and MSVC 6 SP5
|
||||
template <class _Tp1, class _Tp2>
|
||||
inline CryptoPP::AllocatorWithCleanup<_Tp2>&
|
||||
__stl_alloc_rebind(CryptoPP::AllocatorWithCleanup<_Tp1>& __a, const _Tp2*)
|
||||
{
|
||||
return (CryptoPP::AllocatorWithCleanup<_Tp2>&)(__a);
|
||||
}
|
||||
#endif
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
899
cryptopp/sha.cpp
Normal file
899
cryptopp/sha.cpp
Normal file
@@ -0,0 +1,899 @@
|
||||
// sha.cpp - modified by Wei Dai from Steve Reid's public domain sha1.c
|
||||
|
||||
// Steve Reid implemented SHA-1. Wei Dai implemented SHA-2.
|
||||
// Both are in the public domain.
|
||||
|
||||
// use "cl /EP /P /DCRYPTOPP_GENERATE_X64_MASM sha.cpp" to generate MASM code
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#ifndef CRYPTOPP_IMPORTS
|
||||
#ifndef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#include "sha.h"
|
||||
#include "misc.h"
|
||||
#include "cpu.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// start of Steve Reid's code
|
||||
|
||||
#define blk0(i) (W[i] = data[i])
|
||||
#define blk1(i) (W[i&15] = rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1))
|
||||
|
||||
void SHA1::InitState(HashWordType *state)
|
||||
{
|
||||
state[0] = 0x67452301L;
|
||||
state[1] = 0xEFCDAB89L;
|
||||
state[2] = 0x98BADCFEL;
|
||||
state[3] = 0x10325476L;
|
||||
state[4] = 0xC3D2E1F0L;
|
||||
}
|
||||
|
||||
#define f1(x,y,z) (z^(x&(y^z)))
|
||||
#define f2(x,y,z) (x^y^z)
|
||||
#define f3(x,y,z) ((x&y)|(z&(x|y)))
|
||||
#define f4(x,y,z) (x^y^z)
|
||||
|
||||
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
||||
#define R0(v,w,x,y,z,i) z+=f1(w,x,y)+blk0(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R1(v,w,x,y,z,i) z+=f1(w,x,y)+blk1(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R2(v,w,x,y,z,i) z+=f2(w,x,y)+blk1(i)+0x6ED9EBA1+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R3(v,w,x,y,z,i) z+=f3(w,x,y)+blk1(i)+0x8F1BBCDC+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R4(v,w,x,y,z,i) z+=f4(w,x,y)+blk1(i)+0xCA62C1D6+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
|
||||
void SHA1::Transform(word32 *state, const word32 *data)
|
||||
{
|
||||
word32 W[16];
|
||||
/* Copy context->state[] to working vars */
|
||||
word32 a = state[0];
|
||||
word32 b = state[1];
|
||||
word32 c = state[2];
|
||||
word32 d = state[3];
|
||||
word32 e = state[4];
|
||||
/* 4 rounds of 20 operations each. Loop unrolled. */
|
||||
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
|
||||
R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
|
||||
R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
|
||||
R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
|
||||
R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
|
||||
R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
|
||||
R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
|
||||
R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
|
||||
R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
|
||||
R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
|
||||
R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
|
||||
R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
|
||||
R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
|
||||
R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
|
||||
R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
|
||||
R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
|
||||
R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
|
||||
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
|
||||
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
|
||||
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
state[4] += e;
|
||||
}
|
||||
|
||||
// end of Steve Reid's code
|
||||
|
||||
// *************************************************************
|
||||
|
||||
void SHA224::InitState(HashWordType *state)
|
||||
{
|
||||
static const word32 s[8] = {0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
void SHA256::InitState(HashWordType *state)
|
||||
{
|
||||
static const word32 s[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
CRYPTOPP_ALIGN_DATA(16) extern const word32 SHA256_K[64] CRYPTOPP_SECTION_ALIGN16 = {
|
||||
#else
|
||||
extern const word32 SHA256_K[64] = {
|
||||
#endif
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
||||
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
||||
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
||||
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
|
||||
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
|
||||
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
||||
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
||||
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
|
||||
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
|
||||
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
||||
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
||||
};
|
||||
|
||||
#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_GENERATE_X64_MASM)
|
||||
|
||||
#pragma warning(disable: 4731) // frame pointer register 'ebp' modified by inline assembly code
|
||||
|
||||
static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len
|
||||
#if defined(_MSC_VER) && (_MSC_VER == 1200)
|
||||
, ... // VC60 workaround: prevent VC 6 from inlining this function
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if defined(_MSC_VER) && (_MSC_VER == 1200)
|
||||
AS2(mov ecx, [state])
|
||||
AS2(mov edx, [data])
|
||||
#endif
|
||||
|
||||
#define LOCALS_SIZE 8*4 + 16*4 + 4*WORD_SZ
|
||||
#define H(i) [BASE+ASM_MOD(1024+7-(i),8)*4]
|
||||
#define G(i) H(i+1)
|
||||
#define F(i) H(i+2)
|
||||
#define E(i) H(i+3)
|
||||
#define D(i) H(i+4)
|
||||
#define C(i) H(i+5)
|
||||
#define B(i) H(i+6)
|
||||
#define A(i) H(i+7)
|
||||
#define Wt(i) BASE+8*4+ASM_MOD(1024+15-(i),16)*4
|
||||
#define Wt_2(i) Wt((i)-2)
|
||||
#define Wt_15(i) Wt((i)-15)
|
||||
#define Wt_7(i) Wt((i)-7)
|
||||
#define K_END [BASE+8*4+16*4+0*WORD_SZ]
|
||||
#define STATE_SAVE [BASE+8*4+16*4+1*WORD_SZ]
|
||||
#define DATA_SAVE [BASE+8*4+16*4+2*WORD_SZ]
|
||||
#define DATA_END [BASE+8*4+16*4+3*WORD_SZ]
|
||||
#define Kt(i) WORD_REG(si)+(i)*4
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#define BASE esp+4
|
||||
#elif defined(__GNUC__)
|
||||
#define BASE r8
|
||||
#else
|
||||
#define BASE rsp
|
||||
#endif
|
||||
|
||||
#define RA0(i, edx, edi) \
|
||||
AS2( add edx, [Kt(i)] )\
|
||||
AS2( add edx, [Wt(i)] )\
|
||||
AS2( add edx, H(i) )\
|
||||
|
||||
#define RA1(i, edx, edi)
|
||||
|
||||
#define RB0(i, edx, edi)
|
||||
|
||||
#define RB1(i, edx, edi) \
|
||||
AS2( mov AS_REG_7d, [Wt_2(i)] )\
|
||||
AS2( mov edi, [Wt_15(i)])\
|
||||
AS2( mov ebx, AS_REG_7d )\
|
||||
AS2( shr AS_REG_7d, 10 )\
|
||||
AS2( ror ebx, 17 )\
|
||||
AS2( xor AS_REG_7d, ebx )\
|
||||
AS2( ror ebx, 2 )\
|
||||
AS2( xor ebx, AS_REG_7d )/* s1(W_t-2) */\
|
||||
AS2( add ebx, [Wt_7(i)])\
|
||||
AS2( mov AS_REG_7d, edi )\
|
||||
AS2( shr AS_REG_7d, 3 )\
|
||||
AS2( ror edi, 7 )\
|
||||
AS2( add ebx, [Wt(i)])/* s1(W_t-2) + W_t-7 + W_t-16 */\
|
||||
AS2( xor AS_REG_7d, edi )\
|
||||
AS2( add edx, [Kt(i)])\
|
||||
AS2( ror edi, 11 )\
|
||||
AS2( add edx, H(i) )\
|
||||
AS2( xor AS_REG_7d, edi )/* s0(W_t-15) */\
|
||||
AS2( add AS_REG_7d, ebx )/* W_t = s1(W_t-2) + W_t-7 + s0(W_t-15) W_t-16*/\
|
||||
AS2( mov [Wt(i)], AS_REG_7d)\
|
||||
AS2( add edx, AS_REG_7d )\
|
||||
|
||||
#define ROUND(i, r, eax, ecx, edi, edx)\
|
||||
/* in: edi = E */\
|
||||
/* unused: eax, ecx, temp: ebx, AS_REG_7d, out: edx = T1 */\
|
||||
AS2( mov edx, F(i) )\
|
||||
AS2( xor edx, G(i) )\
|
||||
AS2( and edx, edi )\
|
||||
AS2( xor edx, G(i) )/* Ch(E,F,G) = (G^(E&(F^G))) */\
|
||||
AS2( mov AS_REG_7d, edi )\
|
||||
AS2( ror edi, 6 )\
|
||||
AS2( ror AS_REG_7d, 25 )\
|
||||
RA##r(i, edx, edi )/* H + Wt + Kt + Ch(E,F,G) */\
|
||||
AS2( xor AS_REG_7d, edi )\
|
||||
AS2( ror edi, 5 )\
|
||||
AS2( xor AS_REG_7d, edi )/* S1(E) */\
|
||||
AS2( add edx, AS_REG_7d )/* T1 = S1(E) + Ch(E,F,G) + H + Wt + Kt */\
|
||||
RB##r(i, edx, edi )/* H + Wt + Kt + Ch(E,F,G) */\
|
||||
/* in: ecx = A, eax = B^C, edx = T1 */\
|
||||
/* unused: edx, temp: ebx, AS_REG_7d, out: eax = A, ecx = B^C, edx = E */\
|
||||
AS2( mov ebx, ecx )\
|
||||
AS2( xor ecx, B(i) )/* A^B */\
|
||||
AS2( and eax, ecx )\
|
||||
AS2( xor eax, B(i) )/* Maj(A,B,C) = B^((A^B)&(B^C) */\
|
||||
AS2( mov AS_REG_7d, ebx )\
|
||||
AS2( ror ebx, 2 )\
|
||||
AS2( add eax, edx )/* T1 + Maj(A,B,C) */\
|
||||
AS2( add edx, D(i) )\
|
||||
AS2( mov D(i), edx )\
|
||||
AS2( ror AS_REG_7d, 22 )\
|
||||
AS2( xor AS_REG_7d, ebx )\
|
||||
AS2( ror ebx, 11 )\
|
||||
AS2( xor AS_REG_7d, ebx )\
|
||||
AS2( add eax, AS_REG_7d )/* T1 + S0(A) + Maj(A,B,C) */\
|
||||
AS2( mov H(i), eax )\
|
||||
|
||||
#define SWAP_COPY(i) \
|
||||
AS2( mov WORD_REG(bx), [WORD_REG(dx)+i*WORD_SZ])\
|
||||
AS1( bswap WORD_REG(bx))\
|
||||
AS2( mov [Wt(i*(1+CRYPTOPP_BOOL_X64)+CRYPTOPP_BOOL_X64)], WORD_REG(bx))
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
FixedSizeAlignedSecBlock<byte, LOCALS_SIZE> workspace;
|
||||
#endif
|
||||
__asm__ __volatile__
|
||||
(
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
"lea %4, %%r8;"
|
||||
#endif
|
||||
".intel_syntax noprefix;"
|
||||
#elif defined(CRYPTOPP_GENERATE_X64_MASM)
|
||||
ALIGN 8
|
||||
X86_SHA256_HashBlocks PROC FRAME
|
||||
rex_push_reg rsi
|
||||
push_reg rdi
|
||||
push_reg rbx
|
||||
push_reg rbp
|
||||
alloc_stack(LOCALS_SIZE+8)
|
||||
.endprolog
|
||||
mov rdi, r8
|
||||
lea rsi, [?SHA256_K@CryptoPP@@3QBIB + 48*4]
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#ifndef __GNUC__
|
||||
AS2( mov edi, [len])
|
||||
AS2( lea WORD_REG(si), [SHA256_K+48*4])
|
||||
#endif
|
||||
#if !defined(_MSC_VER) || (_MSC_VER < 1400)
|
||||
AS_PUSH_IF86(bx)
|
||||
#endif
|
||||
|
||||
AS_PUSH_IF86(bp)
|
||||
AS2( mov ebx, esp)
|
||||
AS2( and esp, -16)
|
||||
AS2( sub WORD_REG(sp), LOCALS_SIZE)
|
||||
AS_PUSH_IF86(bx)
|
||||
#endif
|
||||
AS2( mov STATE_SAVE, WORD_REG(cx))
|
||||
AS2( mov DATA_SAVE, WORD_REG(dx))
|
||||
AS2( add WORD_REG(di), WORD_REG(dx))
|
||||
AS2( mov DATA_END, WORD_REG(di))
|
||||
AS2( mov K_END, WORD_REG(si))
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
AS2( test edi, 1)
|
||||
ASJ( jnz, 2, f)
|
||||
#endif
|
||||
AS2( movdqa xmm0, XMMWORD_PTR [WORD_REG(cx)+0*16])
|
||||
AS2( movdqa xmm1, XMMWORD_PTR [WORD_REG(cx)+1*16])
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
ASJ( jmp, 0, f)
|
||||
#endif
|
||||
ASL(2) // non-SSE2
|
||||
AS2( mov esi, ecx)
|
||||
AS2( lea edi, A(0))
|
||||
AS2( mov ecx, 8)
|
||||
AS1( rep movsd)
|
||||
AS2( mov esi, K_END)
|
||||
ASJ( jmp, 3, f)
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
ASL(0)
|
||||
AS2( movdqa E(0), xmm1)
|
||||
AS2( movdqa A(0), xmm0)
|
||||
#endif
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
ASL(3)
|
||||
#endif
|
||||
AS2( sub WORD_REG(si), 48*4)
|
||||
SWAP_COPY(0) SWAP_COPY(1) SWAP_COPY(2) SWAP_COPY(3)
|
||||
SWAP_COPY(4) SWAP_COPY(5) SWAP_COPY(6) SWAP_COPY(7)
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
SWAP_COPY(8) SWAP_COPY(9) SWAP_COPY(10) SWAP_COPY(11)
|
||||
SWAP_COPY(12) SWAP_COPY(13) SWAP_COPY(14) SWAP_COPY(15)
|
||||
#endif
|
||||
AS2( mov edi, E(0)) // E
|
||||
AS2( mov eax, B(0)) // B
|
||||
AS2( xor eax, C(0)) // B^C
|
||||
AS2( mov ecx, A(0)) // A
|
||||
|
||||
ROUND(0, 0, eax, ecx, edi, edx)
|
||||
ROUND(1, 0, ecx, eax, edx, edi)
|
||||
ROUND(2, 0, eax, ecx, edi, edx)
|
||||
ROUND(3, 0, ecx, eax, edx, edi)
|
||||
ROUND(4, 0, eax, ecx, edi, edx)
|
||||
ROUND(5, 0, ecx, eax, edx, edi)
|
||||
ROUND(6, 0, eax, ecx, edi, edx)
|
||||
ROUND(7, 0, ecx, eax, edx, edi)
|
||||
ROUND(8, 0, eax, ecx, edi, edx)
|
||||
ROUND(9, 0, ecx, eax, edx, edi)
|
||||
ROUND(10, 0, eax, ecx, edi, edx)
|
||||
ROUND(11, 0, ecx, eax, edx, edi)
|
||||
ROUND(12, 0, eax, ecx, edi, edx)
|
||||
ROUND(13, 0, ecx, eax, edx, edi)
|
||||
ROUND(14, 0, eax, ecx, edi, edx)
|
||||
ROUND(15, 0, ecx, eax, edx, edi)
|
||||
|
||||
ASL(1)
|
||||
AS2(add WORD_REG(si), 4*16)
|
||||
ROUND(0, 1, eax, ecx, edi, edx)
|
||||
ROUND(1, 1, ecx, eax, edx, edi)
|
||||
ROUND(2, 1, eax, ecx, edi, edx)
|
||||
ROUND(3, 1, ecx, eax, edx, edi)
|
||||
ROUND(4, 1, eax, ecx, edi, edx)
|
||||
ROUND(5, 1, ecx, eax, edx, edi)
|
||||
ROUND(6, 1, eax, ecx, edi, edx)
|
||||
ROUND(7, 1, ecx, eax, edx, edi)
|
||||
ROUND(8, 1, eax, ecx, edi, edx)
|
||||
ROUND(9, 1, ecx, eax, edx, edi)
|
||||
ROUND(10, 1, eax, ecx, edi, edx)
|
||||
ROUND(11, 1, ecx, eax, edx, edi)
|
||||
ROUND(12, 1, eax, ecx, edi, edx)
|
||||
ROUND(13, 1, ecx, eax, edx, edi)
|
||||
ROUND(14, 1, eax, ecx, edi, edx)
|
||||
ROUND(15, 1, ecx, eax, edx, edi)
|
||||
AS2( cmp WORD_REG(si), K_END)
|
||||
ASJ( jne, 1, b)
|
||||
|
||||
AS2( mov WORD_REG(dx), DATA_SAVE)
|
||||
AS2( add WORD_REG(dx), 64)
|
||||
AS2( mov AS_REG_7, STATE_SAVE)
|
||||
AS2( mov DATA_SAVE, WORD_REG(dx))
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
AS2( test DWORD PTR DATA_END, 1)
|
||||
ASJ( jnz, 4, f)
|
||||
#endif
|
||||
AS2( movdqa xmm1, XMMWORD_PTR [AS_REG_7+1*16])
|
||||
AS2( movdqa xmm0, XMMWORD_PTR [AS_REG_7+0*16])
|
||||
AS2( paddd xmm1, E(0))
|
||||
AS2( paddd xmm0, A(0))
|
||||
AS2( movdqa [AS_REG_7+1*16], xmm1)
|
||||
AS2( movdqa [AS_REG_7+0*16], xmm0)
|
||||
AS2( cmp WORD_REG(dx), DATA_END)
|
||||
ASJ( jl, 0, b)
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
ASJ( jmp, 5, f)
|
||||
ASL(4) // non-SSE2
|
||||
#endif
|
||||
AS2( add [AS_REG_7+0*4], ecx) // A
|
||||
AS2( add [AS_REG_7+4*4], edi) // E
|
||||
AS2( mov eax, B(0))
|
||||
AS2( mov ebx, C(0))
|
||||
AS2( mov ecx, D(0))
|
||||
AS2( add [AS_REG_7+1*4], eax)
|
||||
AS2( add [AS_REG_7+2*4], ebx)
|
||||
AS2( add [AS_REG_7+3*4], ecx)
|
||||
AS2( mov eax, F(0))
|
||||
AS2( mov ebx, G(0))
|
||||
AS2( mov ecx, H(0))
|
||||
AS2( add [AS_REG_7+5*4], eax)
|
||||
AS2( add [AS_REG_7+6*4], ebx)
|
||||
AS2( add [AS_REG_7+7*4], ecx)
|
||||
AS2( mov ecx, AS_REG_7d)
|
||||
AS2( cmp WORD_REG(dx), DATA_END)
|
||||
ASJ( jl, 2, b)
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
ASL(5)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
AS_POP_IF86(sp)
|
||||
AS_POP_IF86(bp)
|
||||
#if !defined(_MSC_VER) || (_MSC_VER < 1400)
|
||||
AS_POP_IF86(bx)
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
add rsp, LOCALS_SIZE+8
|
||||
pop rbp
|
||||
pop rbx
|
||||
pop rdi
|
||||
pop rsi
|
||||
ret
|
||||
X86_SHA256_HashBlocks ENDP
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
".att_syntax prefix;"
|
||||
:
|
||||
: "c" (state), "d" (data), "S" (SHA256_K+48), "D" (len)
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
, "m" (workspace[0])
|
||||
#endif
|
||||
: "memory", "cc", "%eax"
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
, "%rbx", "%r8"
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // #if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_GENERATE_X64_MASM)
|
||||
|
||||
#ifndef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#ifdef CRYPTOPP_X64_MASM_AVAILABLE
|
||||
extern "C" {
|
||||
void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
|
||||
|
||||
size_t SHA256::HashMultipleBlocks(const word32 *input, size_t length)
|
||||
{
|
||||
X86_SHA256_HashBlocks(m_state, input, (length&(size_t(0)-BLOCKSIZE)) - !HasSSE2());
|
||||
return length % BLOCKSIZE;
|
||||
}
|
||||
|
||||
size_t SHA224::HashMultipleBlocks(const word32 *input, size_t length)
|
||||
{
|
||||
X86_SHA256_HashBlocks(m_state, input, (length&(size_t(0)-BLOCKSIZE)) - !HasSSE2());
|
||||
return length % BLOCKSIZE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define blk2(i) (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))
|
||||
|
||||
#define Ch(x,y,z) (z^(x&(y^z)))
|
||||
#define Maj(x,y,z) (y^((x^y)&(y^z)))
|
||||
|
||||
#define a(i) T[(0-i)&7]
|
||||
#define b(i) T[(1-i)&7]
|
||||
#define c(i) T[(2-i)&7]
|
||||
#define d(i) T[(3-i)&7]
|
||||
#define e(i) T[(4-i)&7]
|
||||
#define f(i) T[(5-i)&7]
|
||||
#define g(i) T[(6-i)&7]
|
||||
#define h(i) T[(7-i)&7]
|
||||
|
||||
#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA256_K[i+j]+(j?blk2(i):blk0(i));\
|
||||
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
|
||||
|
||||
// for SHA256
|
||||
#define S0(x) (rotrFixed(x,2)^rotrFixed(x,13)^rotrFixed(x,22))
|
||||
#define S1(x) (rotrFixed(x,6)^rotrFixed(x,11)^rotrFixed(x,25))
|
||||
#define s0(x) (rotrFixed(x,7)^rotrFixed(x,18)^(x>>3))
|
||||
#define s1(x) (rotrFixed(x,17)^rotrFixed(x,19)^(x>>10))
|
||||
|
||||
void SHA256::Transform(word32 *state, const word32 *data)
|
||||
{
|
||||
word32 W[16];
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
|
||||
// this byte reverse is a waste of time, but this function is only called by MDC
|
||||
ByteReverse(W, data, BLOCKSIZE);
|
||||
X86_SHA256_HashBlocks(state, W, BLOCKSIZE - !HasSSE2());
|
||||
#else
|
||||
word32 T[8];
|
||||
/* Copy context->state[] to working vars */
|
||||
memcpy(T, state, sizeof(T));
|
||||
/* 64 operations, partially loop unrolled */
|
||||
for (unsigned int j=0; j<64; j+=16)
|
||||
{
|
||||
R( 0); R( 1); R( 2); R( 3);
|
||||
R( 4); R( 5); R( 6); R( 7);
|
||||
R( 8); R( 9); R(10); R(11);
|
||||
R(12); R(13); R(14); R(15);
|
||||
}
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a(0);
|
||||
state[1] += b(0);
|
||||
state[2] += c(0);
|
||||
state[3] += d(0);
|
||||
state[4] += e(0);
|
||||
state[5] += f(0);
|
||||
state[6] += g(0);
|
||||
state[7] += h(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
// smaller but slower
|
||||
void SHA256::Transform(word32 *state, const word32 *data)
|
||||
{
|
||||
word32 T[20];
|
||||
word32 W[32];
|
||||
unsigned int i = 0, j = 0;
|
||||
word32 *t = T+8;
|
||||
|
||||
memcpy(t, state, 8*4);
|
||||
word32 e = t[4], a = t[0];
|
||||
|
||||
do
|
||||
{
|
||||
word32 w = data[j];
|
||||
W[j] = w;
|
||||
w += SHA256_K[j];
|
||||
w += t[7];
|
||||
w += S1(e);
|
||||
w += Ch(e, t[5], t[6]);
|
||||
e = t[3] + w;
|
||||
t[3] = t[3+8] = e;
|
||||
w += S0(t[0]);
|
||||
a = w + Maj(a, t[1], t[2]);
|
||||
t[-1] = t[7] = a;
|
||||
--t;
|
||||
++j;
|
||||
if (j%8 == 0)
|
||||
t += 8;
|
||||
} while (j<16);
|
||||
|
||||
do
|
||||
{
|
||||
i = j&0xf;
|
||||
word32 w = s1(W[i+16-2]) + s0(W[i+16-15]) + W[i] + W[i+16-7];
|
||||
W[i+16] = W[i] = w;
|
||||
w += SHA256_K[j];
|
||||
w += t[7];
|
||||
w += S1(e);
|
||||
w += Ch(e, t[5], t[6]);
|
||||
e = t[3] + w;
|
||||
t[3] = t[3+8] = e;
|
||||
w += S0(t[0]);
|
||||
a = w + Maj(a, t[1], t[2]);
|
||||
t[-1] = t[7] = a;
|
||||
|
||||
w = s1(W[(i+1)+16-2]) + s0(W[(i+1)+16-15]) + W[(i+1)] + W[(i+1)+16-7];
|
||||
W[(i+1)+16] = W[(i+1)] = w;
|
||||
w += SHA256_K[j+1];
|
||||
w += (t-1)[7];
|
||||
w += S1(e);
|
||||
w += Ch(e, (t-1)[5], (t-1)[6]);
|
||||
e = (t-1)[3] + w;
|
||||
(t-1)[3] = (t-1)[3+8] = e;
|
||||
w += S0((t-1)[0]);
|
||||
a = w + Maj(a, (t-1)[1], (t-1)[2]);
|
||||
(t-1)[-1] = (t-1)[7] = a;
|
||||
|
||||
t-=2;
|
||||
j+=2;
|
||||
if (j%8 == 0)
|
||||
t += 8;
|
||||
} while (j<64);
|
||||
|
||||
state[0] += a;
|
||||
state[1] += t[1];
|
||||
state[2] += t[2];
|
||||
state[3] += t[3];
|
||||
state[4] += e;
|
||||
state[5] += t[5];
|
||||
state[6] += t[6];
|
||||
state[7] += t[7];
|
||||
}
|
||||
*/
|
||||
|
||||
#undef S0
|
||||
#undef S1
|
||||
#undef s0
|
||||
#undef s1
|
||||
#undef R
|
||||
|
||||
// *************************************************************
|
||||
|
||||
void SHA384::InitState(HashWordType *state)
|
||||
{
|
||||
static const word64 s[8] = {
|
||||
W64LIT(0xcbbb9d5dc1059ed8), W64LIT(0x629a292a367cd507),
|
||||
W64LIT(0x9159015a3070dd17), W64LIT(0x152fecd8f70e5939),
|
||||
W64LIT(0x67332667ffc00b31), W64LIT(0x8eb44a8768581511),
|
||||
W64LIT(0xdb0c2e0d64f98fa7), W64LIT(0x47b5481dbefa4fa4)};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
void SHA512::InitState(HashWordType *state)
|
||||
{
|
||||
static const word64 s[8] = {
|
||||
W64LIT(0x6a09e667f3bcc908), W64LIT(0xbb67ae8584caa73b),
|
||||
W64LIT(0x3c6ef372fe94f82b), W64LIT(0xa54ff53a5f1d36f1),
|
||||
W64LIT(0x510e527fade682d1), W64LIT(0x9b05688c2b3e6c1f),
|
||||
W64LIT(0x1f83d9abfb41bd6b), W64LIT(0x5be0cd19137e2179)};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86
|
||||
CRYPTOPP_ALIGN_DATA(16) static const word64 SHA512_K[80] CRYPTOPP_SECTION_ALIGN16 = {
|
||||
#else
|
||||
static const word64 SHA512_K[80] = {
|
||||
#endif
|
||||
W64LIT(0x428a2f98d728ae22), W64LIT(0x7137449123ef65cd),
|
||||
W64LIT(0xb5c0fbcfec4d3b2f), W64LIT(0xe9b5dba58189dbbc),
|
||||
W64LIT(0x3956c25bf348b538), W64LIT(0x59f111f1b605d019),
|
||||
W64LIT(0x923f82a4af194f9b), W64LIT(0xab1c5ed5da6d8118),
|
||||
W64LIT(0xd807aa98a3030242), W64LIT(0x12835b0145706fbe),
|
||||
W64LIT(0x243185be4ee4b28c), W64LIT(0x550c7dc3d5ffb4e2),
|
||||
W64LIT(0x72be5d74f27b896f), W64LIT(0x80deb1fe3b1696b1),
|
||||
W64LIT(0x9bdc06a725c71235), W64LIT(0xc19bf174cf692694),
|
||||
W64LIT(0xe49b69c19ef14ad2), W64LIT(0xefbe4786384f25e3),
|
||||
W64LIT(0x0fc19dc68b8cd5b5), W64LIT(0x240ca1cc77ac9c65),
|
||||
W64LIT(0x2de92c6f592b0275), W64LIT(0x4a7484aa6ea6e483),
|
||||
W64LIT(0x5cb0a9dcbd41fbd4), W64LIT(0x76f988da831153b5),
|
||||
W64LIT(0x983e5152ee66dfab), W64LIT(0xa831c66d2db43210),
|
||||
W64LIT(0xb00327c898fb213f), W64LIT(0xbf597fc7beef0ee4),
|
||||
W64LIT(0xc6e00bf33da88fc2), W64LIT(0xd5a79147930aa725),
|
||||
W64LIT(0x06ca6351e003826f), W64LIT(0x142929670a0e6e70),
|
||||
W64LIT(0x27b70a8546d22ffc), W64LIT(0x2e1b21385c26c926),
|
||||
W64LIT(0x4d2c6dfc5ac42aed), W64LIT(0x53380d139d95b3df),
|
||||
W64LIT(0x650a73548baf63de), W64LIT(0x766a0abb3c77b2a8),
|
||||
W64LIT(0x81c2c92e47edaee6), W64LIT(0x92722c851482353b),
|
||||
W64LIT(0xa2bfe8a14cf10364), W64LIT(0xa81a664bbc423001),
|
||||
W64LIT(0xc24b8b70d0f89791), W64LIT(0xc76c51a30654be30),
|
||||
W64LIT(0xd192e819d6ef5218), W64LIT(0xd69906245565a910),
|
||||
W64LIT(0xf40e35855771202a), W64LIT(0x106aa07032bbd1b8),
|
||||
W64LIT(0x19a4c116b8d2d0c8), W64LIT(0x1e376c085141ab53),
|
||||
W64LIT(0x2748774cdf8eeb99), W64LIT(0x34b0bcb5e19b48a8),
|
||||
W64LIT(0x391c0cb3c5c95a63), W64LIT(0x4ed8aa4ae3418acb),
|
||||
W64LIT(0x5b9cca4f7763e373), W64LIT(0x682e6ff3d6b2b8a3),
|
||||
W64LIT(0x748f82ee5defb2fc), W64LIT(0x78a5636f43172f60),
|
||||
W64LIT(0x84c87814a1f0ab72), W64LIT(0x8cc702081a6439ec),
|
||||
W64LIT(0x90befffa23631e28), W64LIT(0xa4506cebde82bde9),
|
||||
W64LIT(0xbef9a3f7b2c67915), W64LIT(0xc67178f2e372532b),
|
||||
W64LIT(0xca273eceea26619c), W64LIT(0xd186b8c721c0c207),
|
||||
W64LIT(0xeada7dd6cde0eb1e), W64LIT(0xf57d4f7fee6ed178),
|
||||
W64LIT(0x06f067aa72176fba), W64LIT(0x0a637dc5a2c898a6),
|
||||
W64LIT(0x113f9804bef90dae), W64LIT(0x1b710b35131c471b),
|
||||
W64LIT(0x28db77f523047d84), W64LIT(0x32caab7b40c72493),
|
||||
W64LIT(0x3c9ebe0a15c9bebc), W64LIT(0x431d67c49c100d4c),
|
||||
W64LIT(0x4cc5d4becb3e42b6), W64LIT(0x597f299cfc657e2a),
|
||||
W64LIT(0x5fcb6fab3ad6faec), W64LIT(0x6c44198c4a475817)
|
||||
};
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86
|
||||
// put assembly version in separate function, otherwise MSVC 2005 SP1 doesn't generate correct code for the non-assembly version
|
||||
CRYPTOPP_NAKED static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state, const word64 *data)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
__asm__ __volatile__
|
||||
(
|
||||
".intel_syntax noprefix;"
|
||||
AS1( push ebx)
|
||||
AS2( mov ebx, eax)
|
||||
#else
|
||||
AS1( push ebx)
|
||||
AS1( push esi)
|
||||
AS1( push edi)
|
||||
AS2( lea ebx, SHA512_K)
|
||||
#endif
|
||||
|
||||
AS2( mov eax, esp)
|
||||
AS2( and esp, 0xfffffff0)
|
||||
AS2( sub esp, 27*16) // 17*16 for expanded data, 20*8 for state
|
||||
AS1( push eax)
|
||||
AS2( xor eax, eax)
|
||||
AS2( lea edi, [esp+4+8*8]) // start at middle of state buffer. will decrement pointer each round to avoid copying
|
||||
AS2( lea esi, [esp+4+20*8+8]) // 16-byte alignment, then add 8
|
||||
|
||||
AS2( movdqa xmm0, [ecx+0*16])
|
||||
AS2( movdq2q mm4, xmm0)
|
||||
AS2( movdqa [edi+0*16], xmm0)
|
||||
AS2( movdqa xmm0, [ecx+1*16])
|
||||
AS2( movdqa [edi+1*16], xmm0)
|
||||
AS2( movdqa xmm0, [ecx+2*16])
|
||||
AS2( movdq2q mm5, xmm0)
|
||||
AS2( movdqa [edi+2*16], xmm0)
|
||||
AS2( movdqa xmm0, [ecx+3*16])
|
||||
AS2( movdqa [edi+3*16], xmm0)
|
||||
ASJ( jmp, 0, f)
|
||||
|
||||
#define SSE2_S0_S1(r, a, b, c) \
|
||||
AS2( movq mm6, r)\
|
||||
AS2( psrlq r, a)\
|
||||
AS2( movq mm7, r)\
|
||||
AS2( psllq mm6, 64-c)\
|
||||
AS2( pxor mm7, mm6)\
|
||||
AS2( psrlq r, b-a)\
|
||||
AS2( pxor mm7, r)\
|
||||
AS2( psllq mm6, c-b)\
|
||||
AS2( pxor mm7, mm6)\
|
||||
AS2( psrlq r, c-b)\
|
||||
AS2( pxor r, mm7)\
|
||||
AS2( psllq mm6, b-a)\
|
||||
AS2( pxor r, mm6)
|
||||
|
||||
#define SSE2_s0(r, a, b, c) \
|
||||
AS2( movdqa xmm6, r)\
|
||||
AS2( psrlq r, a)\
|
||||
AS2( movdqa xmm7, r)\
|
||||
AS2( psllq xmm6, 64-c)\
|
||||
AS2( pxor xmm7, xmm6)\
|
||||
AS2( psrlq r, b-a)\
|
||||
AS2( pxor xmm7, r)\
|
||||
AS2( psrlq r, c-b)\
|
||||
AS2( pxor r, xmm7)\
|
||||
AS2( psllq xmm6, c-a)\
|
||||
AS2( pxor r, xmm6)
|
||||
|
||||
#define SSE2_s1(r, a, b, c) \
|
||||
AS2( movdqa xmm6, r)\
|
||||
AS2( psrlq r, a)\
|
||||
AS2( movdqa xmm7, r)\
|
||||
AS2( psllq xmm6, 64-c)\
|
||||
AS2( pxor xmm7, xmm6)\
|
||||
AS2( psrlq r, b-a)\
|
||||
AS2( pxor xmm7, r)\
|
||||
AS2( psllq xmm6, c-b)\
|
||||
AS2( pxor xmm7, xmm6)\
|
||||
AS2( psrlq r, c-b)\
|
||||
AS2( pxor r, xmm7)
|
||||
|
||||
ASL(SHA512_Round)
|
||||
// k + w is in mm0, a is in mm4, e is in mm5
|
||||
AS2( paddq mm0, [edi+7*8]) // h
|
||||
AS2( movq mm2, [edi+5*8]) // f
|
||||
AS2( movq mm3, [edi+6*8]) // g
|
||||
AS2( pxor mm2, mm3)
|
||||
AS2( pand mm2, mm5)
|
||||
SSE2_S0_S1(mm5,14,18,41)
|
||||
AS2( pxor mm2, mm3)
|
||||
AS2( paddq mm0, mm2) // h += Ch(e,f,g)
|
||||
AS2( paddq mm5, mm0) // h += S1(e)
|
||||
AS2( movq mm2, [edi+1*8]) // b
|
||||
AS2( movq mm1, mm2)
|
||||
AS2( por mm2, mm4)
|
||||
AS2( pand mm2, [edi+2*8]) // c
|
||||
AS2( pand mm1, mm4)
|
||||
AS2( por mm1, mm2)
|
||||
AS2( paddq mm1, mm5) // temp = h + Maj(a,b,c)
|
||||
AS2( paddq mm5, [edi+3*8]) // e = d + h
|
||||
AS2( movq [edi+3*8], mm5)
|
||||
AS2( movq [edi+11*8], mm5)
|
||||
SSE2_S0_S1(mm4,28,34,39) // S0(a)
|
||||
AS2( paddq mm4, mm1) // a = temp + S0(a)
|
||||
AS2( movq [edi-8], mm4)
|
||||
AS2( movq [edi+7*8], mm4)
|
||||
AS1( ret)
|
||||
|
||||
// first 16 rounds
|
||||
ASL(0)
|
||||
AS2( movq mm0, [edx+eax*8])
|
||||
AS2( movq [esi+eax*8], mm0)
|
||||
AS2( movq [esi+eax*8+16*8], mm0)
|
||||
AS2( paddq mm0, [ebx+eax*8])
|
||||
ASC( call, SHA512_Round)
|
||||
AS1( inc eax)
|
||||
AS2( sub edi, 8)
|
||||
AS2( test eax, 7)
|
||||
ASJ( jnz, 0, b)
|
||||
AS2( add edi, 8*8)
|
||||
AS2( cmp eax, 16)
|
||||
ASJ( jne, 0, b)
|
||||
|
||||
// rest of the rounds
|
||||
AS2( movdqu xmm0, [esi+(16-2)*8])
|
||||
ASL(1)
|
||||
// data expansion, W[i-2] already in xmm0
|
||||
AS2( movdqu xmm3, [esi])
|
||||
AS2( paddq xmm3, [esi+(16-7)*8])
|
||||
AS2( movdqa xmm2, [esi+(16-15)*8])
|
||||
SSE2_s1(xmm0, 6, 19, 61)
|
||||
AS2( paddq xmm0, xmm3)
|
||||
SSE2_s0(xmm2, 1, 7, 8)
|
||||
AS2( paddq xmm0, xmm2)
|
||||
AS2( movdq2q mm0, xmm0)
|
||||
AS2( movhlps xmm1, xmm0)
|
||||
AS2( paddq mm0, [ebx+eax*8])
|
||||
AS2( movlps [esi], xmm0)
|
||||
AS2( movlps [esi+8], xmm1)
|
||||
AS2( movlps [esi+8*16], xmm0)
|
||||
AS2( movlps [esi+8*17], xmm1)
|
||||
// 2 rounds
|
||||
ASC( call, SHA512_Round)
|
||||
AS2( sub edi, 8)
|
||||
AS2( movdq2q mm0, xmm1)
|
||||
AS2( paddq mm0, [ebx+eax*8+8])
|
||||
ASC( call, SHA512_Round)
|
||||
// update indices and loop
|
||||
AS2( add esi, 16)
|
||||
AS2( add eax, 2)
|
||||
AS2( sub edi, 8)
|
||||
AS2( test eax, 7)
|
||||
ASJ( jnz, 1, b)
|
||||
// do housekeeping every 8 rounds
|
||||
AS2( mov esi, 0xf)
|
||||
AS2( and esi, eax)
|
||||
AS2( lea esi, [esp+4+20*8+8+esi*8])
|
||||
AS2( add edi, 8*8)
|
||||
AS2( cmp eax, 80)
|
||||
ASJ( jne, 1, b)
|
||||
|
||||
#define SSE2_CombineState(i) \
|
||||
AS2( movdqa xmm0, [edi+i*16])\
|
||||
AS2( paddq xmm0, [ecx+i*16])\
|
||||
AS2( movdqa [ecx+i*16], xmm0)
|
||||
|
||||
SSE2_CombineState(0)
|
||||
SSE2_CombineState(1)
|
||||
SSE2_CombineState(2)
|
||||
SSE2_CombineState(3)
|
||||
|
||||
AS1( pop esp)
|
||||
AS1( emms)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
AS1( pop ebx)
|
||||
".att_syntax prefix;"
|
||||
:
|
||||
: "a" (SHA512_K), "c" (state), "d" (data)
|
||||
: "%esi", "%edi", "memory", "cc"
|
||||
);
|
||||
#else
|
||||
AS1( pop edi)
|
||||
AS1( pop esi)
|
||||
AS1( pop ebx)
|
||||
AS1( ret)
|
||||
#endif
|
||||
}
|
||||
#endif // #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
|
||||
void SHA512::Transform(word64 *state, const word64 *data)
|
||||
{
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86
|
||||
if (HasSSE2())
|
||||
{
|
||||
SHA512_SSE2_Transform(state, data);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define S0(x) (rotrFixed(x,28)^rotrFixed(x,34)^rotrFixed(x,39))
|
||||
#define S1(x) (rotrFixed(x,14)^rotrFixed(x,18)^rotrFixed(x,41))
|
||||
#define s0(x) (rotrFixed(x,1)^rotrFixed(x,8)^(x>>7))
|
||||
#define s1(x) (rotrFixed(x,19)^rotrFixed(x,61)^(x>>6))
|
||||
|
||||
#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA512_K[i+j]+(j?blk2(i):blk0(i));\
|
||||
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
|
||||
|
||||
word64 W[16];
|
||||
word64 T[8];
|
||||
/* Copy context->state[] to working vars */
|
||||
memcpy(T, state, sizeof(T));
|
||||
/* 80 operations, partially loop unrolled */
|
||||
for (unsigned int j=0; j<80; j+=16)
|
||||
{
|
||||
R( 0); R( 1); R( 2); R( 3);
|
||||
R( 4); R( 5); R( 6); R( 7);
|
||||
R( 8); R( 9); R(10); R(11);
|
||||
R(12); R(13); R(14); R(15);
|
||||
}
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a(0);
|
||||
state[1] += b(0);
|
||||
state[2] += c(0);
|
||||
state[3] += d(0);
|
||||
state[4] += e(0);
|
||||
state[5] += f(0);
|
||||
state[6] += g(0);
|
||||
state[7] += h(0);
|
||||
}
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM
|
||||
#endif // #ifndef CRYPTOPP_IMPORTS
|
||||
63
cryptopp/sha.h
Normal file
63
cryptopp/sha.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef CRYPTOPP_SHA_H
|
||||
#define CRYPTOPP_SHA_H
|
||||
|
||||
#include "iterhash.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
/// <a href="http://www.weidai.com/scan-mirror/md.html#SHA-1">SHA-1</a>
|
||||
class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA1>
|
||||
{
|
||||
public:
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";}
|
||||
};
|
||||
|
||||
typedef SHA1 SHA; // for backwards compatibility
|
||||
|
||||
//! implements the SHA-256 standard
|
||||
class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256, 32, true>
|
||||
{
|
||||
public:
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
|
||||
size_t HashMultipleBlocks(const word32 *input, size_t length);
|
||||
#endif
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
|
||||
};
|
||||
|
||||
//! implements the SHA-224 standard
|
||||
class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28, true>
|
||||
{
|
||||
public:
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
|
||||
size_t HashMultipleBlocks(const word32 *input, size_t length);
|
||||
#endif
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
|
||||
};
|
||||
|
||||
//! implements the SHA-512 standard
|
||||
class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512, 64, CRYPTOPP_BOOL_X86>
|
||||
{
|
||||
public:
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data);
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
|
||||
};
|
||||
|
||||
//! implements the SHA-384 standard
|
||||
class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48, CRYPTOPP_BOOL_X86>
|
||||
{
|
||||
public:
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";}
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
1
cryptopp/simple.h
Normal file
1
cryptopp/simple.h
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
223
cryptopp/smartptr.h
Normal file
223
cryptopp/smartptr.h
Normal file
@@ -0,0 +1,223 @@
|
||||
#ifndef CRYPTOPP_SMARTPTR_H
|
||||
#define CRYPTOPP_SMARTPTR_H
|
||||
|
||||
#include "config.h"
|
||||
#include <algorithm>
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
template <class T> class simple_ptr
|
||||
{
|
||||
public:
|
||||
simple_ptr() : m_p(NULL) {}
|
||||
~simple_ptr() {delete m_p;}
|
||||
T *m_p;
|
||||
};
|
||||
|
||||
template <class T> class member_ptr
|
||||
{
|
||||
public:
|
||||
explicit member_ptr(T *p = NULL) : m_p(p) {}
|
||||
|
||||
~member_ptr();
|
||||
|
||||
const T& operator*() const { return *m_p; }
|
||||
T& operator*() { return *m_p; }
|
||||
|
||||
const T* operator->() const { return m_p; }
|
||||
T* operator->() { return m_p; }
|
||||
|
||||
const T* get() const { return m_p; }
|
||||
T* get() { return m_p; }
|
||||
|
||||
T* release()
|
||||
{
|
||||
T *old_p = m_p;
|
||||
m_p = 0;
|
||||
return old_p;
|
||||
}
|
||||
|
||||
void reset(T *p = 0);
|
||||
|
||||
protected:
|
||||
member_ptr(const member_ptr<T>& rhs); // copy not allowed
|
||||
void operator=(const member_ptr<T>& rhs); // assignment not allowed
|
||||
|
||||
T *m_p;
|
||||
};
|
||||
|
||||
template <class T> member_ptr<T>::~member_ptr() {delete m_p;}
|
||||
template <class T> void member_ptr<T>::reset(T *p) {delete m_p; m_p = p;}
|
||||
|
||||
// ********************************************************
|
||||
|
||||
template<class T> class value_ptr : public member_ptr<T>
|
||||
{
|
||||
public:
|
||||
value_ptr(const T &obj) : member_ptr<T>(new T(obj)) {}
|
||||
value_ptr(T *p = NULL) : member_ptr<T>(p) {}
|
||||
value_ptr(const value_ptr<T>& rhs)
|
||||
: member_ptr<T>(rhs.m_p ? new T(*rhs.m_p) : NULL) {}
|
||||
|
||||
value_ptr<T>& operator=(const value_ptr<T>& rhs);
|
||||
bool operator==(const value_ptr<T>& rhs)
|
||||
{
|
||||
return (!this->m_p && !rhs.m_p) || (this->m_p && rhs.m_p && *this->m_p == *rhs.m_p);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T> value_ptr<T>& value_ptr<T>::operator=(const value_ptr<T>& rhs)
|
||||
{
|
||||
T *old_p = this->m_p;
|
||||
this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL;
|
||||
delete old_p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ********************************************************
|
||||
|
||||
template<class T> class clonable_ptr : public member_ptr<T>
|
||||
{
|
||||
public:
|
||||
clonable_ptr(const T &obj) : member_ptr<T>(obj.Clone()) {}
|
||||
clonable_ptr(T *p = NULL) : member_ptr<T>(p) {}
|
||||
clonable_ptr(const clonable_ptr<T>& rhs)
|
||||
: member_ptr<T>(rhs.m_p ? rhs.m_p->Clone() : NULL) {}
|
||||
|
||||
clonable_ptr<T>& operator=(const clonable_ptr<T>& rhs);
|
||||
};
|
||||
|
||||
template <class T> clonable_ptr<T>& clonable_ptr<T>::operator=(const clonable_ptr<T>& rhs)
|
||||
{
|
||||
T *old_p = this->m_p;
|
||||
this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL;
|
||||
delete old_p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ********************************************************
|
||||
|
||||
template<class T> class counted_ptr
|
||||
{
|
||||
public:
|
||||
explicit counted_ptr(T *p = 0);
|
||||
counted_ptr(const T &r) : m_p(0) {attach(r);}
|
||||
counted_ptr(const counted_ptr<T>& rhs);
|
||||
|
||||
~counted_ptr();
|
||||
|
||||
const T& operator*() const { return *m_p; }
|
||||
T& operator*() { return *m_p; }
|
||||
|
||||
const T* operator->() const { return m_p; }
|
||||
T* operator->() { return get(); }
|
||||
|
||||
const T* get() const { return m_p; }
|
||||
T* get();
|
||||
|
||||
void attach(const T &p);
|
||||
|
||||
counted_ptr<T> & operator=(const counted_ptr<T>& rhs);
|
||||
|
||||
private:
|
||||
T *m_p;
|
||||
};
|
||||
|
||||
template <class T> counted_ptr<T>::counted_ptr(T *p)
|
||||
: m_p(p)
|
||||
{
|
||||
if (m_p)
|
||||
m_p->m_referenceCount = 1;
|
||||
}
|
||||
|
||||
template <class T> counted_ptr<T>::counted_ptr(const counted_ptr<T>& rhs)
|
||||
: m_p(rhs.m_p)
|
||||
{
|
||||
if (m_p)
|
||||
m_p->m_referenceCount++;
|
||||
}
|
||||
|
||||
template <class T> counted_ptr<T>::~counted_ptr()
|
||||
{
|
||||
if (m_p && --m_p->m_referenceCount == 0)
|
||||
delete m_p;
|
||||
}
|
||||
|
||||
template <class T> void counted_ptr<T>::attach(const T &r)
|
||||
{
|
||||
if (m_p && --m_p->m_referenceCount == 0)
|
||||
delete m_p;
|
||||
if (r.m_referenceCount == 0)
|
||||
{
|
||||
m_p = r.clone();
|
||||
m_p->m_referenceCount = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_p = const_cast<T *>(&r);
|
||||
m_p->m_referenceCount++;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T> T* counted_ptr<T>::get()
|
||||
{
|
||||
if (m_p && m_p->m_referenceCount > 1)
|
||||
{
|
||||
T *temp = m_p->clone();
|
||||
m_p->m_referenceCount--;
|
||||
m_p = temp;
|
||||
m_p->m_referenceCount = 1;
|
||||
}
|
||||
return m_p;
|
||||
}
|
||||
|
||||
template <class T> counted_ptr<T> & counted_ptr<T>::operator=(const counted_ptr<T>& rhs)
|
||||
{
|
||||
if (m_p != rhs.m_p)
|
||||
{
|
||||
if (m_p && --m_p->m_referenceCount == 0)
|
||||
delete m_p;
|
||||
m_p = rhs.m_p;
|
||||
if (m_p)
|
||||
m_p->m_referenceCount++;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ********************************************************
|
||||
|
||||
template <class T> class vector_member_ptrs
|
||||
{
|
||||
public:
|
||||
vector_member_ptrs(size_t size=0)
|
||||
: m_size(size), m_ptr(new member_ptr<T>[size]) {}
|
||||
~vector_member_ptrs()
|
||||
{delete [] this->m_ptr;}
|
||||
|
||||
member_ptr<T>& operator[](size_t index)
|
||||
{assert(index<this->m_size); return this->m_ptr[index];}
|
||||
const member_ptr<T>& operator[](size_t index) const
|
||||
{assert(index<this->m_size); return this->m_ptr[index];}
|
||||
|
||||
size_t size() const {return this->m_size;}
|
||||
void resize(size_t newSize)
|
||||
{
|
||||
member_ptr<T> *newPtr = new member_ptr<T>[newSize];
|
||||
for (size_t i=0; i<this->m_size && i<newSize; i++)
|
||||
newPtr[i].reset(this->m_ptr[i].release());
|
||||
delete [] this->m_ptr;
|
||||
this->m_size = newSize;
|
||||
this->m_ptr = newPtr;
|
||||
}
|
||||
|
||||
private:
|
||||
vector_member_ptrs(const vector_member_ptrs<T> &c); // copy not allowed
|
||||
void operator=(const vector_member_ptrs<T> &x); // assignment not allowed
|
||||
|
||||
size_t m_size;
|
||||
member_ptr<T> *m_ptr;
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
27
cryptopp/stdcpp.h
Normal file
27
cryptopp/stdcpp.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef CRYPTOPP_STDCPP_H
|
||||
#define CRYPTOPP_STDCPP_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <string.h> // CodeWarrior doesn't have memory.h
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
// re-disable this
|
||||
#pragma warning(disable: 4231)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && defined(_CRTAPI1)
|
||||
#define CRYPTOPP_MSVCRT6
|
||||
#endif
|
||||
|
||||
#endif
|
||||
336
db.cpp
336
db.cpp
@@ -8,7 +8,7 @@ void ThreadFlushWalletDB(void* parg);
|
||||
|
||||
|
||||
unsigned int nWalletDBUpdated;
|
||||
|
||||
uint64 nAccountingEntryNumber = 0;
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ CDB::CDB(const char* pszFile, const char* pszMode) : pdb(NULL)
|
||||
return;
|
||||
string strDataDir = GetDataDir();
|
||||
string strLogDir = strDataDir + "/database";
|
||||
_mkdir(strLogDir.c_str());
|
||||
filesystem::create_directory(strLogDir.c_str());
|
||||
string strErrorFile = strDataDir + "/db.log";
|
||||
printf("dbenv.open strLogDir=%s strErrorFile=%s\n", strLogDir.c_str(), strErrorFile.c_str());
|
||||
|
||||
@@ -77,11 +77,10 @@ CDB::CDB(const char* pszFile, const char* pszMode) : pdb(NULL)
|
||||
DB_INIT_MPOOL |
|
||||
DB_INIT_TXN |
|
||||
DB_THREAD |
|
||||
DB_PRIVATE |
|
||||
DB_RECOVER,
|
||||
S_IRUSR | S_IWUSR);
|
||||
if (ret > 0)
|
||||
throw runtime_error(strprintf("CDB() : error %d opening database environment\n", ret));
|
||||
throw runtime_error(strprintf("CDB() : error %d opening database environment", ret));
|
||||
fDbEnvInit = true;
|
||||
}
|
||||
|
||||
@@ -106,7 +105,7 @@ CDB::CDB(const char* pszFile, const char* pszMode) : pdb(NULL)
|
||||
CRITICAL_BLOCK(cs_db)
|
||||
--mapFileUseCount[strFile];
|
||||
strFile = "";
|
||||
throw runtime_error(strprintf("CDB() : can't open database file %s, error %d\n", pszFile, ret));
|
||||
throw runtime_error(strprintf("CDB() : can't open database file %s, error %d", pszFile, ret));
|
||||
}
|
||||
|
||||
if (fCreate && !Exists(string("version")))
|
||||
@@ -130,7 +129,16 @@ void CDB::Close()
|
||||
vTxn.front()->abort();
|
||||
vTxn.clear();
|
||||
pdb = NULL;
|
||||
dbenv.txn_checkpoint(0, 0, 0);
|
||||
|
||||
// Flush database activity from memory pool to disk log
|
||||
unsigned int nMinutes = 0;
|
||||
if (fReadOnly)
|
||||
nMinutes = 1;
|
||||
if (strFile == "addr.dat")
|
||||
nMinutes = 2;
|
||||
if (strFile == "blkindex.dat" && IsInitialBlockDownload() && nBestHeight % 500 != 0)
|
||||
nMinutes = 1;
|
||||
dbenv.txn_checkpoint(0, nMinutes, 0);
|
||||
|
||||
CRITICAL_BLOCK(cs_db)
|
||||
--mapFileUseCount[strFile];
|
||||
@@ -335,6 +343,16 @@ bool CTxDB::WriteHashBestChain(uint256 hashBestChain)
|
||||
return Write(string("hashBestChain"), hashBestChain);
|
||||
}
|
||||
|
||||
bool CTxDB::ReadBestInvalidWork(CBigNum& bnBestInvalidWork)
|
||||
{
|
||||
return Read(string("bnBestInvalidWork"), bnBestInvalidWork);
|
||||
}
|
||||
|
||||
bool CTxDB::WriteBestInvalidWork(CBigNum bnBestInvalidWork)
|
||||
{
|
||||
return Write(string("bnBestInvalidWork"), bnBestInvalidWork);
|
||||
}
|
||||
|
||||
CBlockIndex* InsertBlockIndex(uint256 hash)
|
||||
{
|
||||
if (hash == 0)
|
||||
@@ -357,11 +375,12 @@ CBlockIndex* InsertBlockIndex(uint256 hash)
|
||||
|
||||
bool CTxDB::LoadBlockIndex()
|
||||
{
|
||||
// Get cursor
|
||||
// Get database cursor
|
||||
Dbc* pcursor = GetCursor();
|
||||
if (!pcursor)
|
||||
return false;
|
||||
|
||||
// Load mapBlockIndex
|
||||
unsigned int fFlags = DB_SET_RANGE;
|
||||
loop
|
||||
{
|
||||
@@ -398,9 +417,12 @@ bool CTxDB::LoadBlockIndex()
|
||||
pindexNew->nBits = diskindex.nBits;
|
||||
pindexNew->nNonce = diskindex.nNonce;
|
||||
|
||||
// Watch for genesis block and best block
|
||||
// Watch for genesis block
|
||||
if (pindexGenesisBlock == NULL && diskindex.GetBlockHash() == hashGenesisBlock)
|
||||
pindexGenesisBlock = pindexNew;
|
||||
|
||||
if (!pindexNew->CheckIndex())
|
||||
return error("LoadBlockIndex() : CheckIndex failed at %d", pindexNew->nHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -409,18 +431,63 @@ bool CTxDB::LoadBlockIndex()
|
||||
}
|
||||
pcursor->close();
|
||||
|
||||
// Calculate bnChainWork
|
||||
vector<pair<int, CBlockIndex*> > vSortedByHeight;
|
||||
vSortedByHeight.reserve(mapBlockIndex.size());
|
||||
foreach(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex)
|
||||
{
|
||||
CBlockIndex* pindex = item.second;
|
||||
vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex));
|
||||
}
|
||||
sort(vSortedByHeight.begin(), vSortedByHeight.end());
|
||||
foreach(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
|
||||
{
|
||||
CBlockIndex* pindex = item.second;
|
||||
pindex->bnChainWork = (pindex->pprev ? pindex->pprev->bnChainWork : 0) + pindex->GetBlockWork();
|
||||
}
|
||||
|
||||
// Load hashBestChain pointer to end of best chain
|
||||
if (!ReadHashBestChain(hashBestChain))
|
||||
{
|
||||
if (pindexGenesisBlock == NULL)
|
||||
return true;
|
||||
return error("CTxDB::LoadBlockIndex() : hashBestChain not found");
|
||||
return error("CTxDB::LoadBlockIndex() : hashBestChain not loaded");
|
||||
}
|
||||
|
||||
if (!mapBlockIndex.count(hashBestChain))
|
||||
return error("CTxDB::LoadBlockIndex() : blockindex for hashBestChain not found");
|
||||
return error("CTxDB::LoadBlockIndex() : hashBestChain not found in the block index");
|
||||
pindexBest = mapBlockIndex[hashBestChain];
|
||||
nBestHeight = pindexBest->nHeight;
|
||||
printf("LoadBlockIndex(): hashBestChain=%s height=%d\n", hashBestChain.ToString().substr(0,16).c_str(), nBestHeight);
|
||||
bnBestChainWork = pindexBest->bnChainWork;
|
||||
printf("LoadBlockIndex(): hashBestChain=%s height=%d\n", hashBestChain.ToString().substr(0,20).c_str(), nBestHeight);
|
||||
|
||||
// Load bnBestInvalidWork, OK if it doesn't exist
|
||||
ReadBestInvalidWork(bnBestInvalidWork);
|
||||
|
||||
// Verify blocks in the best chain
|
||||
CBlockIndex* pindexFork = NULL;
|
||||
for (CBlockIndex* pindex = pindexBest; pindex && pindex->pprev; pindex = pindex->pprev)
|
||||
{
|
||||
if (pindex->nHeight < nBestHeight-2500 && !mapArgs.count("-checkblocks"))
|
||||
break;
|
||||
CBlock block;
|
||||
if (!block.ReadFromDisk(pindex))
|
||||
return error("LoadBlockIndex() : block.ReadFromDisk failed");
|
||||
if (!block.CheckBlock())
|
||||
{
|
||||
printf("LoadBlockIndex() : *** found bad block at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
|
||||
pindexFork = pindex->pprev;
|
||||
}
|
||||
}
|
||||
if (pindexFork)
|
||||
{
|
||||
// Reorg back to the fork
|
||||
printf("LoadBlockIndex() : *** moving best chain pointer back to block %d\n", pindexFork->nHeight);
|
||||
CBlock block;
|
||||
if (!block.ReadFromDisk(pindexFork))
|
||||
return error("LoadBlockIndex() : block.ReadFromDisk failed");
|
||||
CTxDB txdb;
|
||||
block.SetBestChain(txdb, pindexFork);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -438,6 +505,11 @@ bool CAddrDB::WriteAddress(const CAddress& addr)
|
||||
return Write(make_pair(string("addr"), addr.GetKey()), addr);
|
||||
}
|
||||
|
||||
bool CAddrDB::EraseAddress(const CAddress& addr)
|
||||
{
|
||||
return Erase(make_pair(string("addr"), addr.GetKey()));
|
||||
}
|
||||
|
||||
bool CAddrDB::LoadAddresses()
|
||||
{
|
||||
CRITICAL_BLOCK(cs_mapAddresses)
|
||||
@@ -489,11 +561,6 @@ bool CAddrDB::LoadAddresses()
|
||||
pcursor->close();
|
||||
|
||||
printf("Loaded %d addresses\n", mapAddresses.size());
|
||||
|
||||
// Fix for possible bug that manifests in mapAddresses.count in irc.cpp,
|
||||
// just need to call count here and it doesn't happen there. The bug was the
|
||||
// pack pragma in irc.cpp and has been fixed, but I'm not in a hurry to delete this.
|
||||
mapAddresses.count(vector<unsigned char>(18));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -511,10 +578,87 @@ bool LoadAddresses()
|
||||
// CWalletDB
|
||||
//
|
||||
|
||||
static set<int64> setKeyPool;
|
||||
static CCriticalSection cs_setKeyPool;
|
||||
|
||||
bool CWalletDB::ReadAccount(const string& strAccount, CAccount& account)
|
||||
{
|
||||
account.SetNull();
|
||||
return Read(make_pair(string("acc"), strAccount), account);
|
||||
}
|
||||
|
||||
bool CWalletDB::WriteAccount(const string& strAccount, const CAccount& account)
|
||||
{
|
||||
return Write(make_pair(string("acc"), strAccount), account);
|
||||
}
|
||||
|
||||
bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry)
|
||||
{
|
||||
return Write(make_tuple(string("acentry"), acentry.strAccount, ++nAccountingEntryNumber), acentry);
|
||||
}
|
||||
|
||||
int64 CWalletDB::GetAccountCreditDebit(const string& strAccount)
|
||||
{
|
||||
list<CAccountingEntry> entries;
|
||||
ListAccountCreditDebit(strAccount, entries);
|
||||
|
||||
int64 nCreditDebit = 0;
|
||||
foreach (const CAccountingEntry& entry, entries)
|
||||
nCreditDebit += entry.nCreditDebit;
|
||||
|
||||
return nCreditDebit;
|
||||
}
|
||||
|
||||
void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountingEntry>& entries)
|
||||
{
|
||||
int64 nCreditDebit = 0;
|
||||
|
||||
bool fAllAccounts = (strAccount == "*");
|
||||
|
||||
Dbc* pcursor = GetCursor();
|
||||
if (!pcursor)
|
||||
throw runtime_error("CWalletDB::ListAccountCreditDebit() : cannot create DB cursor");
|
||||
unsigned int fFlags = DB_SET_RANGE;
|
||||
loop
|
||||
{
|
||||
// Read next record
|
||||
CDataStream ssKey;
|
||||
if (fFlags == DB_SET_RANGE)
|
||||
ssKey << make_tuple(string("acentry"), (fAllAccounts? string("") : strAccount), uint64(0));
|
||||
CDataStream ssValue;
|
||||
int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
|
||||
fFlags = DB_NEXT;
|
||||
if (ret == DB_NOTFOUND)
|
||||
break;
|
||||
else if (ret != 0)
|
||||
{
|
||||
pcursor->close();
|
||||
throw runtime_error("CWalletDB::ListAccountCreditDebit() : error scanning DB");
|
||||
}
|
||||
|
||||
// Unserialize
|
||||
string strType;
|
||||
ssKey >> strType;
|
||||
if (strType != "acentry")
|
||||
break;
|
||||
CAccountingEntry acentry;
|
||||
ssKey >> acentry.strAccount;
|
||||
if (!fAllAccounts && acentry.strAccount != strAccount)
|
||||
break;
|
||||
|
||||
ssValue >> acentry;
|
||||
entries.push_back(acentry);
|
||||
}
|
||||
|
||||
pcursor->close();
|
||||
}
|
||||
|
||||
|
||||
bool CWalletDB::LoadWallet()
|
||||
{
|
||||
vchDefaultKey.clear();
|
||||
int nFileVersion = 0;
|
||||
vector<uint256> vWalletUpgrade;
|
||||
|
||||
// Modify defaults
|
||||
#ifndef __WXMSW__
|
||||
@@ -564,14 +708,42 @@ bool CWalletDB::LoadWallet()
|
||||
if (wtx.GetHash() != hash)
|
||||
printf("Error in wallet.dat, hash mismatch\n");
|
||||
|
||||
// Undo serialize changes in 31600
|
||||
if (31404 <= wtx.fTimeReceivedIsTxTime && wtx.fTimeReceivedIsTxTime <= 31703)
|
||||
{
|
||||
if (!ssValue.empty())
|
||||
{
|
||||
char fTmp;
|
||||
char fUnused;
|
||||
ssValue >> fTmp >> fUnused >> wtx.strFromAccount;
|
||||
printf("LoadWallet() upgrading tx ver=%d %d '%s' %s\n", wtx.fTimeReceivedIsTxTime, fTmp, wtx.strFromAccount.c_str(), hash.ToString().c_str());
|
||||
wtx.fTimeReceivedIsTxTime = fTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("LoadWallet() repairing tx ver=%d %s\n", wtx.fTimeReceivedIsTxTime, hash.ToString().c_str());
|
||||
wtx.fTimeReceivedIsTxTime = 0;
|
||||
}
|
||||
vWalletUpgrade.push_back(hash);
|
||||
}
|
||||
|
||||
//// debug print
|
||||
//printf("LoadWallet %s\n", wtx.GetHash().ToString().c_str());
|
||||
//printf(" %12I64d %s %s %s\n",
|
||||
// wtx.vout[0].nValue,
|
||||
// DateTimeStrFormat("%x %H:%M:%S", wtx.nTime).c_str(),
|
||||
// wtx.hashBlock.ToString().substr(0,16).c_str(),
|
||||
// DateTimeStrFormat("%x %H:%M:%S", wtx.GetBlockTime()).c_str(),
|
||||
// wtx.hashBlock.ToString().substr(0,20).c_str(),
|
||||
// wtx.mapValue["message"].c_str());
|
||||
}
|
||||
else if (strType == "acentry")
|
||||
{
|
||||
string strAccount;
|
||||
ssKey >> strAccount;
|
||||
uint64 nNumber;
|
||||
ssKey >> nNumber;
|
||||
if (nNumber > nAccountingEntryNumber)
|
||||
nAccountingEntryNumber = nNumber;
|
||||
}
|
||||
else if (strType == "key" || strType == "wkey")
|
||||
{
|
||||
vector<unsigned char> vchPubKey;
|
||||
@@ -589,6 +761,12 @@ bool CWalletDB::LoadWallet()
|
||||
{
|
||||
ssValue >> vchDefaultKey;
|
||||
}
|
||||
else if (strType == "pool")
|
||||
{
|
||||
int64 nIndex;
|
||||
ssKey >> nIndex;
|
||||
setKeyPool.insert(nIndex);
|
||||
}
|
||||
else if (strType == "version")
|
||||
{
|
||||
ssValue >> nFileVersion;
|
||||
@@ -618,6 +796,9 @@ bool CWalletDB::LoadWallet()
|
||||
pcursor->close();
|
||||
}
|
||||
|
||||
foreach(uint256 hash, vWalletUpgrade)
|
||||
WriteTx(hash, mapWallet[hash]);
|
||||
|
||||
printf("nFileVersion = %d\n", nFileVersion);
|
||||
printf("fGenerateBitcoins = %d\n", fGenerateBitcoins);
|
||||
printf("nTransactionFee = %"PRI64d"\n", nTransactionFee);
|
||||
@@ -628,14 +809,6 @@ bool CWalletDB::LoadWallet()
|
||||
printf("addrProxy = %s\n", addrProxy.ToString().c_str());
|
||||
|
||||
|
||||
// The transaction fee setting won't be needed for many years to come.
|
||||
// Setting it to zero here in case they set it to something in an earlier version.
|
||||
if (nTransactionFee != 0)
|
||||
{
|
||||
nTransactionFee = 0;
|
||||
WriteSetting("nTransactionFee", nTransactionFee);
|
||||
}
|
||||
|
||||
// Upgrade
|
||||
if (nFileVersion < VERSION)
|
||||
{
|
||||
@@ -646,6 +819,7 @@ bool CWalletDB::LoadWallet()
|
||||
WriteVersion(VERSION);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -737,3 +911,111 @@ void ThreadFlushWalletDB(void* parg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BackupWallet(const string& strDest)
|
||||
{
|
||||
while (!fShutdown)
|
||||
{
|
||||
CRITICAL_BLOCK(cs_db)
|
||||
{
|
||||
const string strFile = "wallet.dat";
|
||||
if (!mapFileUseCount.count(strFile) || mapFileUseCount[strFile] == 0)
|
||||
{
|
||||
// Flush log data to the dat file
|
||||
CloseDb(strFile);
|
||||
dbenv.txn_checkpoint(0, 0, 0);
|
||||
dbenv.lsn_reset(strFile.c_str(), 0);
|
||||
mapFileUseCount.erase(strFile);
|
||||
|
||||
// Copy wallet.dat
|
||||
filesystem::path pathSrc(GetDataDir() + "/" + strFile);
|
||||
filesystem::path pathDest(strDest);
|
||||
if (filesystem::is_directory(pathDest))
|
||||
pathDest = pathDest / strFile;
|
||||
#if BOOST_VERSION >= 104000
|
||||
filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists);
|
||||
#else
|
||||
filesystem::copy_file(pathSrc, pathDest);
|
||||
#endif
|
||||
printf("copied wallet.dat to %s\n", pathDest.string().c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CWalletDB::ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool)
|
||||
{
|
||||
nIndex = -1;
|
||||
keypool.vchPubKey.clear();
|
||||
CRITICAL_BLOCK(cs_main)
|
||||
CRITICAL_BLOCK(cs_mapWallet)
|
||||
CRITICAL_BLOCK(cs_setKeyPool)
|
||||
{
|
||||
// Top up key pool
|
||||
int64 nTargetSize = max(GetArg("-keypool", 100), (int64)0);
|
||||
while (setKeyPool.size() < nTargetSize+1)
|
||||
{
|
||||
int64 nEnd = 1;
|
||||
if (!setKeyPool.empty())
|
||||
nEnd = *(--setKeyPool.end()) + 1;
|
||||
if (!Write(make_pair(string("pool"), nEnd), CKeyPool(GenerateNewKey())))
|
||||
throw runtime_error("ReserveKeyFromKeyPool() : writing generated key failed");
|
||||
setKeyPool.insert(nEnd);
|
||||
printf("keypool added key %"PRI64d", size=%d\n", nEnd, setKeyPool.size());
|
||||
}
|
||||
|
||||
// Get the oldest key
|
||||
assert(!setKeyPool.empty());
|
||||
nIndex = *(setKeyPool.begin());
|
||||
setKeyPool.erase(setKeyPool.begin());
|
||||
if (!Read(make_pair(string("pool"), nIndex), keypool))
|
||||
throw runtime_error("ReserveKeyFromKeyPool() : read failed");
|
||||
if (!mapKeys.count(keypool.vchPubKey))
|
||||
throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool");
|
||||
assert(!keypool.vchPubKey.empty());
|
||||
printf("keypool reserve %"PRI64d"\n", nIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void CWalletDB::KeepKey(int64 nIndex)
|
||||
{
|
||||
// Remove from key pool
|
||||
CRITICAL_BLOCK(cs_main)
|
||||
CRITICAL_BLOCK(cs_mapWallet)
|
||||
{
|
||||
Erase(make_pair(string("pool"), nIndex));
|
||||
}
|
||||
printf("keypool keep %"PRI64d"\n", nIndex);
|
||||
}
|
||||
|
||||
void CWalletDB::ReturnKey(int64 nIndex)
|
||||
{
|
||||
// Return to key pool
|
||||
CRITICAL_BLOCK(cs_setKeyPool)
|
||||
setKeyPool.insert(nIndex);
|
||||
printf("keypool return %"PRI64d"\n", nIndex);
|
||||
}
|
||||
|
||||
vector<unsigned char> GetKeyFromKeyPool()
|
||||
{
|
||||
CWalletDB walletdb;
|
||||
int64 nIndex = 0;
|
||||
CKeyPool keypool;
|
||||
walletdb.ReserveKeyFromKeyPool(nIndex, keypool);
|
||||
walletdb.KeepKey(nIndex);
|
||||
return keypool.vchPubKey;
|
||||
}
|
||||
|
||||
int64 GetOldestKeyPoolTime()
|
||||
{
|
||||
CWalletDB walletdb;
|
||||
int64 nIndex = 0;
|
||||
CKeyPool keypool;
|
||||
walletdb.ReserveKeyFromKeyPool(nIndex, keypool);
|
||||
walletdb.ReturnKey(nIndex);
|
||||
return keypool.nTime;
|
||||
}
|
||||
|
||||
106
db.h
106
db.h
@@ -11,12 +11,14 @@ class CUser;
|
||||
class CReview;
|
||||
class CAddress;
|
||||
class CWalletTx;
|
||||
class CAccount;
|
||||
class CAccountingEntry;
|
||||
|
||||
extern map<string, string> mapAddressBook;
|
||||
extern CCriticalSection cs_mapAddressBook;
|
||||
extern vector<unsigned char> vchDefaultKey;
|
||||
extern bool fClient;
|
||||
|
||||
extern int nBestHeight;
|
||||
|
||||
|
||||
extern unsigned int nWalletDBUpdated;
|
||||
@@ -24,6 +26,8 @@ extern DbEnv dbenv;
|
||||
|
||||
|
||||
extern void DBFlush(bool fShutdown);
|
||||
extern vector<unsigned char> GetKeyFromKeyPool();
|
||||
extern int64 GetOldestKeyPoolTime();
|
||||
|
||||
|
||||
|
||||
@@ -210,7 +214,7 @@ public:
|
||||
if (!pdb)
|
||||
return false;
|
||||
DbTxn* ptxn = NULL;
|
||||
int ret = dbenv.txn_begin(GetTxn(), &ptxn, 0);
|
||||
int ret = dbenv.txn_begin(GetTxn(), &ptxn, DB_TXN_NOSYNC);
|
||||
if (!ptxn || ret != 0)
|
||||
return false;
|
||||
vTxn.push_back(ptxn);
|
||||
@@ -261,7 +265,7 @@ public:
|
||||
class CTxDB : public CDB
|
||||
{
|
||||
public:
|
||||
CTxDB(const char* pszMode="r+") : CDB(!fClient ? "blkindex.dat" : NULL, pszMode) { }
|
||||
CTxDB(const char* pszMode="r+") : CDB("blkindex.dat", pszMode) { }
|
||||
private:
|
||||
CTxDB(const CTxDB&);
|
||||
void operator=(const CTxDB&);
|
||||
@@ -280,6 +284,8 @@ public:
|
||||
bool EraseBlockIndex(uint256 hash);
|
||||
bool ReadHashBestChain(uint256& hashBestChain);
|
||||
bool WriteHashBestChain(uint256 hashBestChain);
|
||||
bool ReadBestInvalidWork(CBigNum& bnBestInvalidWork);
|
||||
bool WriteBestInvalidWork(CBigNum bnBestInvalidWork);
|
||||
bool LoadBlockIndex();
|
||||
};
|
||||
|
||||
@@ -296,6 +302,7 @@ private:
|
||||
void operator=(const CAddrDB&);
|
||||
public:
|
||||
bool WriteAddress(const CAddress& addr);
|
||||
bool EraseAddress(const CAddress& addr);
|
||||
bool LoadAddresses();
|
||||
};
|
||||
|
||||
@@ -306,10 +313,41 @@ bool LoadAddresses();
|
||||
|
||||
|
||||
|
||||
class CKeyPool
|
||||
{
|
||||
public:
|
||||
int64 nTime;
|
||||
vector<unsigned char> vchPubKey;
|
||||
|
||||
CKeyPool()
|
||||
{
|
||||
nTime = GetTime();
|
||||
}
|
||||
|
||||
CKeyPool(const vector<unsigned char>& vchPubKeyIn)
|
||||
{
|
||||
nTime = GetTime();
|
||||
vchPubKey = vchPubKeyIn;
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
if (!(nType & SER_GETHASH))
|
||||
READWRITE(nVersion);
|
||||
READWRITE(nTime);
|
||||
READWRITE(vchPubKey);
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class CWalletDB : public CDB
|
||||
{
|
||||
public:
|
||||
CWalletDB(const char* pszMode="r+") : CDB("wallet.dat", pszMode) { }
|
||||
CWalletDB(const char* pszMode="r+") : CDB("wallet.dat", pszMode)
|
||||
{
|
||||
}
|
||||
private:
|
||||
CWalletDB(const CWalletDB&);
|
||||
void operator=(const CWalletDB&);
|
||||
@@ -393,12 +431,72 @@ public:
|
||||
return Write(make_pair(string("setting"), strKey), value);
|
||||
}
|
||||
|
||||
bool ReadAccount(const string& strAccount, CAccount& account);
|
||||
bool WriteAccount(const string& strAccount, const CAccount& account);
|
||||
bool WriteAccountingEntry(const CAccountingEntry& acentry);
|
||||
int64 GetAccountCreditDebit(const string& strAccount);
|
||||
void ListAccountCreditDebit(const string& strAccount, list<CAccountingEntry>& acentries);
|
||||
|
||||
bool LoadWallet();
|
||||
protected:
|
||||
void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool);
|
||||
void KeepKey(int64 nIndex);
|
||||
static void ReturnKey(int64 nIndex);
|
||||
friend class CReserveKey;
|
||||
friend vector<unsigned char> GetKeyFromKeyPool();
|
||||
friend int64 GetOldestKeyPoolTime();
|
||||
};
|
||||
|
||||
bool LoadWallet(bool& fFirstRunRet);
|
||||
void BackupWallet(const string& strDest);
|
||||
|
||||
inline bool SetAddressBookName(const string& strAddress, const string& strName)
|
||||
{
|
||||
return CWalletDB().WriteName(strAddress, strName);
|
||||
}
|
||||
|
||||
class CReserveKey
|
||||
{
|
||||
protected:
|
||||
int64 nIndex;
|
||||
vector<unsigned char> vchPubKey;
|
||||
public:
|
||||
CReserveKey()
|
||||
{
|
||||
nIndex = -1;
|
||||
}
|
||||
|
||||
~CReserveKey()
|
||||
{
|
||||
if (!fShutdown)
|
||||
ReturnKey();
|
||||
}
|
||||
|
||||
vector<unsigned char> GetReservedKey()
|
||||
{
|
||||
if (nIndex == -1)
|
||||
{
|
||||
CKeyPool keypool;
|
||||
CWalletDB().ReserveKeyFromKeyPool(nIndex, keypool);
|
||||
vchPubKey = keypool.vchPubKey;
|
||||
}
|
||||
assert(!vchPubKey.empty());
|
||||
return vchPubKey;
|
||||
}
|
||||
|
||||
void KeepKey()
|
||||
{
|
||||
if (nIndex != -1)
|
||||
CWalletDB().KeepKey(nIndex);
|
||||
nIndex = -1;
|
||||
vchPubKey.clear();
|
||||
}
|
||||
|
||||
void ReturnKey()
|
||||
{
|
||||
if (nIndex != -1)
|
||||
CWalletDB::ReturnKey(nIndex);
|
||||
nIndex = -1;
|
||||
vchPubKey.clear();
|
||||
}
|
||||
};
|
||||
|
||||
30
headers.h
30
headers.h
@@ -11,21 +11,30 @@
|
||||
#ifdef _WIN32_WINNT
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#ifdef _WIN32_IE
|
||||
#undef _WIN32_IE
|
||||
#endif
|
||||
#define _WIN32_IE 0x0400
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#define __STDC_LIMIT_MACROS // to enable UINT64_MAX from stdint.h
|
||||
#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
#include <sys/param.h> // to get BSD define
|
||||
#endif
|
||||
#ifdef __WXMAC_OSX__
|
||||
#ifndef BSD
|
||||
#define BSD 1
|
||||
#endif
|
||||
#endif
|
||||
#ifdef GUI
|
||||
#include <wx/wx.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/snglinst.h>
|
||||
#if wxUSE_GUI
|
||||
#include <wx/utils.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/taskbar.h>
|
||||
#endif
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/rand.h>
|
||||
@@ -34,6 +43,7 @@
|
||||
#include <db_cxx.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
@@ -60,10 +70,15 @@
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/interprocess/sync/file_lock.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_mutex.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
|
||||
#include <boost/date_time/gregorian/gregorian_types.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/program_options/detail/config_file.hpp>
|
||||
#include <boost/program_options/parsers.hpp>
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include <windows.h>
|
||||
@@ -78,14 +93,17 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <net/if.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#ifdef __BSD__
|
||||
#ifdef BSD
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
@@ -107,10 +125,12 @@ using namespace boost;
|
||||
#include "irc.h"
|
||||
#include "main.h"
|
||||
#include "rpc.h"
|
||||
#if wxUSE_GUI
|
||||
#ifdef GUI
|
||||
#include "uibase.h"
|
||||
#endif
|
||||
#include "ui.h"
|
||||
#else
|
||||
#include "noui.h"
|
||||
#endif
|
||||
#include "init.h"
|
||||
|
||||
#include "xpm/addressbook16.xpm"
|
||||
|
||||
567
init.cpp
567
init.cpp
@@ -7,6 +7,14 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Shutdown
|
||||
//
|
||||
|
||||
void ExitTimeout(void* parg)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
@@ -48,156 +56,11 @@ void Shutdown(void* parg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Startup folder
|
||||
//
|
||||
|
||||
#ifdef __WXMSW__
|
||||
string StartupShortcutPath()
|
||||
void HandleSIGTERM(int)
|
||||
{
|
||||
return MyGetSpecialFolderPath(CSIDL_STARTUP, true) + "\\Bitcoin.lnk";
|
||||
fRequestShutdown = true;
|
||||
}
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
return filesystem::exists(StartupShortcutPath().c_str());
|
||||
}
|
||||
|
||||
void SetStartOnSystemStartup(bool fAutoStart)
|
||||
{
|
||||
// If the shortcut exists already, remove it for updating
|
||||
remove(StartupShortcutPath().c_str());
|
||||
|
||||
if (fAutoStart)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
// Get a pointer to the IShellLink interface.
|
||||
IShellLink* psl = NULL;
|
||||
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL,
|
||||
CLSCTX_INPROC_SERVER, IID_IShellLink,
|
||||
reinterpret_cast<void**>(&psl));
|
||||
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
// Get the current executable path
|
||||
TCHAR pszExePath[MAX_PATH];
|
||||
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
|
||||
|
||||
// Set the path to the shortcut target
|
||||
psl->SetPath(pszExePath);
|
||||
PathRemoveFileSpec(pszExePath);
|
||||
psl->SetWorkingDirectory(pszExePath);
|
||||
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
|
||||
|
||||
// Query IShellLink for the IPersistFile interface for
|
||||
// saving the shortcut in persistent storage.
|
||||
IPersistFile* ppf = NULL;
|
||||
hres = psl->QueryInterface(IID_IPersistFile,
|
||||
reinterpret_cast<void**>(&ppf));
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
WCHAR pwsz[MAX_PATH];
|
||||
// Ensure that the string is ANSI.
|
||||
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().c_str(), -1, pwsz, MAX_PATH);
|
||||
// Save the link by calling IPersistFile::Save.
|
||||
hres = ppf->Save(pwsz, TRUE);
|
||||
ppf->Release();
|
||||
}
|
||||
psl->Release();
|
||||
}
|
||||
CoUninitialize();
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__WXGTK__)
|
||||
|
||||
//
|
||||
// Follow the Desktop Application Autostart Spec:
|
||||
// http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
|
||||
//
|
||||
|
||||
boost::filesystem::path GetAutostartDir()
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
char* pszConfigHome = getenv("XDG_CONFIG_HOME");
|
||||
if (pszConfigHome) return fs::path(pszConfigHome) / fs::path("autostart");
|
||||
char* pszHome = getenv("HOME");
|
||||
if (pszHome) return fs::path(pszHome) / fs::path(".config/autostart");
|
||||
return fs::path();
|
||||
}
|
||||
|
||||
boost::filesystem::path GetAutostartFilePath()
|
||||
{
|
||||
return GetAutostartDir() / boost::filesystem::path("bitcoin.desktop");
|
||||
}
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
boost::filesystem::ifstream optionFile(GetAutostartFilePath());
|
||||
if (!optionFile.good())
|
||||
return false;
|
||||
// Scan through file for "Hidden=true":
|
||||
string line;
|
||||
while (!optionFile.eof())
|
||||
{
|
||||
getline(optionFile, line);
|
||||
if (line.find("Hidden") != string::npos &&
|
||||
line.find("true") != string::npos)
|
||||
return false;
|
||||
}
|
||||
optionFile.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetStartOnSystemStartup(bool fAutoStart)
|
||||
{
|
||||
if (!fAutoStart)
|
||||
{
|
||||
unlink(GetAutostartFilePath().native_file_string().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::filesystem::create_directories(GetAutostartDir());
|
||||
|
||||
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), ios_base::out|ios_base::trunc);
|
||||
if (!optionFile.good())
|
||||
{
|
||||
wxMessageBox(_("Cannot write autostart/bitcoin.desktop file"), "Bitcoin");
|
||||
return;
|
||||
}
|
||||
// Write a bitcoin.desktop file to the autostart directory:
|
||||
char pszExePath[MAX_PATH+1];
|
||||
memset(pszExePath, 0, sizeof(pszExePath));
|
||||
readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1);
|
||||
optionFile << "[Desktop Entry]\n";
|
||||
optionFile << "Type=Application\n";
|
||||
optionFile << "Name=Bitcoin\n";
|
||||
optionFile << "Exec=" << pszExePath << "\n";
|
||||
optionFile << "Terminal=false\n";
|
||||
optionFile << "Hidden=false\n";
|
||||
optionFile.close();
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
// TODO: OSX startup stuff; see:
|
||||
// http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/CustomLogin.html
|
||||
|
||||
bool GetStartOnSystemStartup() { return false; }
|
||||
void SetStartOnSystemStartup(bool fAutoStart) { }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -205,122 +68,59 @@ void SetStartOnSystemStartup(bool fAutoStart) { }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMyApp
|
||||
// Start
|
||||
//
|
||||
|
||||
// Define a new application
|
||||
class CMyApp : public wxApp
|
||||
#ifndef GUI
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
public:
|
||||
wxLocale m_locale;
|
||||
|
||||
CMyApp(){};
|
||||
~CMyApp(){};
|
||||
bool OnInit();
|
||||
bool OnInit2();
|
||||
int OnExit();
|
||||
|
||||
// Hook Initialize so we can start without GUI
|
||||
virtual bool Initialize(int& argc, wxChar** argv);
|
||||
|
||||
// 2nd-level exception handling: we get all the exceptions occurring in any
|
||||
// event handler here
|
||||
virtual bool OnExceptionInMainLoop();
|
||||
|
||||
// 3rd, and final, level exception handling: whenever an unhandled
|
||||
// exception is caught, this function is called
|
||||
virtual void OnUnhandledException();
|
||||
|
||||
// and now for something different: this function is called in case of a
|
||||
// crash (e.g. dereferencing null pointer, division by 0, ...)
|
||||
virtual void OnFatalException();
|
||||
};
|
||||
|
||||
IMPLEMENT_APP(CMyApp)
|
||||
|
||||
bool CMyApp::Initialize(int& argc, wxChar** argv)
|
||||
{
|
||||
if (argc > 1 && argv[1][0] != '-' && (!fWindows || argv[1][0] != '/') &&
|
||||
wxString(argv[1]) != "start")
|
||||
{
|
||||
fCommandLine = true;
|
||||
}
|
||||
else if (!fGUI)
|
||||
{
|
||||
fDaemon = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// wxApp::Initialize will remove environment-specific parameters,
|
||||
// so it's too early to call ParseParameters yet
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
wxString str = argv[i];
|
||||
#ifdef __WXMSW__
|
||||
if (str.size() >= 1 && str[0] == '/')
|
||||
str[0] = '-';
|
||||
char pszLower[MAX_PATH];
|
||||
strlcpy(pszLower, str.c_str(), sizeof(pszLower));
|
||||
strlwr(pszLower);
|
||||
str = pszLower;
|
||||
#endif
|
||||
// haven't decided which argument to use for this yet
|
||||
if (str == "-daemon" || str == "-d" || str == "start")
|
||||
fDaemon = true;
|
||||
}
|
||||
}
|
||||
for (int i = 1; i < argc; i++)
|
||||
if (!IsSwitchChar(argv[i][0]))
|
||||
fCommandLine = true;
|
||||
fDaemon = !fCommandLine;
|
||||
|
||||
#ifdef __WXGTK__
|
||||
if (fDaemon || fCommandLine)
|
||||
if (!fCommandLine)
|
||||
{
|
||||
// Call the original Initialize while suppressing error messages
|
||||
// and ignoring failure. If unable to initialize GTK, it fails
|
||||
// near the end so hopefully the last few things don't matter.
|
||||
// Daemonize
|
||||
pid_t pid = fork();
|
||||
if (pid < 0)
|
||||
{
|
||||
wxLogNull logNo;
|
||||
wxApp::Initialize(argc, argv);
|
||||
fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fDaemon)
|
||||
{
|
||||
// Daemonize
|
||||
pid_t pid = fork();
|
||||
if (pid < 0)
|
||||
{
|
||||
fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
|
||||
return false;
|
||||
}
|
||||
if (pid > 0)
|
||||
pthread_exit((void*)0);
|
||||
}
|
||||
|
||||
return true;
|
||||
if (pid > 0)
|
||||
pthread_exit((void*)0);
|
||||
}
|
||||
#endif
|
||||
|
||||
return wxApp::Initialize(argc, argv);
|
||||
}
|
||||
if (!AppInit(argc, argv))
|
||||
return 1;
|
||||
|
||||
bool CMyApp::OnInit()
|
||||
while (!fShutdown)
|
||||
Sleep(1000000);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AppInit(int argc, char* argv[])
|
||||
{
|
||||
bool fRet = false;
|
||||
try
|
||||
{
|
||||
fRet = OnInit2();
|
||||
fRet = AppInit2(argc, argv);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
PrintException(&e, "OnInit()");
|
||||
PrintException(&e, "AppInit()");
|
||||
} catch (...) {
|
||||
PrintException(NULL, "OnInit()");
|
||||
PrintException(NULL, "AppInit()");
|
||||
}
|
||||
if (!fRet)
|
||||
Shutdown(NULL);
|
||||
return fRet;
|
||||
}
|
||||
|
||||
extern int g_isPainting;
|
||||
|
||||
bool CMyApp::OnInit2()
|
||||
bool AppInit2(int argc, char* argv[])
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
// Turn off microsoft heap dump noise
|
||||
@@ -331,106 +131,113 @@ bool CMyApp::OnInit2()
|
||||
// Disable confusing "helpful" text message on abort, ctrl-c
|
||||
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||
#endif
|
||||
#if defined(__WXMSW__) && defined(__WXDEBUG__) && wxUSE_GUI
|
||||
// Disable malfunctioning wxWidgets debug assertion
|
||||
g_isPainting = 10000;
|
||||
#endif
|
||||
#if wxUSE_GUI
|
||||
wxImage::AddHandler(new wxPNGHandler);
|
||||
#endif
|
||||
#if defined(__WXMSW__ ) || defined(__WXMAC__)
|
||||
SetAppName("Bitcoin");
|
||||
#else
|
||||
SetAppName("bitcoin");
|
||||
#endif
|
||||
#ifndef __WXMSW__
|
||||
umask(077);
|
||||
#endif
|
||||
#ifdef __WXMSW__
|
||||
#if wxUSE_UNICODE
|
||||
// Hack to set wxConvLibc codepage to UTF-8 on Windows,
|
||||
// may break if wxMBConv_win32 implementation in strconv.cpp changes.
|
||||
class wxMBConv_win32 : public wxMBConv
|
||||
{
|
||||
public:
|
||||
long m_CodePage;
|
||||
size_t m_minMBCharWidth;
|
||||
};
|
||||
if (((wxMBConv_win32*)&wxConvLibc)->m_CodePage == CP_ACP)
|
||||
((wxMBConv_win32*)&wxConvLibc)->m_CodePage = CP_UTF8;
|
||||
#ifndef __WXMSW__
|
||||
// Clean shutdown on SIGTERM
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = HandleSIGTERM;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Load locale/<lang>/LC_MESSAGES/bitcoin.mo language file
|
||||
m_locale.Init(wxLANGUAGE_DEFAULT, 0);
|
||||
m_locale.AddCatalogLookupPathPrefix("locale");
|
||||
if (!fWindows)
|
||||
{
|
||||
m_locale.AddCatalogLookupPathPrefix("/usr/share/locale");
|
||||
m_locale.AddCatalogLookupPathPrefix("/usr/local/share/locale");
|
||||
}
|
||||
m_locale.AddCatalog("wxstd"); // wxWidgets standard translations, if any
|
||||
m_locale.AddCatalog("bitcoin");
|
||||
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
ParseParameters(argc, argv);
|
||||
|
||||
if (mapArgs.count("-datadir"))
|
||||
{
|
||||
filesystem::path pathDataDir = filesystem::system_complete(mapArgs["-datadir"]);
|
||||
strlcpy(pszSetDataDir, pathDataDir.string().c_str(), sizeof(pszSetDataDir));
|
||||
}
|
||||
|
||||
ReadConfigFile(mapArgs, mapMultiArgs); // Must be done after processing datadir
|
||||
|
||||
if (mapArgs.count("-?") || mapArgs.count("--help"))
|
||||
{
|
||||
string beta = VERSION_IS_BETA ? _(" beta") : "";
|
||||
string strUsage = string() +
|
||||
_("Bitcoin version") + " " + FormatVersion(VERSION) + pszSubVer + beta + "\n\n" +
|
||||
_("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" +
|
||||
" bitcoin [options] \t " + "\n" +
|
||||
" bitcoin [options] <command> [params]\t " + _("Send command to -server or bitcoind\n") +
|
||||
" bitcoin [options] help \t\t " + _("List commands\n") +
|
||||
" bitcoin [options] help <command> \t\t " + _("Get help for a command\n") +
|
||||
_("Options:\n") +
|
||||
" -conf=<file> \t\t " + _("Specify configuration file (default: bitcoin.conf)\n") +
|
||||
" -gen \t\t " + _("Generate coins\n") +
|
||||
" -gen=0 \t\t " + _("Don't generate coins\n") +
|
||||
" -min \t\t " + _("Start minimized\n") +
|
||||
" -datadir=<dir> \t\t " + _("Specify data directory\n") +
|
||||
" -proxy=<ip:port> \t " + _("Connect through socks4 proxy\n") +
|
||||
" -addnode=<ip> \t " + _("Add a node to connect to\n") +
|
||||
" -connect=<ip> \t\t " + _("Connect only to the specified node\n") +
|
||||
" -nolisten \t " + _("Don't accept connections from outside") +
|
||||
" -paytxfee=<amt> \t " + _("Fee per KB to add to transactions you send\n") +
|
||||
" -server \t\t " + _("Accept command line and JSON-RPC commands\n") +
|
||||
" -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") +
|
||||
" -testnet \t\t " + _("Use the test network\n") +
|
||||
" -rpcuser=<user> \t " + _("Username for JSON-RPC connections\n") +
|
||||
" -rpcpassword=<pw>\t " + _("Password for JSON-RPC connections\n") +
|
||||
" -rpcport=<port> \t\t " + _("Listen for JSON-RPC connections on <port> (default: 8332)\n") +
|
||||
" -rpcallowip=<ip> \t\t " + _("Allow JSON-RPC connections from specified IP address\n") +
|
||||
" -rpcconnect=<ip> \t " + _("Send commands to node running on <ip> (default: 127.0.0.1)\n") +
|
||||
" -keypool=<n> \t " + _("Set key pool size to <n> (default: 100)\n") +
|
||||
" -rescan \t " + _("Rescan the block chain for missing wallet transactions\n");
|
||||
|
||||
#ifdef USE_SSL
|
||||
strUsage += string() +
|
||||
_("\nSSL options: (see the Bitcoin Wiki for SSL setup instructions)\n") +
|
||||
" -rpcssl \t " + _("Use OpenSSL (https) for JSON-RPC connections\n") +
|
||||
" -rpcsslcertificatechainfile=<file.cert>\t " + _("Server certificate file (default: server.cert)\n") +
|
||||
" -rpcsslprivatekeyfile=<file.pem> \t " + _("Server private key (default: server.pem)\n") +
|
||||
" -rpcsslciphers=<ciphers> \t " + _("Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)\n");
|
||||
#endif
|
||||
|
||||
strUsage += string() +
|
||||
" -? \t\t " + _("This help message\n");
|
||||
|
||||
#if defined(__WXMSW__) && defined(GUI)
|
||||
// Tabs make the columns line up in the message box
|
||||
wxMessageBox(strUsage, "Bitcoin", wxOK);
|
||||
#else
|
||||
// Remove tabs
|
||||
strUsage.erase(std::remove(strUsage.begin(), strUsage.end(), '\t'), strUsage.end());
|
||||
fprintf(stderr, "%s", strUsage.c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
fDebug = GetBoolArg("-debug");
|
||||
|
||||
fPrintToConsole = GetBoolArg("-printtoconsole");
|
||||
fPrintToDebugger = GetBoolArg("-printtodebugger");
|
||||
|
||||
fTestNet = GetBoolArg("-testnet");
|
||||
|
||||
fNoListen = GetBoolArg("-nolisten");
|
||||
|
||||
if (fCommandLine)
|
||||
{
|
||||
int ret = CommandLineRPC(argc, argv);
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
ParseParameters(argc, argv);
|
||||
if (mapArgs.count("-?") || mapArgs.count("--help"))
|
||||
{
|
||||
wxString strUsage = string() +
|
||||
_("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" +
|
||||
" bitcoin [options] \t" + "\n" +
|
||||
" bitcoin [command] \t" + _("Send command to bitcoin running with -server or -daemon\n") +
|
||||
" bitcoin [command] -? \t" + _("Get help for a command\n") +
|
||||
" bitcoin help \t" + _("List commands\n") +
|
||||
_("Options:\n") +
|
||||
" -gen \t " + _("Generate coins\n") +
|
||||
" -gen=0 \t " + _("Don't generate coins\n") +
|
||||
" -min \t " + _("Start minimized\n") +
|
||||
" -datadir=<dir> \t " + _("Specify data directory\n") +
|
||||
" -proxy=<ip:port>\t " + _("Connect through socks4 proxy\n") +
|
||||
" -addnode=<ip> \t " + _("Add a node to connect to\n") +
|
||||
" -connect=<ip> \t " + _("Connect only to the specified node\n") +
|
||||
" -server \t " + _("Accept command line and JSON-RPC commands\n") +
|
||||
" -daemon \t " + _("Run in the background as a daemon and accept commands\n") +
|
||||
" -? \t " + _("This help message\n");
|
||||
|
||||
#if defined(__WXMSW__) && wxUSE_GUI
|
||||
// Tabs make the columns line up in the message box
|
||||
wxMessageBox(strUsage, "Bitcoin", wxOK);
|
||||
#else
|
||||
// Remove tabs
|
||||
strUsage.Replace("\t", "");
|
||||
fprintf(stderr, "%s", ((string)strUsage).c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-datadir"))
|
||||
strlcpy(pszSetDataDir, mapArgs["-datadir"].c_str(), sizeof(pszSetDataDir));
|
||||
|
||||
if (mapArgs.count("-debug"))
|
||||
fDebug = true;
|
||||
|
||||
if (mapArgs.count("-printtodebugger"))
|
||||
fPrintToDebugger = true;
|
||||
|
||||
if (!fDebug && !pszSetDataDir[0])
|
||||
ShrinkDebugFile();
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
|
||||
printf("Bitcoin version %d.%d.%d%s beta, OS version %s\n", VERSION/10000, (VERSION/100)%100, VERSION%100, pszSubVer, ((string)wxGetOsDescription()).c_str());
|
||||
printf("System default language is %d %s\n", m_locale.GetSystemLanguage(), ((string)m_locale.GetSysName()).c_str());
|
||||
printf("Language file %s (%s)\n", (string("locale/") + (string)m_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)m_locale.GetLocale()).c_str());
|
||||
printf("Bitcoin version %s%s%s\n", FormatVersion(VERSION).c_str(), pszSubVer, VERSION_IS_BETA ? _(" beta") : "");
|
||||
#ifdef GUI
|
||||
printf("OS version %s\n", ((string)wxGetOsDescription()).c_str());
|
||||
printf("System default language is %d %s\n", g_locale.GetSystemLanguage(), ((string)g_locale.GetSysName()).c_str());
|
||||
printf("Language file %s (%s)\n", (string("locale/") + (string)g_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)g_locale.GetLocale()).c_str());
|
||||
#endif
|
||||
printf("Default data directory %s\n", GetDefaultDataDir().c_str());
|
||||
|
||||
if (mapArgs.count("-loadblockindextest"))
|
||||
if (GetBoolArg("-loadblockindextest"))
|
||||
{
|
||||
CTxDB txdb("r");
|
||||
txdb.LoadBlockIndex();
|
||||
@@ -442,9 +249,8 @@ bool CMyApp::OnInit2()
|
||||
// Limit to single instance per user
|
||||
// Required to protect the database files if we're going to keep deleting log.*
|
||||
//
|
||||
#ifdef __WXMSW__
|
||||
// todo: wxSingleInstanceChecker wasn't working on Linux, never deleted its lock file
|
||||
// maybe should go by whether successfully bind port 8333 instead
|
||||
#if defined(__WXMSW__) && defined(GUI)
|
||||
// wxSingleInstanceChecker doesn't work on Linux
|
||||
wxString strMutexName = wxString("bitcoin_running.") + getenv("HOMEPATH");
|
||||
for (int i = 0; i < strMutexName.size(); i++)
|
||||
if (!isalnum(strMutexName[i]))
|
||||
@@ -456,7 +262,6 @@ bool CMyApp::OnInit2()
|
||||
unsigned int nStart = GetTime();
|
||||
loop
|
||||
{
|
||||
// TODO: find out how to do this in Linux, or replace with wxWidgets commands
|
||||
// Show the previous instance and exit
|
||||
HWND hwndPrev = FindWindowA("wxWindowClassNR", "Bitcoin");
|
||||
if (hwndPrev)
|
||||
@@ -480,15 +285,28 @@ bool CMyApp::OnInit2()
|
||||
}
|
||||
#endif
|
||||
|
||||
// Bind to the port early so we can tell if another instance is already running.
|
||||
// This is a backup to wxSingleInstanceChecker, which doesn't work on Linux.
|
||||
string strErrors;
|
||||
if (!BindListenPort(strErrors))
|
||||
// Make sure only a single bitcoin process is using the data directory.
|
||||
string strLockFile = GetDataDir() + "/.lock";
|
||||
FILE* file = fopen(strLockFile.c_str(), "a"); // empty lock file; created if it doesn't exist.
|
||||
fclose(file);
|
||||
static boost::interprocess::file_lock lock(strLockFile.c_str());
|
||||
if (!lock.try_lock())
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin");
|
||||
wxMessageBox(strprintf(_("Cannot obtain a lock on data directory %s. Bitcoin is probably already running."), GetDataDir().c_str()), "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Bind to the port early so we can tell if another instance is already running.
|
||||
string strErrors;
|
||||
if (!fNoListen)
|
||||
{
|
||||
if (!BindListenPort(strErrors))
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Load data files
|
||||
//
|
||||
@@ -516,6 +334,13 @@ bool CMyApp::OnInit2()
|
||||
strErrors += _("Error loading wallet.dat \n");
|
||||
printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
if (GetBoolArg("-rescan"))
|
||||
{
|
||||
nStart = GetTimeMillis();
|
||||
ScanForWalletTransactions(pindexGenesisBlock);
|
||||
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
}
|
||||
|
||||
printf("Done loading\n");
|
||||
|
||||
//// debug print
|
||||
@@ -528,7 +353,7 @@ bool CMyApp::OnInit2()
|
||||
|
||||
if (!strErrors.empty())
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin");
|
||||
wxMessageBox(strErrors, "Bitcoin", wxOK | wxICON_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -538,7 +363,7 @@ bool CMyApp::OnInit2()
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
if (mapArgs.count("-printblockindex") || mapArgs.count("-printblocktree"))
|
||||
if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
|
||||
{
|
||||
PrintBlockTree();
|
||||
return false;
|
||||
@@ -567,13 +392,7 @@ bool CMyApp::OnInit2()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-gen"))
|
||||
{
|
||||
if (mapArgs["-gen"].empty())
|
||||
fGenerateBitcoins = true;
|
||||
else
|
||||
fGenerateBitcoins = (atoi(mapArgs["-gen"].c_str()) != 0);
|
||||
}
|
||||
fGenerateBitcoins = GetBoolArg("-gen");
|
||||
|
||||
if (mapArgs.count("-proxy"))
|
||||
{
|
||||
@@ -597,11 +416,24 @@ bool CMyApp::OnInit2()
|
||||
}
|
||||
}
|
||||
|
||||
if (mapArgs.count("-paytxfee"))
|
||||
{
|
||||
if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee))
|
||||
{
|
||||
wxMessageBox(_("Invalid amount for -paytxfee=<amount>"), "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
if (nTransactionFee > 0.25 * COIN)
|
||||
wxMessageBox(_("Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction."), "Bitcoin", wxOK | wxICON_EXCLAMATION);
|
||||
}
|
||||
|
||||
//
|
||||
// Create the main window and start the node
|
||||
//
|
||||
#ifdef GUI
|
||||
if (!fDaemon)
|
||||
CreateMainWindow();
|
||||
#endif
|
||||
|
||||
if (!CheckDiskSpace())
|
||||
return false;
|
||||
@@ -611,68 +443,13 @@ bool CMyApp::OnInit2()
|
||||
if (!CreateThread(StartNode, NULL))
|
||||
wxMessageBox("Error: CreateThread(StartNode) failed", "Bitcoin");
|
||||
|
||||
if (mapArgs.count("-server") || fDaemon)
|
||||
if (GetBoolArg("-server") || fDaemon)
|
||||
CreateThread(ThreadRPCServer, NULL);
|
||||
|
||||
#if defined(__WXMSW__) && defined(GUI)
|
||||
if (fFirstRun)
|
||||
SetStartOnSystemStartup(true);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int CMyApp::OnExit()
|
||||
{
|
||||
Shutdown(NULL);
|
||||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
bool CMyApp::OnExceptionInMainLoop()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
PrintException(&e, "CMyApp::OnExceptionInMainLoop()");
|
||||
wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PrintException(NULL, "CMyApp::OnExceptionInMainLoop()");
|
||||
wxLogWarning("Unknown exception");
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMyApp::OnUnhandledException()
|
||||
{
|
||||
// this shows how we may let some exception propagate uncaught
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
PrintException(&e, "CMyApp::OnUnhandledException()");
|
||||
wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PrintException(NULL, "CMyApp::OnUnhandledException()");
|
||||
wxLogWarning("Unknown exception");
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void CMyApp::OnFatalException()
|
||||
{
|
||||
wxMessageBox(_("Program has crashed and will terminate. "), "Bitcoin", wxOK | wxICON_ERROR);
|
||||
}
|
||||
|
||||
4
init.h
4
init.h
@@ -3,5 +3,5 @@
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
void Shutdown(void* parg);
|
||||
bool GetStartOnSystemStartup();
|
||||
void SetStartOnSystemStartup(bool fAutoStart);
|
||||
bool AppInit(int argc, char* argv[]);
|
||||
bool AppInit2(int argc, char* argv[]);
|
||||
|
||||
151
irc.cpp
151
irc.cpp
@@ -5,6 +5,10 @@
|
||||
#include "headers.h"
|
||||
|
||||
int nGotIRCAddresses = 0;
|
||||
bool fGotExternalIP = false;
|
||||
|
||||
void ThreadIRCSeed2(void* parg);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -81,18 +85,31 @@ bool RecvLine(SOCKET hSocket, string& strLine)
|
||||
}
|
||||
else if (nBytes <= 0)
|
||||
{
|
||||
if (fShutdown)
|
||||
return false;
|
||||
if (nBytes < 0)
|
||||
{
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr == WSAEMSGSIZE)
|
||||
continue;
|
||||
if (nErr == WSAEWOULDBLOCK || nErr == WSAEINTR || nErr == WSAEINPROGRESS)
|
||||
{
|
||||
Sleep(10);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!strLine.empty())
|
||||
return true;
|
||||
// socket closed
|
||||
printf("IRC socket closed\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// socket error
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
|
||||
if (nBytes == 0)
|
||||
{
|
||||
// socket closed
|
||||
printf("IRC socket closed\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// socket error
|
||||
int nErr = WSAGetLastError();
|
||||
printf("IRC recv failed: %d\n", nErr);
|
||||
return false;
|
||||
}
|
||||
@@ -123,11 +140,12 @@ bool RecvLineIRC(SOCKET hSocket, string& strLine)
|
||||
}
|
||||
}
|
||||
|
||||
int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL)
|
||||
int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL, const char* psz4=NULL)
|
||||
{
|
||||
loop
|
||||
{
|
||||
string strLine;
|
||||
strLine.reserve(10000);
|
||||
if (!RecvLineIRC(hSocket, strLine))
|
||||
return 0;
|
||||
printf("IRC %s\n", strLine.c_str());
|
||||
@@ -137,6 +155,8 @@ int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const cha
|
||||
return 2;
|
||||
if (psz3 && strLine.find(psz3) != -1)
|
||||
return 3;
|
||||
if (psz4 && strLine.find(psz4) != -1)
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,13 +174,94 @@ bool Wait(int nSeconds)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RecvCodeLine(SOCKET hSocket, const char* psz1, string& strRet)
|
||||
{
|
||||
strRet.clear();
|
||||
loop
|
||||
{
|
||||
string strLine;
|
||||
if (!RecvLineIRC(hSocket, strLine))
|
||||
return false;
|
||||
|
||||
vector<string> vWords;
|
||||
ParseString(strLine, ' ', vWords);
|
||||
if (vWords.size() < 2)
|
||||
continue;
|
||||
|
||||
if (vWords[1] == psz1)
|
||||
{
|
||||
printf("IRC %s\n", strLine.c_str());
|
||||
strRet = strLine;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GetIPFromIRC(SOCKET hSocket, string strMyName, unsigned int& ipRet)
|
||||
{
|
||||
Send(hSocket, strprintf("USERHOST %s\r", strMyName.c_str()).c_str());
|
||||
|
||||
string strLine;
|
||||
if (!RecvCodeLine(hSocket, "302", strLine))
|
||||
return false;
|
||||
|
||||
vector<string> vWords;
|
||||
ParseString(strLine, ' ', vWords);
|
||||
if (vWords.size() < 4)
|
||||
return false;
|
||||
|
||||
string str = vWords[3];
|
||||
if (str.rfind("@") == string::npos)
|
||||
return false;
|
||||
string strHost = str.substr(str.rfind("@")+1);
|
||||
|
||||
unsigned int a=0, b=0, c=0, d=0;
|
||||
if (sscanf(strHost.c_str(), "%u.%u.%u.%u", &a, &b, &c, &d) == 4 &&
|
||||
inet_addr(strHost.c_str()) != INADDR_NONE)
|
||||
{
|
||||
printf("GetIPFromIRC() userhost is IP %s\n", strHost.c_str());
|
||||
ipRet = CAddress(strHost).ip;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Hybrid IRC used by lfnet always returns IP when you userhost yourself,
|
||||
// but in case another IRC is ever used this should work.
|
||||
printf("GetIPFromIRC() got userhost %s\n", strHost.c_str());
|
||||
if (fUseProxy)
|
||||
return false;
|
||||
struct hostent* phostent = gethostbyname(strHost.c_str());
|
||||
if (!phostent || !phostent->h_addr_list || !phostent->h_addr_list[0])
|
||||
return false;
|
||||
ipRet = *(u_long*)phostent->h_addr_list[0];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ThreadIRCSeed(void* parg)
|
||||
{
|
||||
if (mapArgs.count("-connect"))
|
||||
IMPLEMENT_RANDOMIZE_STACK(ThreadIRCSeed(parg));
|
||||
try
|
||||
{
|
||||
ThreadIRCSeed2(parg);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
PrintExceptionContinue(&e, "ThreadIRCSeed()");
|
||||
} catch (...) {
|
||||
PrintExceptionContinue(NULL, "ThreadIRCSeed()");
|
||||
}
|
||||
printf("ThreadIRCSeed exiting\n");
|
||||
}
|
||||
|
||||
void ThreadIRCSeed2(void* parg)
|
||||
{
|
||||
/* Dont advertise on IRC if we don't allow incoming connections */
|
||||
if (mapArgs.count("-connect") || fNoListen)
|
||||
return;
|
||||
if (mapArgs.count("-noirc"))
|
||||
|
||||
if (GetBoolArg("-noirc"))
|
||||
return;
|
||||
printf("ThreadIRCSeed started\n");
|
||||
int nErrorWait = 10;
|
||||
@@ -191,7 +292,7 @@ void ThreadIRCSeed(void* parg)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RecvUntil(hSocket, "Found your hostname", "using your IP address instead", "Couldn't look up your hostname"))
|
||||
if (!RecvUntil(hSocket, "Found your hostname", "using your IP address instead", "Couldn't look up your hostname", "ignoring hostname"))
|
||||
{
|
||||
closesocket(hSocket);
|
||||
hSocket = INVALID_SOCKET;
|
||||
@@ -231,11 +332,27 @@ void ThreadIRCSeed(void* parg)
|
||||
}
|
||||
Sleep(500);
|
||||
|
||||
Send(hSocket, "JOIN #bitcoin\r");
|
||||
Send(hSocket, "WHO #bitcoin\r");
|
||||
// Get our external IP from the IRC server and re-nick before joining the channel
|
||||
CAddress addrFromIRC;
|
||||
if (GetIPFromIRC(hSocket, strMyName, addrFromIRC.ip))
|
||||
{
|
||||
printf("GetIPFromIRC() returned %s\n", addrFromIRC.ToStringIP().c_str());
|
||||
if (!fUseProxy && addrFromIRC.IsRoutable())
|
||||
{
|
||||
// IRC lets you to re-nick
|
||||
fGotExternalIP = true;
|
||||
addrLocalHost.ip = addrFromIRC.ip;
|
||||
strMyName = EncodeAddress(addrLocalHost);
|
||||
Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Send(hSocket, fTestNet ? "JOIN #bitcoinTEST\r" : "JOIN #bitcoin\r");
|
||||
Send(hSocket, fTestNet ? "WHO #bitcoinTEST\r" : "WHO #bitcoin\r");
|
||||
|
||||
int64 nStart = GetTime();
|
||||
string strLine;
|
||||
strLine.reserve(10000);
|
||||
while (!fShutdown && RecvLineIRC(hSocket, strLine))
|
||||
{
|
||||
if (strLine.empty() || strLine.size() > 900 || strLine[0] != ':')
|
||||
@@ -271,8 +388,8 @@ void ThreadIRCSeed(void* parg)
|
||||
CAddress addr;
|
||||
if (DecodeAddress(pszName, addr))
|
||||
{
|
||||
addr.nTime = GetAdjustedTime() - 51 * 60;
|
||||
if (AddAddress(addr))
|
||||
addr.nTime = GetAdjustedTime();
|
||||
if (AddAddress(addr, 51 * 60))
|
||||
printf("IRC got new address\n");
|
||||
nGotIRCAddresses++;
|
||||
}
|
||||
|
||||
1
irc.h
1
irc.h
@@ -6,3 +6,4 @@ bool RecvLine(SOCKET hSocket, string& strLine);
|
||||
void ThreadIRCSeed(void* parg);
|
||||
|
||||
extern int nGotIRCAddresses;
|
||||
extern bool fGotExternalIP;
|
||||
|
||||
@@ -342,7 +342,7 @@ namespace json_spirit
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
||||
/// satoshi: tell the types by name instead of by number
|
||||
///// Bitcoin: Tell the types by name instead of by number
|
||||
os << "value is type " << Value_type_name[type()] << ", expected " << Value_type_name[vtype];
|
||||
|
||||
throw std::runtime_error( os.str() );
|
||||
|
||||
@@ -124,8 +124,11 @@ namespace json_spirit
|
||||
case str_type: output( value.get_str() ); break;
|
||||
case bool_type: output( value.get_bool() ); break;
|
||||
case int_type: output_int( value ); break;
|
||||
case real_type: os_ << std::showpoint << std::setprecision( 16 )
|
||||
|
||||
/// Bitcoin: Added std::fixed and changed precision from 16 to 8
|
||||
case real_type: os_ << std::showpoint << std::fixed << std::setprecision(8)
|
||||
<< value.get_real(); break;
|
||||
|
||||
case null_type: os_ << "null"; break;
|
||||
default: assert( false );
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
Copyright (c) 2009-2010 Bitcoin Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
Binary file not shown.
@@ -184,8 +184,8 @@ msgid "From: "
|
||||
msgstr "Von: "
|
||||
|
||||
#: ../../../ui.cpp:634
|
||||
msgid "From: unknown, Received with: "
|
||||
msgstr "Von: Unbekannt, Empfangen durch: "
|
||||
msgid "Received with: "
|
||||
msgstr "Empfangen durch: "
|
||||
|
||||
#: ../../../ui.cpp:676
|
||||
msgid "Payment to yourself"
|
||||
@@ -216,7 +216,7 @@ msgstr "&Neue Empfangs-Adresse"
|
||||
#: ../../../ui.cpp:1124
|
||||
#: ../../../ui.cpp:2352
|
||||
msgid ""
|
||||
"It's good policy to use a new address for each payment you receive.\n"
|
||||
"You should use a new address for each payment you receive.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
msgstr ""
|
||||
@@ -321,13 +321,21 @@ msgstr "Beim schließen &Minimieren"
|
||||
|
||||
#: ../../../ui.cpp:1595
|
||||
#, c-format
|
||||
msgid "version 0.%d.%d beta"
|
||||
msgstr "Version 0.%d.%d Beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "Version %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
msgstr "Wird als \"Von: Unbekannt\" erscheinen"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "n/a"
|
||||
msgstr "Unbekannt"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Unknown"
|
||||
msgstr "Unbekannt"
|
||||
|
||||
#: ../../../ui.cpp:1682
|
||||
msgid "Can't include a message when sending to a Bitcoin address"
|
||||
msgstr "Beim überweisen an eine Bitcoin-Adresse kann keine Nachricht angegeben werden."
|
||||
@@ -690,7 +698,7 @@ msgstr "Version"
|
||||
|
||||
#: ../../../uibase.cpp:563
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -701,7 +709,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Dies ist experimentelle Software.\n"
|
||||
"\n"
|
||||
|
||||
Binary file not shown.
@@ -210,8 +210,8 @@ msgid "From: "
|
||||
msgstr "De: "
|
||||
|
||||
#: ../../../ui.cpp:634
|
||||
msgid "From: unknown, Received with: "
|
||||
msgstr "De: desconocido, Recibido con: "
|
||||
msgid "Received with: "
|
||||
msgstr "Recibido con: "
|
||||
|
||||
#: ../../../ui.cpp:676
|
||||
msgid "Payment to yourself"
|
||||
@@ -242,7 +242,7 @@ msgstr "Nueva direccion de recepcion"
|
||||
#: ../../../ui.cpp:1129
|
||||
#: ../../../ui.cpp:2369
|
||||
msgid ""
|
||||
"It's good policy to use a new address for each payment you receive.\n"
|
||||
"You should use a new address for each payment you receive.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
msgstr ""
|
||||
@@ -350,13 +350,21 @@ msgstr "&Minimizar al cerrar"
|
||||
|
||||
#: ../../../ui.cpp:1610
|
||||
#, c-format
|
||||
msgid "version %d.%d.%d beta"
|
||||
msgstr "version %d.%d.%d beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "version %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1696
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
msgstr "Aparecera como \"De: Desconocido\""
|
||||
|
||||
#: ../../../ui.cpp:1696
|
||||
msgid "n/a"
|
||||
msgstr "Desconocido"
|
||||
|
||||
#: ../../../ui.cpp:1696
|
||||
msgid "Unknown"
|
||||
msgstr "Desconocido"
|
||||
|
||||
#: ../../../ui.cpp:1697
|
||||
msgid "Can't include a message when sending to a Bitcoin address"
|
||||
msgstr "No se ha podido incluir un mensaje mientras se enviaba la direccion Bitcoin"
|
||||
@@ -719,7 +727,7 @@ msgstr "version"
|
||||
|
||||
#: ../../../uibase.cpp:557
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -730,7 +738,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Este es un software experimental.\n"
|
||||
"\n"
|
||||
|
||||
Binary file not shown.
@@ -210,8 +210,8 @@ msgid "From: "
|
||||
msgstr "De: "
|
||||
|
||||
#: ../../../ui.cpp:634
|
||||
msgid "From: unknown, Received with: "
|
||||
msgstr "De: Inconnu, reçu depuis: "
|
||||
msgid "Received with: "
|
||||
msgstr "Reçu depuis: "
|
||||
|
||||
#: ../../../ui.cpp:676
|
||||
msgid "Payment to yourself"
|
||||
@@ -242,7 +242,7 @@ msgstr "Nouvelle adresse de reception"
|
||||
#: ../../../ui.cpp:1129
|
||||
#: ../../../ui.cpp:2369
|
||||
msgid ""
|
||||
"It's good policy to use a new address for each payment you receive.\n"
|
||||
"You should use a new address for each payment you receive.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
msgstr ""
|
||||
@@ -351,13 +351,21 @@ msgstr "&Réduire à la fermeture"
|
||||
|
||||
#: ../../../ui.cpp:1610
|
||||
#, c-format
|
||||
msgid "version %d.%d.%d beta"
|
||||
msgstr "version %d.%d.%d beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "version %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1696
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
msgstr "Apparaîtra ainsi \"De: Inconnu\""
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "n/a"
|
||||
msgstr "Inconnu"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Unknown"
|
||||
msgstr "Inconnu"
|
||||
|
||||
#: ../../../ui.cpp:1697
|
||||
msgid "Can't include a message when sending to a Bitcoin address"
|
||||
msgstr "Impossible d'inclure un message lors d'un envoi à une adresse Bitcoin"
|
||||
@@ -722,7 +730,7 @@ msgstr "version"
|
||||
|
||||
#: ../../../uibase.cpp:557
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -733,7 +741,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Ceci est un logiciel expérimental.\n"
|
||||
"\n"
|
||||
|
||||
Binary file not shown.
@@ -184,8 +184,8 @@ msgid "From: "
|
||||
msgstr "Da: "
|
||||
|
||||
#: ../../../ui.cpp:634
|
||||
msgid "From: unknown, Received with: "
|
||||
msgstr "Da: sconosciuto, Ricevuto con: "
|
||||
msgid "Received with: "
|
||||
msgstr "Ricevuto con: "
|
||||
|
||||
#: ../../../ui.cpp:676
|
||||
msgid "Payment to yourself"
|
||||
@@ -216,7 +216,7 @@ msgstr "Nuovo indirizzo ricevente"
|
||||
#: ../../../ui.cpp:1124
|
||||
#: ../../../ui.cpp:2352
|
||||
msgid ""
|
||||
"It's good policy to use a new address for each payment you receive.\n"
|
||||
"You should use a new address for each payment you receive.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
msgstr ""
|
||||
@@ -319,13 +319,21 @@ msgstr "&Minimizza se chiuso"
|
||||
|
||||
#: ../../../ui.cpp:1595
|
||||
#, c-format
|
||||
msgid "version 0.%d.%d beta"
|
||||
msgstr "versione 0.%d.%d beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "versione %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
msgstr "Apparirà come \"Da: Sconosciuto\""
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "n/a"
|
||||
msgstr "Sconosciuto"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Unknown"
|
||||
msgstr "Sconosciuto"
|
||||
|
||||
#: ../../../ui.cpp:1682
|
||||
msgid "Can't include a message when sending to a Bitcoin address"
|
||||
msgstr "Non si può includere un messaggio quando si invia attraverso l'indirizzo Bitcoin"
|
||||
@@ -688,7 +696,7 @@ msgstr "versione"
|
||||
|
||||
#: ../../../uibase.cpp:563
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -699,7 +707,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Questo è un software sperimentale.\n"
|
||||
"\n"
|
||||
|
||||
Binary file not shown.
@@ -184,8 +184,8 @@ msgid "From: "
|
||||
msgstr "Van: "
|
||||
|
||||
#: ../../../ui.cpp:634
|
||||
msgid "From: unknown, Received with: "
|
||||
msgstr "Van: onbekend, Ontvangen met: "
|
||||
msgid "Received with: "
|
||||
msgstr "Ontvangen met: "
|
||||
|
||||
#: ../../../ui.cpp:676
|
||||
msgid "Payment to yourself"
|
||||
@@ -216,7 +216,7 @@ msgstr "Nieuw Ontvangings Adres"
|
||||
#: ../../../ui.cpp:1124
|
||||
#: ../../../ui.cpp:2352
|
||||
msgid ""
|
||||
"It's good policy to use a new address for each payment you receive.\n"
|
||||
"You should use a new address for each payment you receive.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
msgstr ""
|
||||
@@ -320,13 +320,21 @@ msgstr "&Minimalizeer bij sluiten"
|
||||
|
||||
#: ../../../ui.cpp:1595
|
||||
#, c-format
|
||||
msgid "version 0.%d.%d beta"
|
||||
msgstr "versie 0.%d.%d beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "versie %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
msgstr "Word vertoont als \"Van: Onbekend\""
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "n/a"
|
||||
msgstr "Onbekend"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Unknown"
|
||||
msgstr "Onbekend"
|
||||
|
||||
#: ../../../ui.cpp:1682
|
||||
msgid "Can't include a message when sending to a Bitcoin address"
|
||||
msgstr "Kan geen mededeling versturen bij gebruik van Bitcoin adressen"
|
||||
@@ -689,7 +697,7 @@ msgstr "versie"
|
||||
|
||||
#: ../../../uibase.cpp:563
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -700,7 +708,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Dit is experimentele software.\n"
|
||||
"\n"
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
put bitcoin.po and bitcoin.mo files at:
|
||||
locale/<langcode>/LC_MESSAGES/bitcoin.mo and .po
|
||||
|
||||
.po is the sourcefile
|
||||
.mo is the compiled translation
|
||||
put bitcoin.po and bitcoin.mo files at:
|
||||
locale/<langcode>/LC_MESSAGES/bitcoin.mo and .po
|
||||
|
||||
.po is the sourcefile
|
||||
.mo is the compiled translation
|
||||
|
||||
BIN
locale/ru/LC_MESSAGES/bitcoin.mo
Normal file
BIN
locale/ru/LC_MESSAGES/bitcoin.mo
Normal file
Binary file not shown.
895
locale/ru/LC_MESSAGES/bitcoin.po
Normal file
895
locale/ru/LC_MESSAGES/bitcoin.po
Normal file
@@ -0,0 +1,895 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2010-10-05 10:53+0300\n"
|
||||
"PO-Revision-Date: 2010-10-05 11:43+0300\n"
|
||||
"Last-Translator: eurekafag\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-SearchPath-0: ../../..\n"
|
||||
|
||||
#: ../../../init.cpp:162
|
||||
msgid "Usage:"
|
||||
msgstr "Использование"
|
||||
|
||||
#: ../../../init.cpp:164
|
||||
msgid "Send command to -server or bitcoind\n"
|
||||
msgstr "Отправить команду bitcoin, запущенному с -server\n"
|
||||
|
||||
#: ../../../init.cpp:165
|
||||
msgid "List commands\n"
|
||||
msgstr "Список команд\n"
|
||||
|
||||
#: ../../../init.cpp:166
|
||||
msgid "Get help for a command\n"
|
||||
msgstr "Получить помощь для команды\n"
|
||||
|
||||
#: ../../../init.cpp:167
|
||||
msgid "Options:\n"
|
||||
msgstr "Параметры:\n"
|
||||
|
||||
#: ../../../init.cpp:168
|
||||
msgid "Specify configuration file (default: bitcoin.conf)\n"
|
||||
msgstr "Укажите конфигурационный файл (по умолчанию: bitcoin.conf)\n"
|
||||
|
||||
#: ../../../init.cpp:169
|
||||
msgid "Generate coins\n"
|
||||
msgstr "Генерировать монеты\n"
|
||||
|
||||
#: ../../../init.cpp:170
|
||||
msgid "Don't generate coins\n"
|
||||
msgstr "Не генерировать монеты\n"
|
||||
|
||||
#: ../../../init.cpp:171
|
||||
msgid "Start minimized\n"
|
||||
msgstr "Запускать свёрнутым\n"
|
||||
|
||||
#: ../../../init.cpp:172
|
||||
msgid "Specify data directory\n"
|
||||
msgstr "Указать каталог данных\n"
|
||||
|
||||
#: ../../../init.cpp:173
|
||||
msgid "Connect through socks4 proxy\n"
|
||||
msgstr "Подключаться через socks4 прокси\n"
|
||||
|
||||
#: ../../../init.cpp:174
|
||||
msgid "Add a node to connect to\n"
|
||||
msgstr "Добавить узел для подключения\n"
|
||||
|
||||
#: ../../../init.cpp:175
|
||||
msgid "Connect only to the specified node\n"
|
||||
msgstr "Подключаться только к указанному узлу\n"
|
||||
|
||||
#: ../../../init.cpp:176
|
||||
msgid "Accept command line and JSON-RPC commands\n"
|
||||
msgstr "Принимать команды из командной строки и через JSON-RPC\n"
|
||||
|
||||
#: ../../../init.cpp:177
|
||||
msgid "Run in the background as a daemon and accept commands\n"
|
||||
msgstr "Запустить в фоне как демон и принимать команды\n"
|
||||
|
||||
#: ../../../init.cpp:178
|
||||
msgid "This help message\n"
|
||||
msgstr "Эта справка\n"
|
||||
|
||||
#: ../../../init.cpp:284
|
||||
msgid "Error loading addr.dat \n"
|
||||
msgstr "Ошибка загрузки addr.dat \n"
|
||||
|
||||
#: ../../../init.cpp:290
|
||||
msgid "Error loading blkindex.dat \n"
|
||||
msgstr "Ошибка загрузки blkindex.dat \n"
|
||||
|
||||
#: ../../../init.cpp:297
|
||||
msgid "Error loading wallet.dat \n"
|
||||
msgstr "Ошибка загрузки wallet.dat \n"
|
||||
|
||||
#: ../../../init.cpp:365
|
||||
msgid "Invalid -proxy address"
|
||||
msgstr "Неверный адрес -proxy"
|
||||
|
||||
#: ../../../init.cpp:385
|
||||
msgid "Invalid amount for -paytxfee=<amount>"
|
||||
msgstr "Неверное значение для -paytxfee=<amount>"
|
||||
|
||||
#: ../../../init.cpp:389
|
||||
msgid "Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction."
|
||||
msgstr "Внимание: -paytxfee установлено в очень большое значение. Это комиссия, которую вы будете платить при переводе."
|
||||
|
||||
#: ../../../main.cpp:1641
|
||||
msgid "Warning: Disk space is low "
|
||||
msgstr "Внимание: мало места на диске "
|
||||
|
||||
#: ../../../main.cpp:3505
|
||||
#, c-format
|
||||
msgid "Error: This is an oversized transaction that requires a transaction fee of %s "
|
||||
msgstr "Ошибка: этот перевод слишком большого размера, который требует комиссию %s "
|
||||
|
||||
#: ../../../main.cpp:3507
|
||||
msgid "Error: Transaction creation failed "
|
||||
msgstr "Ошибка: не удалось создать перевод "
|
||||
|
||||
#: ../../../main.cpp:3512
|
||||
#: ../../../ui.cpp:1964
|
||||
#: ../../../ui.cpp:1966
|
||||
#: ../../../ui.cpp:2107
|
||||
#: ../../../ui.cpp:2260
|
||||
msgid "Sending..."
|
||||
msgstr "Отправка..."
|
||||
|
||||
#: ../../../main.cpp:3516
|
||||
msgid "Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."
|
||||
msgstr "Перевод был отклонен. Это могло произойти, если некоторые из монет в вашем кошельке уже были потрачены, например, если вы использовали копию wallet.dat, и монеты были потрачены в копии, но не отмечены израсходованными здесь."
|
||||
|
||||
#: ../../../main.cpp:3528
|
||||
msgid "Invalid amount"
|
||||
msgstr "Неверное количество"
|
||||
|
||||
#: ../../../main.cpp:3530
|
||||
#: ../../../ui.cpp:2174
|
||||
#: ../../../ui.cpp:2245
|
||||
msgid "Insufficient funds"
|
||||
msgstr "Недостаточно средств"
|
||||
|
||||
#: ../../../main.cpp:3535
|
||||
msgid "Invalid bitcoin address"
|
||||
msgstr "Неверный адрес bitcoin"
|
||||
|
||||
#: ../../../rpc.cpp:963
|
||||
#: ../../../rpc.cpp:965
|
||||
#, c-format
|
||||
msgid "To use the %s option"
|
||||
msgstr "Чтобы использовать опцию %s"
|
||||
|
||||
#: ../../../rpc.cpp:967
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Warning: %s, you must set rpcpassword=<password>\n"
|
||||
"in the configuration file: %s\n"
|
||||
"If the file does not exist, create it with owner-readable-only file permissions.\n"
|
||||
msgstr ""
|
||||
"Внимание: %s, вы должны установить rpcpassword=<пароль>\n"
|
||||
"в конфигурационном файле: %s\n"
|
||||
"Если файл не существует, создайте его с правами \"чтение только владельцем\".\n"
|
||||
|
||||
#: ../../../rpc.cpp:1100
|
||||
#, c-format
|
||||
msgid ""
|
||||
"You must set rpcpassword=<password> in the configuration file:\n"
|
||||
"%s\n"
|
||||
"If the file does not exist, create it with owner-readable-only file permissions."
|
||||
msgstr ""
|
||||
"Вы должны установить rpcpassword=<пароль> в конфигурационном файле:\n"
|
||||
"%s\n"
|
||||
"Если файл не существует, создайте его с правами \"чтение только владельцем\"."
|
||||
|
||||
#: ../../../ui.cpp:202
|
||||
#, c-format
|
||||
msgid "This transaction is over the size limit. You can still send it for a fee of %s, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?"
|
||||
msgstr "Этот перевод превышает допустимый лимит. Вы можете провести его с комиссией %s, которую получат узлы, обрабатывающие перевод, и поможет поддерживать сеть. Вы хотите заплатить комиссию?"
|
||||
|
||||
#: ../../../ui.cpp:301
|
||||
msgid "Status"
|
||||
msgstr "Статус"
|
||||
|
||||
#: ../../../ui.cpp:302
|
||||
msgid "Date"
|
||||
msgstr "Дата"
|
||||
|
||||
#: ../../../ui.cpp:303
|
||||
msgid "Description"
|
||||
msgstr "Описание"
|
||||
|
||||
#: ../../../ui.cpp:304
|
||||
msgid "Debit"
|
||||
msgstr "Дебет"
|
||||
|
||||
#: ../../../ui.cpp:305
|
||||
msgid "Credit"
|
||||
msgstr "Кредит"
|
||||
|
||||
#: ../../../ui.cpp:511
|
||||
#, c-format
|
||||
msgid "Open for %d blocks"
|
||||
msgstr "Открыто для %d блоков"
|
||||
|
||||
#: ../../../ui.cpp:513
|
||||
#, c-format
|
||||
msgid "Open until %s"
|
||||
msgstr "Открыто до %s"
|
||||
|
||||
#: ../../../ui.cpp:519
|
||||
#, c-format
|
||||
msgid "%d/offline?"
|
||||
msgstr "%d/оффлайн?"
|
||||
|
||||
#: ../../../ui.cpp:521
|
||||
#, c-format
|
||||
msgid "%d/unconfirmed"
|
||||
msgstr "%d/не подтверждено"
|
||||
|
||||
#: ../../../ui.cpp:523
|
||||
#, c-format
|
||||
msgid "%d confirmations"
|
||||
msgstr "%d подтверждений"
|
||||
|
||||
#: ../../../ui.cpp:608
|
||||
msgid "Generated"
|
||||
msgstr "Сгенерировано"
|
||||
|
||||
#: ../../../ui.cpp:616
|
||||
#, c-format
|
||||
msgid "Generated (%s matures in %d more blocks)"
|
||||
msgstr "Сгенерировано (%s станет доступно через %d блоков)"
|
||||
|
||||
#: ../../../ui.cpp:620
|
||||
msgid "Generated - Warning: This block was not received by any other nodes and will probably not be accepted!"
|
||||
msgstr "Сгенерировано - Внимание: этот блок не был получен ни одним узлом и, скорее всего, не будет принят!"
|
||||
|
||||
#: ../../../ui.cpp:624
|
||||
msgid "Generated (not accepted)"
|
||||
msgstr "Сгенерировано (не принято)"
|
||||
|
||||
#: ../../../ui.cpp:634
|
||||
msgid "From: "
|
||||
msgstr "От: "
|
||||
|
||||
#: ../../../ui.cpp:658
|
||||
msgid "Received with: "
|
||||
msgstr "Получено для: "
|
||||
|
||||
#: ../../../ui.cpp:704
|
||||
msgid "Payment to yourself"
|
||||
msgstr "Платёж самому себе"
|
||||
|
||||
#: ../../../ui.cpp:741
|
||||
msgid "To: "
|
||||
msgstr "Кому: "
|
||||
|
||||
#: ../../../ui.cpp:1049
|
||||
msgid " Generating"
|
||||
msgstr " Генерация"
|
||||
|
||||
#: ../../../ui.cpp:1051
|
||||
msgid "(not connected)"
|
||||
msgstr "(не подключен)"
|
||||
|
||||
#: ../../../ui.cpp:1054
|
||||
#, c-format
|
||||
msgid " %d connections %d blocks %d transactions"
|
||||
msgstr " %d подключений %d блоков %d переводов"
|
||||
|
||||
#: ../../../ui.cpp:1165
|
||||
#: ../../../ui.cpp:2560
|
||||
msgid "New Receiving Address"
|
||||
msgstr "Новый адрес получения"
|
||||
|
||||
#: ../../../ui.cpp:1166
|
||||
#: ../../../ui.cpp:2561
|
||||
msgid ""
|
||||
"You should use a new address for each payment you receive.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
msgstr ""
|
||||
"Вы должны использовать новый адрес для каждого получаемого платежа.\n"
|
||||
"\n"
|
||||
"Метка"
|
||||
|
||||
#: ../../../ui.cpp:1235
|
||||
msgid "<b>Status:</b> "
|
||||
msgstr "<b>Статус:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1240
|
||||
msgid ", has not been successfully broadcast yet"
|
||||
msgstr ", ещё не был успешно разослан"
|
||||
|
||||
#: ../../../ui.cpp:1242
|
||||
#, c-format
|
||||
msgid ", broadcast through %d node"
|
||||
msgstr ", рассылка через %d узел"
|
||||
|
||||
#: ../../../ui.cpp:1244
|
||||
#, c-format
|
||||
msgid ", broadcast through %d nodes"
|
||||
msgstr ", рассылка через %d узлов"
|
||||
|
||||
#: ../../../ui.cpp:1248
|
||||
msgid "<b>Date:</b> "
|
||||
msgstr "<b>Дата:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1256
|
||||
msgid "<b>Source:</b> Generated<br>"
|
||||
msgstr "<b>Источник:</b> Сгенерировано<br>"
|
||||
|
||||
#: ../../../ui.cpp:1262
|
||||
#: ../../../ui.cpp:1280
|
||||
msgid "<b>From:</b> "
|
||||
msgstr "<b>От:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1280
|
||||
msgid "unknown"
|
||||
msgstr "аноним"
|
||||
|
||||
#: ../../../ui.cpp:1281
|
||||
#: ../../../ui.cpp:1305
|
||||
#: ../../../ui.cpp:1364
|
||||
msgid "<b>To:</b> "
|
||||
msgstr "<b>Кому:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1284
|
||||
msgid " (yours, label: "
|
||||
msgstr " (ваш, метка: "
|
||||
|
||||
#: ../../../ui.cpp:1286
|
||||
msgid " (yours)"
|
||||
msgstr " (ваш)"
|
||||
|
||||
#: ../../../ui.cpp:1323
|
||||
#: ../../../ui.cpp:1335
|
||||
#: ../../../ui.cpp:1398
|
||||
msgid "<b>Credit:</b> "
|
||||
msgstr "<b>Кредит:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1325
|
||||
#, c-format
|
||||
msgid "(%s matures in %d more blocks)"
|
||||
msgstr "(%s станет доступно через %d блоков)"
|
||||
|
||||
#: ../../../ui.cpp:1327
|
||||
msgid "(not accepted)"
|
||||
msgstr "(не принято)"
|
||||
|
||||
#: ../../../ui.cpp:1372
|
||||
#: ../../../ui.cpp:1395
|
||||
msgid "<b>Debit:</b> "
|
||||
msgstr "<b>Дебет:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1386
|
||||
msgid "<b>Transaction fee:</b> "
|
||||
msgstr "<b>Комиссия:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1402
|
||||
msgid "<b>Net amount:</b> "
|
||||
msgstr "<b>Количество сети:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1409
|
||||
msgid "Message:"
|
||||
msgstr "Сообщение:"
|
||||
|
||||
#: ../../../ui.cpp:1412
|
||||
msgid "Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours."
|
||||
msgstr "Сгенерированные монеты должны ждать 120 блоков, прежде чем они могут быть потрачены. Когда вы сгенерировали этот блок, он был разослан в сети для добавления в цепь блоков. Если не удалось добавить этот блок в цепь, он будет обозначен как \"не принятый\" и не может быть потрачен. Такое может случиться, если другой узел сгенерировал блок через несколько секунд после вас."
|
||||
|
||||
#: ../../../ui.cpp:1593
|
||||
msgid "Cannot write autostart/bitcoin.desktop file"
|
||||
msgstr "Не удаётся записать файл autostart/bitcoin.desktop"
|
||||
|
||||
#: ../../../ui.cpp:1629
|
||||
msgid "Main"
|
||||
msgstr "Основные"
|
||||
|
||||
#: ../../../ui.cpp:1634
|
||||
msgid "&Start Bitcoin on window system startup"
|
||||
msgstr "&Запускать Bitcoin при запуске оконной системы"
|
||||
|
||||
#: ../../../ui.cpp:1641
|
||||
msgid "&Minimize on close"
|
||||
msgstr "&Сворачивать при закрытии"
|
||||
|
||||
#: ../../../ui.cpp:1798
|
||||
#, c-format
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "версия %s%s бета"
|
||||
|
||||
#: ../../../ui.cpp:1884
|
||||
msgid "n/a"
|
||||
msgstr "н/д"
|
||||
|
||||
#: ../../../ui.cpp:1885
|
||||
msgid "Can't include a message when sending to a Bitcoin address"
|
||||
msgstr "Не удаётся включить сообщение при отправке на адрес Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:1938
|
||||
msgid "Error in amount "
|
||||
msgstr "Ошибка в количестве "
|
||||
|
||||
#: ../../../ui.cpp:1938
|
||||
#: ../../../ui.cpp:1943
|
||||
#: ../../../ui.cpp:1948
|
||||
#: ../../../ui.cpp:1974
|
||||
#: ../../../uibase.cpp:59
|
||||
msgid "Send Coins"
|
||||
msgstr "Отправить монеты"
|
||||
|
||||
#: ../../../ui.cpp:1943
|
||||
msgid "Amount exceeds your balance "
|
||||
msgstr "Количество превышает ваш баланс "
|
||||
|
||||
#: ../../../ui.cpp:1948
|
||||
msgid "Total exceeds your balance when the "
|
||||
msgstr "Общая сумма превышает ваш баланс, когда "
|
||||
|
||||
#: ../../../ui.cpp:1948
|
||||
msgid " transaction fee is included "
|
||||
msgstr " комиссия включена "
|
||||
|
||||
#: ../../../ui.cpp:1964
|
||||
msgid "Payment sent "
|
||||
msgstr "Платёж отправлен "
|
||||
|
||||
#: ../../../ui.cpp:1974
|
||||
msgid "Invalid address "
|
||||
msgstr "Неверный адрес "
|
||||
|
||||
#: ../../../ui.cpp:2028
|
||||
#, c-format
|
||||
msgid "Sending %s to %s"
|
||||
msgstr "Отправка %s для %s"
|
||||
|
||||
#: ../../../ui.cpp:2101
|
||||
#: ../../../ui.cpp:2134
|
||||
msgid "CANCELLED"
|
||||
msgstr "ОТМЕНЕНО"
|
||||
|
||||
#: ../../../ui.cpp:2105
|
||||
msgid "Cancelled"
|
||||
msgstr "Отменено"
|
||||
|
||||
#: ../../../ui.cpp:2107
|
||||
msgid "Transfer cancelled "
|
||||
msgstr "Передача отменена "
|
||||
|
||||
#: ../../../ui.cpp:2160
|
||||
msgid "Error: "
|
||||
msgstr "Ошибка: "
|
||||
|
||||
#: ../../../ui.cpp:2179
|
||||
msgid "Connecting..."
|
||||
msgstr "Подключение..."
|
||||
|
||||
#: ../../../ui.cpp:2184
|
||||
msgid "Unable to connect"
|
||||
msgstr "Невозможно подключиться"
|
||||
|
||||
#: ../../../ui.cpp:2189
|
||||
msgid "Requesting public key..."
|
||||
msgstr "Запрос публичного ключа..."
|
||||
|
||||
#: ../../../ui.cpp:2201
|
||||
msgid "Received public key..."
|
||||
msgstr "Получен публичный ключ..."
|
||||
|
||||
#: ../../../ui.cpp:2215
|
||||
msgid "Recipient is not accepting transactions sent by IP address"
|
||||
msgstr "Получатель не принимает переводы на IP-адрес"
|
||||
|
||||
#: ../../../ui.cpp:2217
|
||||
msgid "Transfer was not accepted"
|
||||
msgstr "Передача не принята"
|
||||
|
||||
#: ../../../ui.cpp:2226
|
||||
msgid "Invalid response received"
|
||||
msgstr "Получен неверный отклик"
|
||||
|
||||
#: ../../../ui.cpp:2241
|
||||
msgid "Creating transaction..."
|
||||
msgstr "Создание перевода..."
|
||||
|
||||
#: ../../../ui.cpp:2253
|
||||
#, c-format
|
||||
msgid "This is an oversized transaction that requires a transaction fee of %s"
|
||||
msgstr "Это слишком большой перевод, который требует комиссию в размере %s"
|
||||
|
||||
#: ../../../ui.cpp:2255
|
||||
msgid "Transaction creation failed"
|
||||
msgstr "Не удалось создать перевод"
|
||||
|
||||
#: ../../../ui.cpp:2262
|
||||
msgid "Transaction aborted"
|
||||
msgstr "Перевод прерван"
|
||||
|
||||
#: ../../../ui.cpp:2270
|
||||
msgid "Lost connection, transaction cancelled"
|
||||
msgstr "Соединение разорвано, перевод отменён"
|
||||
|
||||
#: ../../../ui.cpp:2286
|
||||
msgid "Sending payment..."
|
||||
msgstr "Отправка платежа..."
|
||||
|
||||
#: ../../../ui.cpp:2292
|
||||
msgid "The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."
|
||||
msgstr "Перевод был отклонён. Это могло произойти, если некоторые из монет в вашем кошельке уже были потрачены, например, если вы использовали копию wallet.dat, и монеты были потрачены в копии, но не отмечены израсходованными здесь."
|
||||
|
||||
#: ../../../ui.cpp:2301
|
||||
msgid "Waiting for confirmation..."
|
||||
msgstr "Ожидание подтверждения..."
|
||||
|
||||
#: ../../../ui.cpp:2319
|
||||
msgid ""
|
||||
"The payment was sent, but the recipient was unable to verify it.\n"
|
||||
"The transaction is recorded and will credit to the recipient,\n"
|
||||
"but the comment information will be blank."
|
||||
msgstr ""
|
||||
"Платёж был отправлен, но получатель не смог проверить его.\n"
|
||||
"Перевод был записан и будет начислен получателю,\n"
|
||||
"но поле комментария будет пустое."
|
||||
|
||||
#: ../../../ui.cpp:2328
|
||||
msgid "Payment was sent, but an invalid response was received"
|
||||
msgstr "Платёж отправлен, но был получен неверный отклик"
|
||||
|
||||
#: ../../../ui.cpp:2334
|
||||
msgid "Payment completed"
|
||||
msgstr "Платёж проведён"
|
||||
|
||||
#: ../../../ui.cpp:2365
|
||||
#: ../../../ui.cpp:2511
|
||||
#: ../../../ui.cpp:2548
|
||||
msgid "Name"
|
||||
msgstr "Имя"
|
||||
|
||||
#: ../../../ui.cpp:2366
|
||||
#: ../../../ui.cpp:2511
|
||||
#: ../../../ui.cpp:2548
|
||||
msgid "Address"
|
||||
msgstr "Адрес"
|
||||
|
||||
#: ../../../ui.cpp:2368
|
||||
#: ../../../ui.cpp:2523
|
||||
msgid "Label"
|
||||
msgstr "Метка"
|
||||
|
||||
#: ../../../ui.cpp:2369
|
||||
#: ../../../uibase.cpp:902
|
||||
msgid "Bitcoin Address"
|
||||
msgstr "Адрес Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2493
|
||||
msgid "This is one of your own addresses for receiving payments and cannot be entered in the address book. "
|
||||
msgstr "Это один из ваших собственных адресов для получения платежей, он не может быть внесён в адресную книгу. "
|
||||
|
||||
#: ../../../ui.cpp:2511
|
||||
#: ../../../ui.cpp:2517
|
||||
msgid "Edit Address"
|
||||
msgstr "Правка адреса"
|
||||
|
||||
#: ../../../ui.cpp:2523
|
||||
msgid "Edit Address Label"
|
||||
msgstr "Правка метки адреса"
|
||||
|
||||
#: ../../../ui.cpp:2548
|
||||
#: ../../../ui.cpp:2554
|
||||
msgid "Add Address"
|
||||
msgstr "Добавить адрес"
|
||||
|
||||
#: ../../../ui.cpp:2630
|
||||
msgid "Bitcoin"
|
||||
msgstr "Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2632
|
||||
msgid "Bitcoin - Generating"
|
||||
msgstr "Bitcoin - Генерация"
|
||||
|
||||
#: ../../../ui.cpp:2634
|
||||
msgid "Bitcoin - (not connected)"
|
||||
msgstr "Bitcoin - (не подключен)"
|
||||
|
||||
#: ../../../ui.cpp:2711
|
||||
msgid "&Open Bitcoin"
|
||||
msgstr "&Открыть Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2712
|
||||
msgid "O&ptions..."
|
||||
msgstr "О&пции..."
|
||||
|
||||
#: ../../../ui.cpp:2713
|
||||
#: ../../../uibase.cpp:32
|
||||
msgid "&Generate Coins"
|
||||
msgstr "&Генерировать монеты"
|
||||
|
||||
#: ../../../ui.cpp:2716
|
||||
#: ../../../uibase.cpp:25
|
||||
msgid "E&xit"
|
||||
msgstr "&Выход"
|
||||
|
||||
#: ../../../ui.cpp:2931
|
||||
msgid "Program has crashed and will terminate. "
|
||||
msgstr "Сбой программы, завершение. "
|
||||
|
||||
#: ../../../uibase.cpp:28
|
||||
msgid "&File"
|
||||
msgstr "&Файл"
|
||||
|
||||
#: ../../../uibase.cpp:36
|
||||
msgid "&Your Receiving Addresses..."
|
||||
msgstr "&Ваши адреса получения..."
|
||||
|
||||
#: ../../../uibase.cpp:40
|
||||
msgid "&Options..."
|
||||
msgstr "&Опции"
|
||||
|
||||
#: ../../../uibase.cpp:43
|
||||
msgid "&Settings"
|
||||
msgstr "&Настройки"
|
||||
|
||||
#: ../../../uibase.cpp:47
|
||||
msgid "&About..."
|
||||
msgstr "&О программе..."
|
||||
|
||||
#: ../../../uibase.cpp:50
|
||||
msgid "&Help"
|
||||
msgstr "&Справка"
|
||||
|
||||
#: ../../../uibase.cpp:60
|
||||
msgid "Address Book"
|
||||
msgstr "Адресная книга"
|
||||
|
||||
#: ../../../uibase.cpp:75
|
||||
msgid "Your Bitcoin Address:"
|
||||
msgstr "Ваш адрес Bitcoin:"
|
||||
|
||||
#: ../../../uibase.cpp:82
|
||||
msgid " &New... "
|
||||
msgstr " &Новый... "
|
||||
|
||||
#: ../../../uibase.cpp:85
|
||||
#: ../../../uibase.cpp:845
|
||||
#: ../../../uibase.cpp:948
|
||||
msgid " &Copy to Clipboard "
|
||||
msgstr " &Копировать в буфер обмена "
|
||||
|
||||
#: ../../../uibase.cpp:99
|
||||
msgid "Balance:"
|
||||
msgstr "Баланс:"
|
||||
|
||||
#: ../../../uibase.cpp:115
|
||||
msgid " All"
|
||||
msgstr " Все"
|
||||
|
||||
#: ../../../uibase.cpp:115
|
||||
msgid " Sent"
|
||||
msgstr " Отправленные"
|
||||
|
||||
#: ../../../uibase.cpp:115
|
||||
msgid " Received"
|
||||
msgstr " Полученные"
|
||||
|
||||
#: ../../../uibase.cpp:115
|
||||
msgid " In Progress"
|
||||
msgstr " В процессе"
|
||||
|
||||
#: ../../../uibase.cpp:136
|
||||
msgid "All Transactions"
|
||||
msgstr "Все переводы"
|
||||
|
||||
#: ../../../uibase.cpp:147
|
||||
msgid "Sent/Received"
|
||||
msgstr "Отправленные/Полученные"
|
||||
|
||||
#: ../../../uibase.cpp:158
|
||||
msgid "Sent"
|
||||
msgstr "Отправленные"
|
||||
|
||||
#: ../../../uibase.cpp:169
|
||||
msgid "Received"
|
||||
msgstr "Полученные"
|
||||
|
||||
#: ../../../uibase.cpp:312
|
||||
#: ../../../uibase.cpp:473
|
||||
#: ../../../uibase.cpp:574
|
||||
#: ../../../uibase.cpp:787
|
||||
#: ../../../uibase.cpp:848
|
||||
#: ../../../uibase.cpp:957
|
||||
#: ../../../uibase.cpp:1046
|
||||
msgid "OK"
|
||||
msgstr "ОК"
|
||||
|
||||
#: ../../../uibase.cpp:355
|
||||
msgid "Optional transaction fee you give to the nodes that process your transactions."
|
||||
msgstr "Необязательная комиссия, которую вы даёте узлам, проводящим ваш перевод."
|
||||
|
||||
#: ../../../uibase.cpp:364
|
||||
msgid "Transaction fee:"
|
||||
msgstr "Комиссия:"
|
||||
|
||||
#: ../../../uibase.cpp:380
|
||||
msgid "&Limit coin generation to"
|
||||
msgstr "&Ограничить генерацию монет до"
|
||||
|
||||
#: ../../../uibase.cpp:387
|
||||
msgid "processors"
|
||||
msgstr "процессоров"
|
||||
|
||||
#: ../../../uibase.cpp:393
|
||||
msgid "&Start Bitcoin on system startup"
|
||||
msgstr "&Запускать Bitcoin при старте системы"
|
||||
|
||||
#: ../../../uibase.cpp:397
|
||||
msgid "&Minimize to the tray instead of the taskbar"
|
||||
msgstr "&Сворачивать в трей вместо панели задач"
|
||||
|
||||
#: ../../../uibase.cpp:401
|
||||
msgid "M&inimize to the tray on close"
|
||||
msgstr "С&ворачивать в трей при закрытии"
|
||||
|
||||
#: ../../../uibase.cpp:408
|
||||
msgid "&Connect through socks4 proxy: "
|
||||
msgstr "&Подключаться через socks4 прокси: "
|
||||
|
||||
#: ../../../uibase.cpp:420
|
||||
msgid "Proxy &IP:"
|
||||
msgstr "IP п&рокси:"
|
||||
|
||||
#: ../../../uibase.cpp:428
|
||||
msgid " &Port:"
|
||||
msgstr " &Порт"
|
||||
|
||||
#: ../../../uibase.cpp:450
|
||||
msgid "// [don't translate] Test panel 2 for future expansion"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../uibase.cpp:454
|
||||
msgid "// [don't translate] Let's not start multiple pages until the first page is filled up"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../uibase.cpp:476
|
||||
#: ../../../uibase.cpp:729
|
||||
#: ../../../uibase.cpp:792
|
||||
#: ../../../uibase.cpp:851
|
||||
#: ../../../uibase.cpp:960
|
||||
#: ../../../uibase.cpp:1049
|
||||
msgid "Cancel"
|
||||
msgstr "Отмена"
|
||||
|
||||
#: ../../../uibase.cpp:479
|
||||
msgid "&Apply"
|
||||
msgstr "&Применить"
|
||||
|
||||
#: ../../../uibase.cpp:540
|
||||
msgid "Bitcoin "
|
||||
msgstr "Bitcoin "
|
||||
|
||||
#: ../../../uibase.cpp:546
|
||||
msgid "version"
|
||||
msgstr "версия"
|
||||
|
||||
#: ../../../uibase.cpp:557
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
"Distributed under the MIT/X11 software license, see the accompanying file \n"
|
||||
"license.txt or http://www.opensource.org/licenses/mit-license.php.\n"
|
||||
"\n"
|
||||
"This product includes software developed by the OpenSSL Project for use in the \n"
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Все права защищены (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Это экспериментальное ПО.\n"
|
||||
"\n"
|
||||
"Распространяется под лицензией MIT/X11, см. файл\n"
|
||||
"license.txt или http://www.opensource.org/licenses/mit-license.php.\n"
|
||||
"\n"
|
||||
"Этот продукт включает ПО, разработанное проектом OpenSSL для использования в\n"
|
||||
"OpenSSL Toolkit (http://www.openssl.org/), и криптографическое ПО, написанное\n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
|
||||
#: ../../../uibase.cpp:613
|
||||
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"
|
||||
msgstr "Введите адрес Bitcoin (напр. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) или IP адрес (напр. 123.45.6.7)"
|
||||
|
||||
#: ../../../uibase.cpp:627
|
||||
msgid "Pay &To:"
|
||||
msgstr "&Кому:"
|
||||
|
||||
#: ../../../uibase.cpp:642
|
||||
msgid "&Paste"
|
||||
msgstr "&Вставить"
|
||||
|
||||
#: ../../../uibase.cpp:645
|
||||
msgid " Address &Book..."
|
||||
msgstr " А&дресная книга..."
|
||||
|
||||
#: ../../../uibase.cpp:652
|
||||
msgid "&Amount:"
|
||||
msgstr "К&оличество:"
|
||||
|
||||
#: ../../../uibase.cpp:662
|
||||
msgid "T&ransfer:"
|
||||
msgstr "&Передача:"
|
||||
|
||||
#: ../../../uibase.cpp:668
|
||||
msgid " Standard"
|
||||
msgstr " Стандарт"
|
||||
|
||||
#: ../../../uibase.cpp:690
|
||||
msgid "&From:"
|
||||
msgstr "О&т:"
|
||||
|
||||
#: ../../../uibase.cpp:707
|
||||
msgid "&Message:"
|
||||
msgstr "&Сообщение:"
|
||||
|
||||
#: ../../../uibase.cpp:724
|
||||
msgid "&Send"
|
||||
msgstr "Отп&равить"
|
||||
|
||||
#: ../../../uibase.cpp:776
|
||||
msgid ""
|
||||
"\n"
|
||||
"\n"
|
||||
"Connecting..."
|
||||
msgstr ""
|
||||
"\n"
|
||||
"\n"
|
||||
"Подключение..."
|
||||
|
||||
#: ../../../uibase.cpp:826
|
||||
msgid "These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you. The highlighted address is displayed in the main window."
|
||||
msgstr "Это ваши адреса для получения платежей. Вы можете использовать разные для каждого отправителя, чтобы отслеживать, кто вам платит. Выделенный адрес отображается в главном окне."
|
||||
|
||||
#: ../../../uibase.cpp:839
|
||||
#: ../../../uibase.cpp:951
|
||||
msgid "&Edit..."
|
||||
msgstr "&Правка..."
|
||||
|
||||
#: ../../../uibase.cpp:842
|
||||
#: ../../../uibase.cpp:954
|
||||
msgid " &New Address... "
|
||||
msgstr " &Новый адрес... "
|
||||
|
||||
#: ../../../uibase.cpp:914
|
||||
msgid "Sending"
|
||||
msgstr "Отправка"
|
||||
|
||||
#: ../../../uibase.cpp:922
|
||||
msgid "These are your Bitcoin addresses for receiving payments. You can give a different one to each sender to keep track of who is paying you. The highlighted address will be displayed in the main window."
|
||||
msgstr "Это ваши адреса для получения платежей. Вы можете использовать разные для каждого отправителя, чтобы отслеживать, кто вам платит. Выделенный адрес отображается в главном окне."
|
||||
|
||||
#: ../../../uibase.cpp:935
|
||||
msgid "Receiving"
|
||||
msgstr "Получение"
|
||||
|
||||
#: ../../../uibase.cpp:945
|
||||
msgid "&Delete"
|
||||
msgstr "&Удалить"
|
||||
|
||||
#: ../../../util.cpp:807
|
||||
msgid "Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly."
|
||||
msgstr "Внимание: пожалуйста, проверьте дату и время на вашем компьютере. Если часы идут неверно, Bitcoin не будет работать правильно."
|
||||
|
||||
#: ../../../uibase.h:149
|
||||
msgid "Transaction Details"
|
||||
msgstr "Подробности транзакции"
|
||||
|
||||
#: ../../../uibase.h:202
|
||||
msgid "Options"
|
||||
msgstr "Опции"
|
||||
|
||||
#: ../../../uibase.h:230
|
||||
msgid "About Bitcoin"
|
||||
msgstr "О Bitcoin"
|
||||
|
||||
#: ../../../uibase.h:340
|
||||
msgid "Your Bitcoin Addresses"
|
||||
msgstr "Ваш адрес Bitcoin"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "It's good policy to use a new address for each payment you receive.\n"
|
||||
#~ "\n"
|
||||
#~ "Label"
|
||||
#~ msgstr ""
|
||||
#~ "Неплохо будет использовать новый адрес для каждого получаемого платежа.\n"
|
||||
#~ "\n"
|
||||
#~ "Метка"
|
||||
|
||||
#~ msgid "Will appear as \"From: Unknown\""
|
||||
#~ msgstr "Будет отображаться как \"От: Аноним\""
|
||||
@@ -3,51 +3,36 @@
|
||||
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
# for wxWidgets-2.8.x, search and replace "mswud"->"mswd" and "29u"->"28"
|
||||
|
||||
INCLUDEPATHS= \
|
||||
-I"/boost" \
|
||||
-I"/db/build_unix" \
|
||||
-I"/openssl/include" \
|
||||
-I"/wxwidgets/lib/gcc_lib/mswud" \
|
||||
-I"/wxwidgets/include"
|
||||
-I"C:\boost-1.43.0-mgw" \
|
||||
-I"C:\db-4.7.25.NC-mgw\build_unix" \
|
||||
-I"C:\openssl-1.0.0c-mgw\include" \
|
||||
-I"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib\mswud" \
|
||||
-I"C:\wxWidgets-2.9.1-mgw\include"
|
||||
|
||||
LIBPATHS= \
|
||||
-L"/boost/stage/lib" \
|
||||
-L"/db/build_unix" \
|
||||
-L"/openssl/out" \
|
||||
-L"/wxwidgets/lib/gcc_lib"
|
||||
-L"C:\boost-1.43.0-mgw\stage\lib" \
|
||||
-L"C:\db-4.7.25.NC-mgw\build_unix" \
|
||||
-L"C:\openssl-1.0.0c-mgw" \
|
||||
-L"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib"
|
||||
|
||||
WXLIBS= \
|
||||
-l wxmsw29ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd
|
||||
|
||||
LIBS= \
|
||||
-l libboost_system-mgw34-mt-d -l libboost_filesystem-mgw34-mt-d \
|
||||
-l boost_system-mgw45-mt-s-1_43 \
|
||||
-l boost_filesystem-mgw45-mt-s-1_43 \
|
||||
-l boost_program_options-mgw45-mt-s-1_43 \
|
||||
-l boost_thread-mgw45-mt-s-1_43 \
|
||||
-l db_cxx \
|
||||
-l eay32 \
|
||||
-l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi
|
||||
|
||||
WXDEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH
|
||||
DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH
|
||||
DEBUGFLAGS=-g -D__WXDEBUG__
|
||||
CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
|
||||
CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
|
||||
|
||||
|
||||
all: bitcoin.exe
|
||||
|
||||
|
||||
headers.h.gch: headers.h $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/%.o: %.cpp $(HEADERS) headers.h.gch
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/sha.o: sha.cpp sha.h
|
||||
g++ -c $(CFLAGS) -O3 -o $@ $<
|
||||
|
||||
obj/ui_res.o: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp
|
||||
windres $(WXDEFS) $(INCLUDEPATHS) -o $@ -i $<
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
|
||||
|
||||
OBJS= \
|
||||
obj/util.o \
|
||||
@@ -57,20 +42,36 @@ OBJS= \
|
||||
obj/irc.o \
|
||||
obj/main.o \
|
||||
obj/rpc.o \
|
||||
obj/init.o
|
||||
obj/init.o \
|
||||
cryptopp/obj/sha.o \
|
||||
cryptopp/obj/cpu.o
|
||||
|
||||
bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/sha.o obj/ui_res.o
|
||||
|
||||
all: bitcoin.exe
|
||||
|
||||
|
||||
obj/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -DGUI -o $@ $<
|
||||
|
||||
cryptopp/obj/%.o: cryptopp/%.cpp
|
||||
g++ -c $(CFLAGS) -O3 -DCRYPTOPP_X86_ASM_AVAILABLE -o $@ $<
|
||||
|
||||
obj/ui_res.o: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp
|
||||
windres $(DEFS) $(INCLUDEPATHS) -o $@ -i $<
|
||||
|
||||
bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/ui_res.o
|
||||
g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
obj/nogui/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -DwxUSE_GUI=0 -o $@ $<
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
bitcoind.exe: $(OBJS:obj/%=obj/nogui/%) obj/sha.o obj/ui_res.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -l wxbase29ud $(LIBS)
|
||||
bitcoind.exe: $(OBJS:obj/%=obj/nogui/%) obj/ui_res.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-del /Q obj\*
|
||||
-del /Q obj\nogui\*
|
||||
-del /Q cryptopp\obj\*
|
||||
-del /Q headers.h.gch
|
||||
|
||||
48
makefile.osx
48
makefile.osx
@@ -1,10 +1,11 @@
|
||||
# Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
# Copyright (c) 2010 Laszlo Hanyecz
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# Mac OS X makefile for bitcoin
|
||||
# Laszlo Hanyecz (solar@heliacal.net)
|
||||
|
||||
CXX=llvm-g++
|
||||
DEPSDIR=/Users/macosuser/bitcoin/deps
|
||||
|
||||
INCLUDEPATHS= \
|
||||
@@ -19,25 +20,18 @@ LIBS= -dead_strip \
|
||||
$(DEPSDIR)/lib/libdb_cxx-4.8.a \
|
||||
$(DEPSDIR)/lib/libboost_system.a \
|
||||
$(DEPSDIR)/lib/libboost_filesystem.a \
|
||||
$(DEPSDIR)/lib/libboost_program_options.a \
|
||||
$(DEPSDIR)/lib/libboost_thread.a \
|
||||
$(DEPSDIR)/lib/libssl.a \
|
||||
$(DEPSDIR)/lib/libcrypto.a
|
||||
|
||||
WXDEFS=$(shell $(DEPSDIR)/bin/wx-config --cxxflags) -DNOPCH -DMSG_NOSIGNAL=0
|
||||
DEFS=$(shell $(DEPSDIR)/bin/wx-config --cxxflags) -D__WXMAC_OSX__ -DNOPCH -DMSG_NOSIGNAL=0 -DUSE_SSL
|
||||
|
||||
DEBUGFLAGS=-g -DwxDEBUG_LEVEL=0
|
||||
# ppc doesn't work because we don't support big-endian
|
||||
CFLAGS=-mmacosx-version-min=10.5 -arch i386 -arch x86_64 -O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
|
||||
CFLAGS=-mmacosx-version-min=10.5 -arch i386 -arch x86_64 -O3 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
|
||||
|
||||
|
||||
all: bitcoin
|
||||
|
||||
|
||||
obj/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/sha.o: sha.cpp sha.h
|
||||
g++ -c $(CFLAGS) -O3 -o $@ $<
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
|
||||
|
||||
OBJS= \
|
||||
obj/util.o \
|
||||
@@ -47,19 +41,33 @@ OBJS= \
|
||||
obj/irc.o \
|
||||
obj/main.o \
|
||||
obj/rpc.o \
|
||||
obj/init.o
|
||||
obj/init.o \
|
||||
cryptopp/obj/sha.o \
|
||||
cryptopp/obj/cpu.o
|
||||
|
||||
bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
all: bitcoin
|
||||
|
||||
|
||||
obj/%.o: %.cpp $(HEADERS)
|
||||
$(CXX) -c $(CFLAGS) -DGUI -o $@ $<
|
||||
|
||||
cryptopp/obj/%.o: cryptopp/%.cpp
|
||||
$(CXX) -c $(CFLAGS) -O3 -DCRYPTOPP_DISABLE_ASM -o $@ $<
|
||||
|
||||
bitcoin: $(OBJS) obj/ui.o obj/uibase.o
|
||||
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
obj/nogui/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -DwxUSE_GUI=0 -o $@ $<
|
||||
$(CXX) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
bitcoind: $(OBJS:obj/%=obj/nogui/%)
|
||||
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f bitcoin bitcoind
|
||||
-rm -f obj/*.o
|
||||
-rm -f obj/nogui/*.o
|
||||
-rm -f cryptopp/obj/*.o
|
||||
|
||||
@@ -3,48 +3,38 @@
|
||||
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
|
||||
INCLUDEPATHS= \
|
||||
-I"/usr/include" \
|
||||
-I"/usr/local/include/wx-2.9" \
|
||||
-I"/usr/local/lib/wx/include/gtk2-unicode-debug-static-2.9"
|
||||
|
||||
LIBPATHS= \
|
||||
-L"/usr/lib" \
|
||||
-L"/usr/local/lib"
|
||||
|
||||
# for wxWidgets 2.9.1, add -l Xxf86vm
|
||||
WXLIBS= \
|
||||
-Wl,-Bstatic \
|
||||
-l wx_gtk2ud-2.9 \
|
||||
-Wl,-Bdynamic \
|
||||
-l gtk-x11-2.0 -l SM
|
||||
-l gtk-x11-2.0 \
|
||||
-l SM
|
||||
|
||||
# for boost 1.37, add -mt to the boost libraries
|
||||
LIBS= \
|
||||
-Wl,-Bstatic \
|
||||
-l boost_system -l boost_filesystem \
|
||||
-l boost_system \
|
||||
-l boost_filesystem \
|
||||
-l boost_program_options \
|
||||
-l boost_thread \
|
||||
-l db_cxx \
|
||||
-l ssl \
|
||||
-l crypto \
|
||||
-Wl,-Bdynamic \
|
||||
-l gthread-2.0
|
||||
-l gthread-2.0 \
|
||||
-l z \
|
||||
-l dl
|
||||
|
||||
WXDEFS=-D__WXGTK__ -DNOPCH
|
||||
DEFS=-D__WXGTK__ -DNOPCH -DFOURWAYSSE2 -DUSE_SSL
|
||||
DEBUGFLAGS=-g -D__WXDEBUG__
|
||||
CFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
|
||||
CFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
|
||||
|
||||
|
||||
all: bitcoin
|
||||
|
||||
|
||||
headers.h.gch: headers.h $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/%.o: %.cpp $(HEADERS) headers.h.gch
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/sha.o: sha.cpp sha.h
|
||||
g++ -c $(CFLAGS) -O3 -o $@ $<
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
|
||||
|
||||
OBJS= \
|
||||
obj/util.o \
|
||||
@@ -54,20 +44,36 @@ OBJS= \
|
||||
obj/irc.o \
|
||||
obj/main.o \
|
||||
obj/rpc.o \
|
||||
obj/init.o
|
||||
obj/init.o \
|
||||
cryptopp/obj/sha.o \
|
||||
cryptopp/obj/cpu.o
|
||||
|
||||
bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
all: bitcoin
|
||||
|
||||
|
||||
obj/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -DGUI -o $@ $<
|
||||
|
||||
cryptopp/obj/%.o: cryptopp/%.cpp
|
||||
g++ -c $(CFLAGS) -O3 -o $@ $<
|
||||
|
||||
obj/sha256.o: sha256.cpp
|
||||
g++ -c $(CFLAGS) -msse2 -O3 -march=amdfam10 -o $@ $<
|
||||
|
||||
bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha256.o
|
||||
g++ $(CFLAGS) -o $@ $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
obj/nogui/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -DwxUSE_GUI=0 -o $@ $<
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -l wx_baseud-2.9 $(LIBS)
|
||||
bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha256.o
|
||||
g++ $(CFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f obj/*.o
|
||||
-rm -f obj/nogui/*.o
|
||||
-rm -f cryptopp/obj/*.o
|
||||
-rm -f headers.h.gch
|
||||
|
||||
80
makefile.vc
80
makefile.vc
@@ -3,40 +3,57 @@
|
||||
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
# for wxWidgets-2.8.x, search and replace "mswud"->"mswd" and "29u"->"28"
|
||||
|
||||
INCLUDEPATHS= \
|
||||
/I"/boost" \
|
||||
/I"/db/build_windows" \
|
||||
/I"/openssl/include" \
|
||||
/I"/wxwidgets/lib/vc_lib/mswud" \
|
||||
/I"/wxwidgets/lib/vc_lib/mswu" \
|
||||
/I"/wxwidgets/include"
|
||||
|
||||
LIBPATHS= \
|
||||
/LIBPATH:"/boost/stage/lib" \
|
||||
/LIBPATH:"/db/build_windows/debug" \
|
||||
/LIBPATH:"/openssl/out" \
|
||||
/LIBPATH:"/wxwidgets/lib/vc_lib"
|
||||
/LIBPATH:"/db/build_windows/Release" \
|
||||
/LIBPATH:"/openssl/lib" \
|
||||
/LIBPATH:"/wxwidgets/lib/vc_lib" \
|
||||
/NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib \
|
||||
/NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib \
|
||||
/NODEFAULTLIB:msvcrtd.lib
|
||||
|
||||
WXLIBS=wxmsw29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib
|
||||
|
||||
LIBS= \
|
||||
libboost_system-vc80-mt-gd.lib libboost_filesystem-vc80-mt-gd.lib \
|
||||
libdb47sd.lib \
|
||||
libboost_system-vc100-mt.lib \
|
||||
libboost_filesystem-vc100-mt.lib \
|
||||
libboost_program_options-vc100-mt.lib \
|
||||
libboost_thread-vc100-mt.lib \
|
||||
libdb47s.lib \
|
||||
libeay32.lib \
|
||||
wxmsw29ud_html.lib wxmsw29ud_core.lib wxmsw29ud_adv.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib \
|
||||
kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib shlwapi.lib
|
||||
|
||||
WXDEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH
|
||||
DEBUGFLAGS=/Zi /Od /D__WXDEBUG__
|
||||
CFLAGS=/c /nologo /Ob0 /MDd /EHsc /GR /Zm300 $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
|
||||
DEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH
|
||||
DEBUGFLAGS=/Os
|
||||
CFLAGS=/MD /c /nologo /EHsc /GR /Zm300 $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
|
||||
|
||||
OBJS= \
|
||||
obj\util.obj \
|
||||
obj\script.obj \
|
||||
obj\db.obj \
|
||||
obj\net.obj \
|
||||
obj\irc.obj \
|
||||
obj\main.obj \
|
||||
obj\rpc.obj \
|
||||
obj\init.obj \
|
||||
cryptopp\obj\sha.obj \
|
||||
cryptopp\obj\cpu.obj
|
||||
|
||||
|
||||
all: bitcoin.exe
|
||||
|
||||
|
||||
.cpp{obj}.obj:
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
cl $(CFLAGS) /DGUI /Fo$@ %s
|
||||
|
||||
obj\util.obj: $(HEADERS)
|
||||
|
||||
@@ -58,28 +75,21 @@ obj\ui.obj: $(HEADERS)
|
||||
|
||||
obj\uibase.obj: $(HEADERS)
|
||||
|
||||
obj\sha.obj: sha.cpp sha.h
|
||||
cl $(CFLAGS) /O2 /Fo$@ %s
|
||||
cryptopp\obj\sha.obj: cryptopp\sha.cpp
|
||||
cl $(CFLAGS) /O2 /DCRYPTOPP_DISABLE_ASM /Fo$@ %s
|
||||
|
||||
cryptopp\obj\cpu.obj: cryptopp\cpu.cpp
|
||||
cl $(CFLAGS) /O2 /DCRYPTOPP_DISABLE_ASM /Fo$@ %s
|
||||
|
||||
obj\ui.res: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp
|
||||
rc $(INCLUDEPATHS) $(WXDEFS) /Fo$@ %s
|
||||
rc $(INCLUDEPATHS) $(DEFS) /Fo$@ %s
|
||||
|
||||
OBJS= \
|
||||
obj\util.obj \
|
||||
obj\script.obj \
|
||||
obj\db.obj \
|
||||
obj\net.obj \
|
||||
obj\irc.obj \
|
||||
obj\main.obj \
|
||||
obj\rpc.obj \
|
||||
obj\init.obj
|
||||
|
||||
bitcoin.exe: $(OBJS) obj\ui.obj obj\uibase.obj obj\sha.obj obj\ui.res
|
||||
link /nologo /DEBUG /SUBSYSTEM:WINDOWS /OUT:$@ $(LIBPATHS) $** $(LIBS)
|
||||
bitcoin.exe: $(OBJS) obj\ui.obj obj\uibase.obj obj\ui.res
|
||||
link /nologo /SUBSYSTEM:WINDOWS /OUT:$@ $(LIBPATHS) $** $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
.cpp{obj\nogui}.obj:
|
||||
cl $(CFLAGS) /DwxUSE_GUI=0 /Fo$@ %s
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
|
||||
obj\nogui\util.obj: $(HEADERS)
|
||||
|
||||
@@ -97,11 +107,13 @@ obj\nogui\rpc.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\init.obj: $(HEADERS)
|
||||
|
||||
bitcoind.exe: $(OBJS:obj\=obj\nogui\) obj\sha.obj obj\ui.res
|
||||
link /nologo /DEBUG /OUT:$@ $(LIBPATHS) $** $(LIBS)
|
||||
bitcoind.exe: $(OBJS:obj\=obj\nogui\) obj\ui.res
|
||||
link /nologo /OUT:$@ $(LIBPATHS) $** $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-del /Q obj\*
|
||||
-del *.ilk
|
||||
-del *.pdb
|
||||
-del /Q obj\nogui\*
|
||||
-del /Q cryptopp\obj\*
|
||||
-del /Q *.ilk
|
||||
-del /Q *.pdb
|
||||
|
||||
336
net.cpp
336
net.cpp
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
static const int MAX_OUTBOUND_CONNECTIONS = 8;
|
||||
|
||||
void ThreadMessageHandler2(void* parg);
|
||||
void ThreadSocketHandler2(void* parg);
|
||||
void ThreadOpenConnections2(void* parg);
|
||||
@@ -18,12 +20,11 @@ bool OpenNetworkConnection(const CAddress& addrConnect);
|
||||
//
|
||||
bool fClient = false;
|
||||
uint64 nLocalServices = (fClient ? 0 : NODE_NETWORK);
|
||||
CAddress addrLocalHost(0, DEFAULT_PORT, nLocalServices);
|
||||
CAddress addrLocalHost(0, 0, nLocalServices);
|
||||
CNode* pnodeLocalHost = NULL;
|
||||
uint64 nLocalHostNonce = 0;
|
||||
array<int, 10> vnThreadsRunning;
|
||||
SOCKET hListenSocket = INVALID_SOCKET;
|
||||
int64 nThreadSocketHandlerHeartbeat = INT64_MAX;
|
||||
|
||||
vector<CNode*> vNodes;
|
||||
CCriticalSection cs_vNodes;
|
||||
@@ -64,7 +65,7 @@ bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet)
|
||||
SOCKET hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (hSocket == INVALID_SOCKET)
|
||||
return false;
|
||||
#if defined(__BSD__) || defined(__WXOSX__)
|
||||
#ifdef BSD
|
||||
int set = 1;
|
||||
setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int));
|
||||
#endif
|
||||
@@ -127,7 +128,7 @@ bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const cha
|
||||
string strLine;
|
||||
while (RecvLine(hSocket, strLine))
|
||||
{
|
||||
if (strLine.empty())
|
||||
if (strLine.empty()) // HTTP response is separated from headers by blank line
|
||||
{
|
||||
loop
|
||||
{
|
||||
@@ -136,6 +137,8 @@ bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const cha
|
||||
closesocket(hSocket);
|
||||
return false;
|
||||
}
|
||||
if (pszKeyword == NULL)
|
||||
break;
|
||||
if (strLine.find(pszKeyword) != -1)
|
||||
{
|
||||
strLine = strLine.substr(strLine.find(pszKeyword) + strlen(pszKeyword));
|
||||
@@ -143,7 +146,7 @@ bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const cha
|
||||
}
|
||||
}
|
||||
closesocket(hSocket);
|
||||
if (strLine.find("<"))
|
||||
if (strLine.find("<") != -1)
|
||||
strLine = strLine.substr(0, strLine.find("<"));
|
||||
strLine = strLine.substr(strspn(strLine.c_str(), " \t\n\r"));
|
||||
while (strLine.size() > 0 && isspace(strLine[strLine.size()-1]))
|
||||
@@ -160,7 +163,7 @@ bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const cha
|
||||
return error("GetMyExternalIP() : connection closed");
|
||||
}
|
||||
|
||||
|
||||
// We now get our external IP from the IRC server first and only use this as a backup
|
||||
bool GetMyExternalIP(unsigned int& ipRet)
|
||||
{
|
||||
CAddress addrConnect;
|
||||
@@ -173,28 +176,13 @@ bool GetMyExternalIP(unsigned int& ipRet)
|
||||
for (int nLookup = 0; nLookup <= 1; nLookup++)
|
||||
for (int nHost = 1; nHost <= 2; nHost++)
|
||||
{
|
||||
// We should be phasing out our use of sites like these. If we need
|
||||
// replacements, we should ask for volunteers to put this simple
|
||||
// php file on their webserver that prints the client IP:
|
||||
// <?php echo $_SERVER["REMOTE_ADDR"]; ?>
|
||||
if (nHost == 1)
|
||||
{
|
||||
addrConnect = CAddress("70.86.96.218:80"); // www.ipaddressworld.com
|
||||
|
||||
if (nLookup == 1)
|
||||
{
|
||||
struct hostent* phostent = gethostbyname("www.ipaddressworld.com");
|
||||
if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
|
||||
addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(80));
|
||||
}
|
||||
|
||||
pszGet = "GET /ip.php HTTP/1.1\r\n"
|
||||
"Host: www.ipaddressworld.com\r\n"
|
||||
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n";
|
||||
|
||||
pszKeyword = "IP:";
|
||||
}
|
||||
else if (nHost == 2)
|
||||
{
|
||||
addrConnect = CAddress("208.78.68.70:80"); // checkip.dyndns.org
|
||||
addrConnect = CAddress("91.198.22.70:80"); // checkip.dyndns.org
|
||||
|
||||
if (nLookup == 1)
|
||||
{
|
||||
@@ -211,6 +199,25 @@ bool GetMyExternalIP(unsigned int& ipRet)
|
||||
|
||||
pszKeyword = "Address:";
|
||||
}
|
||||
else if (nHost == 2)
|
||||
{
|
||||
addrConnect = CAddress("74.208.43.192:80"); // www.showmyip.com
|
||||
|
||||
if (nLookup == 1)
|
||||
{
|
||||
struct hostent* phostent = gethostbyname("www.showmyip.com");
|
||||
if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
|
||||
addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(80));
|
||||
}
|
||||
|
||||
pszGet = "GET /simple/ HTTP/1.1\r\n"
|
||||
"Host: www.showmyip.com\r\n"
|
||||
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n";
|
||||
|
||||
pszKeyword = NULL; // Returns just IP address
|
||||
}
|
||||
|
||||
if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet))
|
||||
return true;
|
||||
@@ -219,16 +226,47 @@ bool GetMyExternalIP(unsigned int& ipRet)
|
||||
return false;
|
||||
}
|
||||
|
||||
void ThreadGetMyExternalIP(void* parg)
|
||||
{
|
||||
// Wait for IRC to get it first
|
||||
if (!GetBoolArg("-noirc"))
|
||||
{
|
||||
for (int i = 0; i < 2 * 60; i++)
|
||||
{
|
||||
Sleep(1000);
|
||||
if (fGotExternalIP || fShutdown)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback in case IRC fails to get it
|
||||
if (GetMyExternalIP(addrLocalHost.ip))
|
||||
{
|
||||
printf("GetMyExternalIP() returned %s\n", addrLocalHost.ToStringIP().c_str());
|
||||
if (addrLocalHost.IsRoutable())
|
||||
{
|
||||
// If we already connected to a few before we had our IP, go back and addr them.
|
||||
// setAddrKnown automatically filters any duplicate sends.
|
||||
CAddress addr(addrLocalHost);
|
||||
addr.nTime = GetAdjustedTime();
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
foreach(CNode* pnode, vNodes)
|
||||
pnode->PushAddress(addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool AddAddress(CAddress addr)
|
||||
|
||||
bool AddAddress(CAddress addr, int64 nTimePenalty)
|
||||
{
|
||||
if (!addr.IsRoutable())
|
||||
return false;
|
||||
if (addr.ip == addrLocalHost.ip)
|
||||
return false;
|
||||
addr.nTime = max((int64)0, (int64)addr.nTime - nTimePenalty);
|
||||
CRITICAL_BLOCK(cs_mapAddresses)
|
||||
{
|
||||
map<vector<unsigned char>, CAddress>::iterator it = mapAddresses.find(addr.GetKey());
|
||||
@@ -605,7 +643,9 @@ void ThreadSocketHandler2(void* parg)
|
||||
FD_ZERO(&fdsetSend);
|
||||
FD_ZERO(&fdsetError);
|
||||
SOCKET hSocketMax = 0;
|
||||
FD_SET(hListenSocket, &fdsetRecv);
|
||||
|
||||
if(hListenSocket != INVALID_SOCKET)
|
||||
FD_SET(hListenSocket, &fdsetRecv);
|
||||
hSocketMax = max(hSocketMax, hListenSocket);
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
{
|
||||
@@ -642,17 +682,27 @@ void ThreadSocketHandler2(void* parg)
|
||||
//
|
||||
// Accept new connections
|
||||
//
|
||||
if (FD_ISSET(hListenSocket, &fdsetRecv))
|
||||
if (hListenSocket != INVALID_SOCKET && FD_ISSET(hListenSocket, &fdsetRecv))
|
||||
{
|
||||
struct sockaddr_in sockaddr;
|
||||
socklen_t len = sizeof(sockaddr);
|
||||
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
|
||||
CAddress addr(sockaddr);
|
||||
int nInbound = 0;
|
||||
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
foreach(CNode* pnode, vNodes)
|
||||
if (pnode->fInbound)
|
||||
nInbound++;
|
||||
if (hSocket == INVALID_SOCKET)
|
||||
{
|
||||
if (WSAGetLastError() != WSAEWOULDBLOCK)
|
||||
printf("socket error accept failed: %d\n", WSAGetLastError());
|
||||
}
|
||||
else if (nInbound >= GetArg("-maxconnections", 125) - MAX_OUTBOUND_CONNECTIONS)
|
||||
{
|
||||
closesocket(hSocket);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("accepted connection %s\n", addr.ToStringLog().c_str());
|
||||
@@ -691,32 +741,39 @@ void ThreadSocketHandler2(void* parg)
|
||||
CDataStream& vRecv = pnode->vRecv;
|
||||
unsigned int nPos = vRecv.size();
|
||||
|
||||
// typical socket buffer is 8K-64K
|
||||
char pchBuf[0x10000];
|
||||
int nBytes = recv(pnode->hSocket, pchBuf, sizeof(pchBuf), MSG_DONTWAIT);
|
||||
if (nBytes > 0)
|
||||
{
|
||||
vRecv.resize(nPos + nBytes);
|
||||
memcpy(&vRecv[nPos], pchBuf, nBytes);
|
||||
pnode->nLastRecv = GetTime();
|
||||
}
|
||||
else if (nBytes == 0)
|
||||
{
|
||||
// socket closed gracefully
|
||||
if (nPos > 1000*GetArg("-maxreceivebuffer", 2*1000)) {
|
||||
if (!pnode->fDisconnect)
|
||||
printf("socket closed\n");
|
||||
printf("socket recv flood control disconnect (%d bytes)\n", vRecv.size());
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
else if (nBytes < 0)
|
||||
{
|
||||
// error
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
|
||||
else {
|
||||
// typical socket buffer is 8K-64K
|
||||
char pchBuf[0x10000];
|
||||
int nBytes = recv(pnode->hSocket, pchBuf, sizeof(pchBuf), MSG_DONTWAIT);
|
||||
if (nBytes > 0)
|
||||
{
|
||||
vRecv.resize(nPos + nBytes);
|
||||
memcpy(&vRecv[nPos], pchBuf, nBytes);
|
||||
pnode->nLastRecv = GetTime();
|
||||
}
|
||||
else if (nBytes == 0)
|
||||
{
|
||||
// socket closed gracefully
|
||||
if (!pnode->fDisconnect)
|
||||
printf("socket recv error %d\n", nErr);
|
||||
printf("socket closed\n");
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
else if (nBytes < 0)
|
||||
{
|
||||
// error
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
|
||||
{
|
||||
if (!pnode->fDisconnect)
|
||||
printf("socket recv error %d\n", nErr);
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -749,6 +806,11 @@ void ThreadSocketHandler2(void* parg)
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
}
|
||||
if (vSend.size() > 1000*GetArg("-maxsendbuffer", 256)) {
|
||||
if (!pnode->fDisconnect)
|
||||
printf("socket send flood control disconnect (%d bytes)\n", vSend.size());
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -783,7 +845,6 @@ void ThreadSocketHandler2(void* parg)
|
||||
pnode->Release();
|
||||
}
|
||||
|
||||
nThreadSocketHandlerHeartbeat = GetTime();
|
||||
Sleep(10);
|
||||
}
|
||||
}
|
||||
@@ -802,16 +863,46 @@ void ThreadSocketHandler2(void* parg)
|
||||
|
||||
unsigned int pnSeed[] =
|
||||
{
|
||||
0x35218252, 0x9c9c9618, 0xda6bacad, 0xb9aca862, 0x97c235c6,
|
||||
0x146f9562, 0xb67b9e4b, 0x87cf4bc0, 0xb83945d0, 0x984333ad,
|
||||
0xbbeec555, 0x6f0eb440, 0xe0005318, 0x7797e460, 0xddc60fcc,
|
||||
0xb3bbd24a, 0x1ac85746, 0x641846a6, 0x85ee1155, 0xbb2e7a4c,
|
||||
0x9cb8514b, 0xfc342648, 0x62958fae, 0xd0a8c87a, 0xa800795b,
|
||||
0xda8c814e, 0x256a0c80, 0x3f23ec63, 0xd565df43, 0x997d9044,
|
||||
0xaa121448, 0xbed8688e, 0x59d09a5e, 0xb2931243, 0x3730ba18,
|
||||
0xdd3462d0, 0x4e4d1448, 0x171df645, 0x84ee1155,
|
||||
0x248ac445, 0x0e634444, 0x0ded1b63, 0x30c01e60,
|
||||
0xa2b9a094, 0x29e4fd43, 0x9ce61b4c, 0xdae09744,
|
||||
0x1ddb1032, 0x6242ce40, 0x52d6a445, 0x2dd7a445, 0x8a53cd47, 0x73263750, 0xda23c257, 0xecd4ed57,
|
||||
0x0a40ec59, 0x75dce160, 0x7df76791, 0x89370bad, 0xa4f214ad, 0x767700ae, 0x638b0418, 0x868a1018,
|
||||
0xcd9f332e, 0x0129653e, 0xcc92dc3e, 0x96671640, 0x56487e40, 0x5b66f440, 0xb1d01f41, 0xf1dc6041,
|
||||
0xc1d12b42, 0x86ba1243, 0x6be4df43, 0x6d4cef43, 0xd18e0644, 0x1ab0b344, 0x6584a345, 0xe7c1a445,
|
||||
0x58cea445, 0xc5daa445, 0x21dda445, 0x3d3b5346, 0x13e55347, 0x1080d24a, 0x8e611e4b, 0x81518e4b,
|
||||
0x6c839e4b, 0xe2ad0a4c, 0xfbbc0a4c, 0x7f5b6e4c, 0x7244224e, 0x1300554e, 0x20690652, 0x5a48b652,
|
||||
0x75c5c752, 0x4335cc54, 0x340fd154, 0x87c07455, 0x087b2b56, 0x8a133a57, 0xac23c257, 0x70374959,
|
||||
0xfb63d45b, 0xb9a1685c, 0x180d765c, 0x674f645d, 0x04d3495e, 0x1de44b5e, 0x4ee8a362, 0x0ded1b63,
|
||||
0xc1b04b6d, 0x8d921581, 0x97b7ea82, 0x1cf83a8e, 0x91490bad, 0x09dc75ae, 0x9a6d79ae, 0xa26d79ae,
|
||||
0x0fd08fae, 0x0f3e3fb2, 0x4f944fb2, 0xcca448b8, 0x3ecd6ab8, 0xa9d5a5bc, 0x8d0119c1, 0x045997d5,
|
||||
0xca019dd9, 0x0d526c4d, 0xabf1ba44, 0x66b1ab55, 0x1165f462, 0x3ed7cbad, 0xa38fae6e, 0x3bd2cbad,
|
||||
0xd36f0547, 0x20df7840, 0x7a337742, 0x549f8e4b, 0x9062365c, 0xd399f562, 0x2b5274a1, 0x8edfa153,
|
||||
0x3bffb347, 0x7074bf58, 0xb74fcbad, 0x5b5a795b, 0x02fa29ce, 0x5a6738d4, 0xe8a1d23e, 0xef98c445,
|
||||
0x4b0f494c, 0xa2bc1e56, 0x7694ad63, 0xa4a800c3, 0x05fda6cd, 0x9f22175e, 0x364a795b, 0x536285d5,
|
||||
0xac44c9d4, 0x0b06254d, 0x150c2fd4, 0x32a50dcc, 0xfd79ce48, 0xf15cfa53, 0x66c01e60, 0x6bc26661,
|
||||
0xc03b47ae, 0x4dda1b81, 0x3285a4c1, 0x883ca96d, 0x35d60a4c, 0xdae09744, 0x2e314d61, 0x84e247cf,
|
||||
0x6c814552, 0x3a1cc658, 0x98d8f382, 0xe584cb5b, 0x15e86057, 0x7b01504e, 0xd852dd48, 0x56382f56,
|
||||
0x0a5df454, 0xa0d18d18, 0x2e89b148, 0xa79c114c, 0xcbdcd054, 0x5523bc43, 0xa9832640, 0x8a066144,
|
||||
0x3894c3bc, 0xab76bf58, 0x6a018ac1, 0xfebf4f43, 0x2f26c658, 0x31102f4e, 0x85e929d5, 0x2a1c175e,
|
||||
0xfc6c2cd1, 0x27b04b6d, 0xdf024650, 0x161748b8, 0x28be6580, 0x57be6580, 0x1cee677a, 0xaa6bb742,
|
||||
0x9a53964b, 0x0a5a2d4d, 0x2434c658, 0x9a494f57, 0x1ebb0e48, 0xf610b85d, 0x077ecf44, 0x085128bc,
|
||||
0x5ba17a18, 0x27ca1b42, 0xf8a00b56, 0xfcd4c257, 0xcf2fc15e, 0xd897e052, 0x4cada04f, 0x2f35f6d5,
|
||||
0x382ce8c9, 0xe523984b, 0x3f946846, 0x60c8be43, 0x41da6257, 0xde0be142, 0xae8a544b, 0xeff0c254,
|
||||
0x1e0f795b, 0xaeb28890, 0xca16acd9, 0x1e47ddd8, 0x8c8c4829, 0xd27dc747, 0xd53b1663, 0x4096b163,
|
||||
0x9c8dd958, 0xcb12f860, 0x9e79305c, 0x40c1a445, 0x4a90c2bc, 0x2c3a464d, 0x2727f23c, 0x30b04b6d,
|
||||
0x59024cb8, 0xa091e6ad, 0x31b04b6d, 0xc29d46a6, 0x63934fb2, 0xd9224dbe, 0x9f5910d8, 0x7f530a6b,
|
||||
0x752e9c95, 0x65453548, 0xa484be46, 0xce5a1b59, 0x710e0718, 0x46a13d18, 0xdaaf5318, 0xc4a8ff53,
|
||||
0x87abaa52, 0xb764cf51, 0xb2025d4a, 0x6d351e41, 0xc035c33e, 0xa432c162, 0x61ef34ae, 0xd16fddbc,
|
||||
0x0870e8c1, 0x3070e8c1, 0x9c71e8c1, 0xa4992363, 0x85a1f663, 0x4184e559, 0x18d96ed8, 0x17b8dbd5,
|
||||
0x60e7cd18, 0xe5ee104c, 0xab17ac62, 0x1e786e1b, 0x5d23b762, 0xf2388fae, 0x88270360, 0x9e5b3d80,
|
||||
0x7da518b2, 0xb5613b45, 0x1ad41f3e, 0xd550854a, 0x8617e9a9, 0x925b229c, 0xf2e92542, 0x47af0544,
|
||||
0x73b5a843, 0xb9b7a0ad, 0x03a748d0, 0x0a6ff862, 0x6694df62, 0x3bfac948, 0x8e098f4f, 0x746916c3,
|
||||
0x02f38e4f, 0x40bb1243, 0x6a54d162, 0x6008414b, 0xa513794c, 0x514aa343, 0x63781747, 0xdbb6795b,
|
||||
0xed065058, 0x42d24b46, 0x1518794c, 0x9b271681, 0x73e4ffad, 0x0654784f, 0x438dc945, 0x641846a6,
|
||||
0x2d1b0944, 0x94b59148, 0x8d369558, 0xa5a97662, 0x8b705b42, 0xce9204ae, 0x8d584450, 0x2df61555,
|
||||
0xeebff943, 0x2e75fb4d, 0x3ef8fc57, 0x9921135e, 0x8e31042e, 0xb5afad43, 0x89ecedd1, 0x9cfcc047,
|
||||
0x8fcd0f4c, 0xbe49f5ad, 0x146a8d45, 0x98669ab8, 0x98d9175e, 0xd1a8e46d, 0x839a3ab8, 0x40a0016c,
|
||||
0x6d27c257, 0x977fffad, 0x7baa5d5d, 0x1213be43, 0xb167e5a9, 0x640fe8ca, 0xbc9ea655, 0x0f820a4c,
|
||||
0x0f097059, 0x69ac957c, 0x366d8453, 0xb1ba2844, 0x8857f081, 0x70b5be63, 0xc545454b, 0xaf36ded1,
|
||||
0xb5a4b052, 0x21f062d1, 0x72ab89b2, 0x74a45318, 0x8312e6bc, 0xb916965f, 0x8aa7c858, 0xfe7effad,
|
||||
};
|
||||
|
||||
|
||||
@@ -879,12 +970,20 @@ void ThreadOpenConnections2(void* parg)
|
||||
int64 nStart = GetTime();
|
||||
loop
|
||||
{
|
||||
// Wait
|
||||
// Limit outbound connections
|
||||
vnThreadsRunning[1]--;
|
||||
Sleep(500);
|
||||
const int nMaxConnections = 8;
|
||||
while (vNodes.size() >= nMaxConnections)
|
||||
loop
|
||||
{
|
||||
int nOutbound = 0;
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
foreach(CNode* pnode, vNodes)
|
||||
if (!pnode->fInbound)
|
||||
nOutbound++;
|
||||
int nMaxOutboundConnections = MAX_OUTBOUND_CONNECTIONS;
|
||||
nMaxOutboundConnections = min(nMaxOutboundConnections, (int)GetArg("-maxconnections", 125));
|
||||
if (nOutbound < nMaxOutboundConnections)
|
||||
break;
|
||||
Sleep(2000);
|
||||
if (fShutdown)
|
||||
return;
|
||||
@@ -898,7 +997,7 @@ void ThreadOpenConnections2(void* parg)
|
||||
// Add seed nodes if IRC isn't working
|
||||
static bool fSeedUsed;
|
||||
bool fTOR = (fUseProxy && addrProxy.port == htons(9050));
|
||||
if (mapAddresses.empty() && (GetTime() - nStart > 60 || fTOR))
|
||||
if (mapAddresses.empty() && (GetTime() - nStart > 60 || fTOR) && !fTestNet)
|
||||
{
|
||||
for (int i = 0; i < ARRAYLEN(pnSeed); i++)
|
||||
{
|
||||
@@ -931,7 +1030,7 @@ void ThreadOpenConnections2(void* parg)
|
||||
{
|
||||
foreach(PAIRTYPE(const vector<unsigned char>, CAddress)& item, mapAddresses)
|
||||
{
|
||||
if (setSeed.count(item.second.ip))
|
||||
if (setSeed.count(item.second.ip) && item.second.nTime != 0)
|
||||
{
|
||||
item.second.nTime = 0;
|
||||
CAddrDB().WriteAddress(item.second);
|
||||
@@ -948,25 +1047,26 @@ void ThreadOpenConnections2(void* parg)
|
||||
CAddress addrConnect;
|
||||
int64 nBest = INT64_MIN;
|
||||
|
||||
// Do this here so we don't have to critsect vNodes inside mapAddresses critsect
|
||||
// Only connect to one address per a.b.?.? range.
|
||||
// Do this here so we don't have to critsect vNodes inside mapAddresses critsect.
|
||||
set<unsigned int> setConnected;
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
foreach(CNode* pnode, vNodes)
|
||||
setConnected.insert(pnode->addr.ip);
|
||||
setConnected.insert(pnode->addr.ip & 0x0000ffff);
|
||||
|
||||
CRITICAL_BLOCK(cs_mapAddresses)
|
||||
{
|
||||
foreach(const PAIRTYPE(vector<unsigned char>, CAddress)& item, mapAddresses)
|
||||
{
|
||||
const CAddress& addr = item.second;
|
||||
if (!addr.IsIPv4() || !addr.IsValid() || setConnected.count(addr.ip))
|
||||
if (!addr.IsIPv4() || !addr.IsValid() || setConnected.count(addr.ip & 0x0000ffff))
|
||||
continue;
|
||||
int64 nSinceLastSeen = GetAdjustedTime() - addr.nTime;
|
||||
int64 nSinceLastTry = GetAdjustedTime() - addr.nLastTry;
|
||||
|
||||
// Randomize the order in a deterministic way, putting the standard port first
|
||||
int64 nRandomizer = (uint64)(nStart * 4951 + addr.nLastTry * 9567851 + addr.ip * 7789) % (2 * 60 * 60);
|
||||
if (addr.port != DEFAULT_PORT)
|
||||
if (addr.port != GetDefaultPort())
|
||||
nRandomizer += 2 * 60 * 60;
|
||||
|
||||
// Last seen Base retry frequency
|
||||
@@ -1033,25 +1133,6 @@ bool OpenNetworkConnection(const CAddress& addrConnect)
|
||||
return false;
|
||||
pnode->fNetworkNode = true;
|
||||
|
||||
if (addrLocalHost.IsRoutable() && !fUseProxy)
|
||||
{
|
||||
// Advertise our address
|
||||
vector<CAddress> vAddr;
|
||||
vAddr.push_back(addrLocalHost);
|
||||
pnode->PushMessage("addr", vAddr);
|
||||
}
|
||||
|
||||
// Get as many addresses as we can
|
||||
pnode->PushMessage("getaddr");
|
||||
pnode->fGetAddr = true; // don't relay the results of the getaddr
|
||||
|
||||
////// should the one on the receiving end do this too?
|
||||
// Subscribe our local subscription list
|
||||
const unsigned int nHops = 0;
|
||||
for (unsigned int nChannel = 0; nChannel < pnodeLocalHost->vfSubscribe.size(); nChannel++)
|
||||
if (pnodeLocalHost->vfSubscribe[nChannel])
|
||||
pnode->PushMessage("subscribe", nChannel, nHops);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1120,9 +1201,13 @@ void ThreadMessageHandler2(void* parg)
|
||||
pnode->Release();
|
||||
}
|
||||
|
||||
// Wait and allow messages to bunch up
|
||||
// Wait and allow messages to bunch up.
|
||||
// Reduce vnThreadsRunning so StopNode has permission to exit while
|
||||
// we're sleeping, but we must always check fShutdown after doing this.
|
||||
vnThreadsRunning[2]--;
|
||||
Sleep(100);
|
||||
if (fRequestShutdown)
|
||||
Shutdown(NULL);
|
||||
vnThreadsRunning[2]++;
|
||||
if (fShutdown)
|
||||
return;
|
||||
@@ -1141,6 +1226,7 @@ bool BindListenPort(string& strError)
|
||||
{
|
||||
strError = "";
|
||||
int nOne = 1;
|
||||
addrLocalHost.port = GetDefaultPort();
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Initialize Windows Sockets
|
||||
@@ -1163,7 +1249,7 @@ bool BindListenPort(string& strError)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(__BSD__) || defined(__WXOSX__)
|
||||
#ifdef BSD
|
||||
// Different way of disabling SIGPIPE on BSD
|
||||
setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int));
|
||||
#endif
|
||||
@@ -1192,12 +1278,12 @@ bool BindListenPort(string& strError)
|
||||
memset(&sockaddr, 0, sizeof(sockaddr));
|
||||
sockaddr.sin_family = AF_INET;
|
||||
sockaddr.sin_addr.s_addr = INADDR_ANY; // bind to all IPs on this computer
|
||||
sockaddr.sin_port = DEFAULT_PORT;
|
||||
sockaddr.sin_port = GetDefaultPort();
|
||||
if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) == SOCKET_ERROR)
|
||||
{
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr == WSAEADDRINUSE)
|
||||
strError = strprintf("Unable to bind to port %d on this computer. Bitcoin is probably already running.", ntohs(sockaddr.sin_port));
|
||||
strError = strprintf(_("Unable to bind to port %d on this computer. Bitcoin is probably already running."), ntohs(sockaddr.sin_port));
|
||||
else
|
||||
strError = strprintf("Error: Unable to bind to port %d on this computer (bind returned error %d)", ntohs(sockaddr.sin_port), nErr);
|
||||
printf("%s\n", strError.c_str());
|
||||
@@ -1234,7 +1320,7 @@ void StartNode(void* parg)
|
||||
printf("host ip %d: %s\n", i, CAddress(*(unsigned int*)phostent->h_addr_list[i]).ToStringIP().c_str());
|
||||
for (int i = 0; phostent->h_addr_list[i] != NULL; i++)
|
||||
{
|
||||
CAddress addr(*(unsigned int*)phostent->h_addr_list[i], DEFAULT_PORT, nLocalServices);
|
||||
CAddress addr(*(unsigned int*)phostent->h_addr_list[i], GetDefaultPort(), nLocalServices);
|
||||
if (addr.IsValid() && addr.GetByte(3) != 127)
|
||||
{
|
||||
addrLocalHost = addr;
|
||||
@@ -1262,7 +1348,7 @@ void StartNode(void* parg)
|
||||
printf("ipv4 %s: %s\n", ifa->ifa_name, pszIP);
|
||||
|
||||
// Take the first IP that isn't loopback 127.x.x.x
|
||||
CAddress addr(*(unsigned int*)&s4->sin_addr, DEFAULT_PORT, nLocalServices);
|
||||
CAddress addr(*(unsigned int*)&s4->sin_addr, GetDefaultPort(), nLocalServices);
|
||||
if (addr.IsValid() && addr.GetByte(3) != 127)
|
||||
{
|
||||
addrLocalHost = addr;
|
||||
@@ -1281,8 +1367,7 @@ void StartNode(void* parg)
|
||||
#endif
|
||||
printf("addrLocalHost = %s\n", addrLocalHost.ToString().c_str());
|
||||
|
||||
// Get our external IP address for incoming connections
|
||||
if (fUseProxy)
|
||||
if (fUseProxy || mapArgs.count("-connect") || fNoListen)
|
||||
{
|
||||
// Proxies can't take incoming connections
|
||||
addrLocalHost.ip = CAddress("0.0.0.0").ip;
|
||||
@@ -1290,15 +1375,7 @@ void StartNode(void* parg)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (addrIncoming.IsValid())
|
||||
addrLocalHost.ip = addrIncoming.ip;
|
||||
|
||||
if (GetMyExternalIP(addrLocalHost.ip))
|
||||
{
|
||||
addrIncoming = addrLocalHost;
|
||||
CWalletDB().WriteSetting("addrIncoming", addrIncoming);
|
||||
printf("addrLocalHost = %s\n", addrLocalHost.ToString().c_str());
|
||||
}
|
||||
CreateThread(ThreadGetMyExternalIP, NULL);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1322,57 +1399,6 @@ void StartNode(void* parg)
|
||||
|
||||
// Generate coins in the background
|
||||
GenerateBitcoins(fGenerateBitcoins);
|
||||
|
||||
//
|
||||
// Thread monitoring
|
||||
// Not really needed anymore, the cause of the hanging was fixed
|
||||
//
|
||||
loop
|
||||
{
|
||||
Sleep(1000);
|
||||
if (fShutdown)
|
||||
return;
|
||||
if (GetTime() - nThreadSocketHandlerHeartbeat > 15 * 60)
|
||||
{
|
||||
// First see if closing sockets will free it
|
||||
printf("*** ThreadSocketHandler is stopped ***\n");
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
{
|
||||
foreach(CNode* pnode, vNodes)
|
||||
{
|
||||
bool fGot = false;
|
||||
TRY_CRITICAL_BLOCK(pnode->cs_vRecv)
|
||||
TRY_CRITICAL_BLOCK(pnode->cs_vSend)
|
||||
fGot = true;
|
||||
if (!fGot)
|
||||
{
|
||||
printf("*** closing socket\n");
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
Sleep(10000);
|
||||
if (fShutdown)
|
||||
return;
|
||||
if (GetTime() - nThreadSocketHandlerHeartbeat < 60)
|
||||
continue;
|
||||
|
||||
// Hopefully it never comes to this.
|
||||
// We know it'll always be hung in the recv or send call.
|
||||
// cs_vRecv or cs_vSend may be left permanently unreleased,
|
||||
// but we always only use TRY_CRITICAL_SECTION on them.
|
||||
printf("*** Restarting ThreadSocketHandler ***\n");
|
||||
TerminateThread(hThreadSocketHandler, 0);
|
||||
#ifdef __WXMSW__
|
||||
CloseHandle(hThreadSocketHandler);
|
||||
#endif
|
||||
vnThreadsRunning[0] = 0;
|
||||
|
||||
// Restart
|
||||
hThreadSocketHandler = CreateThread(ThreadSocketHandler, NULL, true);
|
||||
nThreadSocketHandlerHeartbeat = GetTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool StopNode()
|
||||
|
||||
47
net.h
47
net.h
@@ -12,7 +12,7 @@ extern int nBestHeight;
|
||||
|
||||
|
||||
|
||||
static const unsigned short DEFAULT_PORT = 0x8d20; // htons(8333)
|
||||
inline unsigned short GetDefaultPort() { return fTestNet ? htons(18333) : htons(8333); }
|
||||
static const unsigned int PUBLISH_HOPS = 5;
|
||||
enum
|
||||
{
|
||||
@@ -24,7 +24,7 @@ enum
|
||||
|
||||
bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet);
|
||||
bool GetMyExternalIP(unsigned int& ipRet);
|
||||
bool AddAddress(CAddress addr);
|
||||
bool AddAddress(CAddress addr, int64 nTimePenalty=0);
|
||||
void AddressCurrentlyConnected(const CAddress& addr);
|
||||
CNode* FindNode(unsigned int ip);
|
||||
CNode* ConnectNode(CAddress addrConnect, int64 nTimeout=0);
|
||||
@@ -48,10 +48,7 @@ bool StopNode();
|
||||
// (4) size
|
||||
// (4) checksum
|
||||
|
||||
// The message start string is designed to be unlikely to occur in normal data.
|
||||
// The characters are rarely used upper ascii, not valid as UTF-8, and produce
|
||||
// a large 4-byte int at any alignment.
|
||||
static const char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 };
|
||||
extern char pchMessageStart[4];
|
||||
|
||||
class CMessageHeader
|
||||
{
|
||||
@@ -117,9 +114,9 @@ public:
|
||||
}
|
||||
|
||||
// Message size
|
||||
if (nMessageSize > 0x10000000)
|
||||
if (nMessageSize > MAX_SIZE)
|
||||
{
|
||||
printf("CMessageHeader::IsValid() : nMessageSize too large %u\n", nMessageSize);
|
||||
printf("CMessageHeader::IsValid() : (%s, %u bytes) nMessageSize > MAX_SIZE\n", GetCommand().c_str(), nMessageSize);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -142,7 +139,7 @@ public:
|
||||
unsigned int ip;
|
||||
unsigned short port;
|
||||
|
||||
// disk only
|
||||
// disk and network only
|
||||
unsigned int nTime;
|
||||
|
||||
// memory only
|
||||
@@ -153,11 +150,11 @@ public:
|
||||
Init();
|
||||
}
|
||||
|
||||
CAddress(unsigned int ipIn, unsigned short portIn=DEFAULT_PORT, uint64 nServicesIn=NODE_NETWORK)
|
||||
CAddress(unsigned int ipIn, unsigned short portIn=0, uint64 nServicesIn=NODE_NETWORK)
|
||||
{
|
||||
Init();
|
||||
ip = ipIn;
|
||||
port = portIn;
|
||||
port = (portIn == 0 ? GetDefaultPort() : portIn);
|
||||
nServices = nServicesIn;
|
||||
}
|
||||
|
||||
@@ -188,15 +185,15 @@ public:
|
||||
nServices = NODE_NETWORK;
|
||||
memcpy(pchReserved, pchIPv4, sizeof(pchReserved));
|
||||
ip = INADDR_NONE;
|
||||
port = DEFAULT_PORT;
|
||||
nTime = GetAdjustedTime();
|
||||
port = GetDefaultPort();
|
||||
nTime = 100000000;
|
||||
nLastTry = 0;
|
||||
}
|
||||
|
||||
bool SetAddress(const char* pszIn)
|
||||
{
|
||||
ip = INADDR_NONE;
|
||||
port = DEFAULT_PORT;
|
||||
port = GetDefaultPort();
|
||||
char psz[100];
|
||||
strlcpy(psz, pszIn, sizeof(psz));
|
||||
unsigned int a=0, b=0, c=0, d=0, e=0;
|
||||
@@ -221,11 +218,12 @@ public:
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
if (fRead)
|
||||
const_cast<CAddress*>(this)->Init();
|
||||
if (nType & SER_DISK)
|
||||
{
|
||||
READWRITE(nVersion);
|
||||
if ((nType & SER_DISK) || (nVersion >= 31402 && !(nType & SER_GETHASH)))
|
||||
READWRITE(nTime);
|
||||
}
|
||||
READWRITE(nServices);
|
||||
READWRITE(FLATDATA(pchReserved)); // for IPv6
|
||||
READWRITE(ip);
|
||||
@@ -418,13 +416,13 @@ public:
|
||||
const char* GetCommand() const
|
||||
{
|
||||
if (!IsKnownType())
|
||||
throw std::out_of_range(strprintf("CInv::GetCommand() : type=% unknown type", type));
|
||||
throw std::out_of_range(strprintf("CInv::GetCommand() : type=%d unknown type", type));
|
||||
return ppszTypeName[type];
|
||||
}
|
||||
|
||||
string ToString() const
|
||||
{
|
||||
return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,16).c_str());
|
||||
return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,20).c_str());
|
||||
}
|
||||
|
||||
void print() const
|
||||
@@ -466,7 +464,6 @@ extern CNode* pnodeLocalHost;
|
||||
extern uint64 nLocalHostNonce;
|
||||
extern array<int, 10> vnThreadsRunning;
|
||||
extern SOCKET hListenSocket;
|
||||
extern int64 nThreadSocketHandlerHeartbeat;
|
||||
|
||||
extern vector<CNode*> vNodes;
|
||||
extern CCriticalSection cs_vNodes;
|
||||
@@ -504,6 +501,7 @@ public:
|
||||
unsigned int nMessageStart;
|
||||
CAddress addr;
|
||||
int nVersion;
|
||||
string strSubVer;
|
||||
bool fClient;
|
||||
bool fInbound;
|
||||
bool fNetworkNode;
|
||||
@@ -520,10 +518,11 @@ public:
|
||||
uint256 hashLastGetBlocksEnd;
|
||||
int nStartingHeight;
|
||||
|
||||
// flood
|
||||
// flood relay
|
||||
vector<CAddress> vAddrToSend;
|
||||
set<CAddress> setAddrKnown;
|
||||
bool fGetAddr;
|
||||
set<uint256> setKnown;
|
||||
|
||||
// inventory based relay
|
||||
set<CInv> setInventoryKnown;
|
||||
@@ -557,6 +556,7 @@ public:
|
||||
nMessageStart = -1;
|
||||
addr = addrIn;
|
||||
nVersion = 0;
|
||||
strSubVer = "";
|
||||
fClient = false; // set by version message
|
||||
fInbound = fInboundIn;
|
||||
fNetworkNode = false;
|
||||
@@ -733,13 +733,6 @@ public:
|
||||
AbortMessage();
|
||||
}
|
||||
|
||||
const char* GetMessageCommand() const
|
||||
{
|
||||
if (nHeaderStart == -1)
|
||||
return "";
|
||||
return &vSend[nHeaderStart] + offsetof(CMessageHeader, pchCommand);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
62
noui.h
Normal file
62
noui.h
Normal file
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
typedef void wxWindow;
|
||||
#define wxYES 0x00000002
|
||||
#define wxOK 0x00000004
|
||||
#define wxNO 0x00000008
|
||||
#define wxYES_NO (wxYES|wxNO)
|
||||
#define wxCANCEL 0x00000010
|
||||
#define wxAPPLY 0x00000020
|
||||
#define wxCLOSE 0x00000040
|
||||
#define wxOK_DEFAULT 0x00000000
|
||||
#define wxYES_DEFAULT 0x00000000
|
||||
#define wxNO_DEFAULT 0x00000080
|
||||
#define wxCANCEL_DEFAULT 0x80000000
|
||||
#define wxICON_EXCLAMATION 0x00000100
|
||||
#define wxICON_HAND 0x00000200
|
||||
#define wxICON_WARNING wxICON_EXCLAMATION
|
||||
#define wxICON_ERROR wxICON_HAND
|
||||
#define wxICON_QUESTION 0x00000400
|
||||
#define wxICON_INFORMATION 0x00000800
|
||||
#define wxICON_STOP wxICON_HAND
|
||||
#define wxICON_ASTERISK wxICON_INFORMATION
|
||||
#define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800)
|
||||
#define wxFORWARD 0x00001000
|
||||
#define wxBACKWARD 0x00002000
|
||||
#define wxRESET 0x00004000
|
||||
#define wxHELP 0x00008000
|
||||
#define wxMORE 0x00010000
|
||||
#define wxSETUP 0x00020000
|
||||
|
||||
inline int MyMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1)
|
||||
{
|
||||
printf("%s: %s\n", caption.c_str(), message.c_str());
|
||||
fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str());
|
||||
return 4;
|
||||
}
|
||||
#define wxMessageBox MyMessageBox
|
||||
|
||||
inline int ThreadSafeMessageBox(const string& message, const string& caption, int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1)
|
||||
{
|
||||
return MyMessageBox(message, caption, style, parent, x, y);
|
||||
}
|
||||
|
||||
inline bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void CalledSetStatusBar(const string& strText, int nField)
|
||||
{
|
||||
}
|
||||
|
||||
inline void UIThreadCall(boost::function0<void> fn)
|
||||
{
|
||||
}
|
||||
|
||||
inline void MainFrameRepaint()
|
||||
{
|
||||
}
|
||||
2
obj/.gitignore
vendored
Normal file
2
obj/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
2
obj/nogui/.gitignore
vendored
Normal file
2
obj/nogui/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
1518
script.cpp
1518
script.cpp
File diff suppressed because it is too large
Load Diff
221
script.h
221
script.h
@@ -136,18 +136,25 @@ enum opcodetype
|
||||
OP_CHECKMULTISIG,
|
||||
OP_CHECKMULTISIGVERIFY,
|
||||
|
||||
// expansion
|
||||
OP_NOP1,
|
||||
OP_NOP2,
|
||||
OP_NOP3,
|
||||
OP_NOP4,
|
||||
OP_NOP5,
|
||||
OP_NOP6,
|
||||
OP_NOP7,
|
||||
OP_NOP8,
|
||||
OP_NOP9,
|
||||
OP_NOP10,
|
||||
|
||||
|
||||
// multi-byte opcodes
|
||||
OP_SINGLEBYTE_END = 0xF0,
|
||||
OP_DOUBLEBYTE_BEGIN = 0xF000,
|
||||
|
||||
// template matching params
|
||||
OP_PUBKEY,
|
||||
OP_PUBKEYHASH,
|
||||
OP_PUBKEYHASH = 0xfd,
|
||||
OP_PUBKEY = 0xfe,
|
||||
|
||||
|
||||
|
||||
OP_INVALIDOPCODE = 0xFFFF,
|
||||
OP_INVALIDOPCODE = 0xff,
|
||||
};
|
||||
|
||||
|
||||
@@ -276,19 +283,27 @@ inline const char* GetOpName(opcodetype opcode)
|
||||
case OP_CHECKMULTISIG : return "OP_CHECKMULTISIG";
|
||||
case OP_CHECKMULTISIGVERIFY : return "OP_CHECKMULTISIGVERIFY";
|
||||
|
||||
// expanson
|
||||
case OP_NOP1 : return "OP_NOP1";
|
||||
case OP_NOP2 : return "OP_NOP2";
|
||||
case OP_NOP3 : return "OP_NOP3";
|
||||
case OP_NOP4 : return "OP_NOP4";
|
||||
case OP_NOP5 : return "OP_NOP5";
|
||||
case OP_NOP6 : return "OP_NOP6";
|
||||
case OP_NOP7 : return "OP_NOP7";
|
||||
case OP_NOP8 : return "OP_NOP8";
|
||||
case OP_NOP9 : return "OP_NOP9";
|
||||
case OP_NOP10 : return "OP_NOP10";
|
||||
|
||||
|
||||
// multi-byte opcodes
|
||||
case OP_SINGLEBYTE_END : return "OP_SINGLEBYTE_END";
|
||||
case OP_DOUBLEBYTE_BEGIN : return "OP_DOUBLEBYTE_BEGIN";
|
||||
case OP_PUBKEY : return "OP_PUBKEY";
|
||||
|
||||
// template matching params
|
||||
case OP_PUBKEYHASH : return "OP_PUBKEYHASH";
|
||||
|
||||
|
||||
case OP_PUBKEY : return "OP_PUBKEY";
|
||||
|
||||
case OP_INVALIDOPCODE : return "OP_INVALIDOPCODE";
|
||||
default:
|
||||
return "UNKNOWN_OPCODE";
|
||||
return "OP_UNKNOWN";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -300,8 +315,7 @@ inline string ValueString(const vector<unsigned char>& vch)
|
||||
if (vch.size() <= 4)
|
||||
return strprintf("%d", CBigNum(vch).getint());
|
||||
else
|
||||
return HexNumStr(vch.begin(), vch.end());
|
||||
//return string("(") + HexStr(vch.begin(), vch.end()) + string(")");
|
||||
return HexStr(vch);
|
||||
}
|
||||
|
||||
inline string StackString(const vector<vector<unsigned char> >& vStack)
|
||||
@@ -338,12 +352,12 @@ protected:
|
||||
CBigNum bn(n);
|
||||
*this << bn.getvch();
|
||||
}
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& push_uint64(uint64 n)
|
||||
{
|
||||
if (n == -1 || (n >= 1 && n <= 16))
|
||||
if (n >= 1 && n <= 16)
|
||||
{
|
||||
push_back(n + (OP_1 - 1));
|
||||
}
|
||||
@@ -352,7 +366,7 @@ protected:
|
||||
CBigNum bn(n);
|
||||
*this << bn.getvch();
|
||||
}
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -373,7 +387,7 @@ public:
|
||||
{
|
||||
CScript ret = a;
|
||||
ret += b;
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -394,50 +408,43 @@ public:
|
||||
explicit CScript(const vector<unsigned char>& b) { operator<<(b); }
|
||||
|
||||
|
||||
CScript& operator<<(char b) { return (push_int64(b)); }
|
||||
CScript& operator<<(short b) { return (push_int64(b)); }
|
||||
CScript& operator<<(int b) { return (push_int64(b)); }
|
||||
CScript& operator<<(long b) { return (push_int64(b)); }
|
||||
CScript& operator<<(int64 b) { return (push_int64(b)); }
|
||||
CScript& operator<<(unsigned char b) { return (push_uint64(b)); }
|
||||
CScript& operator<<(unsigned int b) { return (push_uint64(b)); }
|
||||
CScript& operator<<(unsigned short b) { return (push_uint64(b)); }
|
||||
CScript& operator<<(unsigned long b) { return (push_uint64(b)); }
|
||||
CScript& operator<<(uint64 b) { return (push_uint64(b)); }
|
||||
CScript& operator<<(char b) { return push_int64(b); }
|
||||
CScript& operator<<(short b) { return push_int64(b); }
|
||||
CScript& operator<<(int b) { return push_int64(b); }
|
||||
CScript& operator<<(long b) { return push_int64(b); }
|
||||
CScript& operator<<(int64 b) { return push_int64(b); }
|
||||
CScript& operator<<(unsigned char b) { return push_uint64(b); }
|
||||
CScript& operator<<(unsigned int b) { return push_uint64(b); }
|
||||
CScript& operator<<(unsigned short b) { return push_uint64(b); }
|
||||
CScript& operator<<(unsigned long b) { return push_uint64(b); }
|
||||
CScript& operator<<(uint64 b) { return push_uint64(b); }
|
||||
|
||||
CScript& operator<<(opcodetype opcode)
|
||||
{
|
||||
if (opcode <= OP_SINGLEBYTE_END)
|
||||
{
|
||||
insert(end(), (unsigned char)opcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(opcode >= OP_DOUBLEBYTE_BEGIN);
|
||||
insert(end(), (unsigned char)(opcode >> 8));
|
||||
insert(end(), (unsigned char)(opcode & 0xFF));
|
||||
}
|
||||
return (*this);
|
||||
if (opcode < 0 || opcode > 0xff)
|
||||
throw runtime_error("CScript::operator<<() : invalid opcode");
|
||||
insert(end(), (unsigned char)opcode);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& operator<<(const uint160& b)
|
||||
{
|
||||
insert(end(), sizeof(b));
|
||||
insert(end(), (unsigned char*)&b, (unsigned char*)&b + sizeof(b));
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& operator<<(const uint256& b)
|
||||
{
|
||||
insert(end(), sizeof(b));
|
||||
insert(end(), (unsigned char*)&b, (unsigned char*)&b + sizeof(b));
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& operator<<(const CBigNum& b)
|
||||
{
|
||||
*this << b.getvch();
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& operator<<(const vector<unsigned char>& b)
|
||||
@@ -451,14 +458,20 @@ public:
|
||||
insert(end(), OP_PUSHDATA1);
|
||||
insert(end(), (unsigned char)b.size());
|
||||
}
|
||||
else
|
||||
else if (b.size() <= 0xffff)
|
||||
{
|
||||
insert(end(), OP_PUSHDATA2);
|
||||
unsigned short nSize = b.size();
|
||||
insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
insert(end(), OP_PUSHDATA4);
|
||||
unsigned int nSize = b.size();
|
||||
insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
|
||||
}
|
||||
insert(end(), b.begin(), b.end());
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& operator<<(const CScript& b)
|
||||
@@ -466,7 +479,7 @@ public:
|
||||
// I'm not sure if this should push the script or concatenate scripts.
|
||||
// If there's ever a use for pushing a script onto a script, delete this member fn
|
||||
assert(("warning: pushing a CScript onto a CScript with << is probably not intended, use + to concatenate", false));
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -474,41 +487,59 @@ public:
|
||||
{
|
||||
// Wrapper so it can be called with either iterator or const_iterator
|
||||
const_iterator pc2 = pc;
|
||||
bool fRet = GetOp(pc2, opcodeRet, vchRet);
|
||||
bool fRet = GetOp2(pc2, opcodeRet, &vchRet);
|
||||
pc = begin() + (pc2 - begin());
|
||||
return fRet;
|
||||
}
|
||||
|
||||
bool GetOp(iterator& pc, opcodetype& opcodeRet)
|
||||
{
|
||||
const_iterator pc2 = pc;
|
||||
bool fRet = GetOp2(pc2, opcodeRet, NULL);
|
||||
pc = begin() + (pc2 - begin());
|
||||
return fRet;
|
||||
}
|
||||
|
||||
bool GetOp(const_iterator& pc, opcodetype& opcodeRet, vector<unsigned char>& vchRet) const
|
||||
{
|
||||
return GetOp2(pc, opcodeRet, &vchRet);
|
||||
}
|
||||
|
||||
bool GetOp(const_iterator& pc, opcodetype& opcodeRet) const
|
||||
{
|
||||
return GetOp2(pc, opcodeRet, NULL);
|
||||
}
|
||||
|
||||
bool GetOp2(const_iterator& pc, opcodetype& opcodeRet, vector<unsigned char>* pvchRet) const
|
||||
{
|
||||
opcodeRet = OP_INVALIDOPCODE;
|
||||
vchRet.clear();
|
||||
if (pvchRet)
|
||||
pvchRet->clear();
|
||||
if (pc >= end())
|
||||
return false;
|
||||
|
||||
// Read instruction
|
||||
if (end() - pc < 1)
|
||||
return false;
|
||||
unsigned int opcode = *pc++;
|
||||
if (opcode >= OP_SINGLEBYTE_END)
|
||||
{
|
||||
if (pc + 1 > end())
|
||||
return false;
|
||||
opcode <<= 8;
|
||||
opcode |= *pc++;
|
||||
}
|
||||
|
||||
// Immediate operand
|
||||
if (opcode <= OP_PUSHDATA4)
|
||||
{
|
||||
unsigned int nSize = opcode;
|
||||
if (opcode == OP_PUSHDATA1)
|
||||
unsigned int nSize;
|
||||
if (opcode < OP_PUSHDATA1)
|
||||
{
|
||||
if (pc + 1 > end())
|
||||
nSize = opcode;
|
||||
}
|
||||
else if (opcode == OP_PUSHDATA1)
|
||||
{
|
||||
if (end() - pc < 1)
|
||||
return false;
|
||||
nSize = *pc++;
|
||||
}
|
||||
else if (opcode == OP_PUSHDATA2)
|
||||
{
|
||||
if (pc + 2 > end())
|
||||
if (end() - pc < 2)
|
||||
return false;
|
||||
nSize = 0;
|
||||
memcpy(&nSize, &pc[0], 2);
|
||||
@@ -516,14 +547,15 @@ public:
|
||||
}
|
||||
else if (opcode == OP_PUSHDATA4)
|
||||
{
|
||||
if (pc + 4 > end())
|
||||
if (end() - pc < 4)
|
||||
return false;
|
||||
memcpy(&nSize, &pc[0], 4);
|
||||
pc += 4;
|
||||
}
|
||||
if (pc + nSize > end())
|
||||
if (end() - pc < nSize)
|
||||
return false;
|
||||
vchRet.assign(pc, pc + nSize);
|
||||
if (pvchRet)
|
||||
pvchRet->assign(pc, pc + nSize);
|
||||
pc += nSize;
|
||||
}
|
||||
|
||||
@@ -534,20 +566,51 @@ public:
|
||||
|
||||
void FindAndDelete(const CScript& b)
|
||||
{
|
||||
if (b.empty())
|
||||
return;
|
||||
iterator pc = begin();
|
||||
opcodetype opcode;
|
||||
vector<unsigned char> vchPushValue;
|
||||
int count = 0;
|
||||
do
|
||||
{
|
||||
while (end() - pc >= b.size() && memcmp(&pc[0], &b[0], b.size()) == 0)
|
||||
{
|
||||
erase(pc, pc + b.size());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
while (GetOp(pc, opcode, vchPushValue));
|
||||
//printf("FindAndDeleted deleted %d items\n", count); /// debug
|
||||
while (GetOp(pc, opcode));
|
||||
}
|
||||
|
||||
|
||||
int GetSigOpCount() const
|
||||
{
|
||||
int n = 0;
|
||||
const_iterator pc = begin();
|
||||
while (pc < end())
|
||||
{
|
||||
opcodetype opcode;
|
||||
if (!GetOp(pc, opcode))
|
||||
break;
|
||||
if (opcode == OP_CHECKSIG || opcode == OP_CHECKSIGVERIFY)
|
||||
n++;
|
||||
else if (opcode == OP_CHECKMULTISIG || opcode == OP_CHECKMULTISIGVERIFY)
|
||||
n += 20;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
bool IsPushOnly() const
|
||||
{
|
||||
if (size() > 200)
|
||||
return false;
|
||||
const_iterator pc = begin();
|
||||
while (pc < end())
|
||||
{
|
||||
opcodetype opcode;
|
||||
if (!GetOp(pc, opcode))
|
||||
return false;
|
||||
if (opcode > OP_16)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -598,7 +661,7 @@ public:
|
||||
|
||||
void PrintHex() const
|
||||
{
|
||||
printf("CScript(%s)\n", HexStr(begin(), end()).c_str());
|
||||
printf("CScript(%s)\n", HexStr(begin(), end(), true).c_str());
|
||||
}
|
||||
|
||||
string ToString() const
|
||||
@@ -606,12 +669,17 @@ public:
|
||||
string str;
|
||||
opcodetype opcode;
|
||||
vector<unsigned char> vch;
|
||||
const_iterator it = begin();
|
||||
while (GetOp(it, opcode, vch))
|
||||
const_iterator pc = begin();
|
||||
while (pc < end())
|
||||
{
|
||||
if (!str.empty())
|
||||
str += " ";
|
||||
if (opcode <= OP_PUSHDATA4)
|
||||
if (!GetOp(pc, opcode, vch))
|
||||
{
|
||||
str += "[error]";
|
||||
return str;
|
||||
}
|
||||
if (0 <= opcode && opcode <= OP_PUSHDATA4)
|
||||
str += ValueString(vch);
|
||||
else
|
||||
str += GetOpName(opcode);
|
||||
@@ -632,9 +700,8 @@ public:
|
||||
|
||||
|
||||
|
||||
bool EvalScript(const CScript& script, const CTransaction& txTo, unsigned int nIn, int nHashType=0,
|
||||
vector<vector<unsigned char> >* pvStackRet=NULL);
|
||||
uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType);
|
||||
bool IsStandard(const CScript& scriptPubKey);
|
||||
bool IsMine(const CScript& scriptPubKey);
|
||||
bool ExtractPubKey(const CScript& scriptPubKey, bool fMineOnly, vector<unsigned char>& vchPubKeyRet);
|
||||
bool ExtractHash160(const CScript& scriptPubKey, uint160& hash160Ret);
|
||||
|
||||
140
serialize.h
140
serialize.h
@@ -2,9 +2,14 @@
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <boost/type_traits/is_fundamental.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <boost/tuple/tuple_io.hpp>
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
@@ -18,9 +23,12 @@ typedef unsigned long long uint64;
|
||||
class CScript;
|
||||
class CDataStream;
|
||||
class CAutoFile;
|
||||
static const unsigned int MAX_SIZE = 0x02000000;
|
||||
|
||||
static const int VERSION = 302;
|
||||
static const int VERSION = 32001;
|
||||
static const char* pszSubVer = "";
|
||||
static const bool VERSION_IS_BETA = true;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -152,7 +160,7 @@ template<typename Stream> inline void Unserialize(Stream& s, bool& a, int, int=0
|
||||
//
|
||||
inline unsigned int GetSizeOfCompactSize(uint64 nSize)
|
||||
{
|
||||
if (nSize < UCHAR_MAX-2) return sizeof(unsigned char);
|
||||
if (nSize < 253) return sizeof(unsigned char);
|
||||
else if (nSize <= USHRT_MAX) return sizeof(unsigned char) + sizeof(unsigned short);
|
||||
else if (nSize <= UINT_MAX) return sizeof(unsigned char) + sizeof(unsigned int);
|
||||
else return sizeof(unsigned char) + sizeof(uint64);
|
||||
@@ -161,30 +169,31 @@ inline unsigned int GetSizeOfCompactSize(uint64 nSize)
|
||||
template<typename Stream>
|
||||
void WriteCompactSize(Stream& os, uint64 nSize)
|
||||
{
|
||||
if (nSize < UCHAR_MAX-2)
|
||||
if (nSize < 253)
|
||||
{
|
||||
unsigned char chSize = nSize;
|
||||
WRITEDATA(os, chSize);
|
||||
}
|
||||
else if (nSize <= USHRT_MAX)
|
||||
{
|
||||
unsigned char chSize = UCHAR_MAX-2;
|
||||
unsigned char chSize = 253;
|
||||
unsigned short xSize = nSize;
|
||||
WRITEDATA(os, chSize);
|
||||
WRITEDATA(os, xSize);
|
||||
}
|
||||
else if (nSize <= UINT_MAX)
|
||||
{
|
||||
unsigned char chSize = UCHAR_MAX-1;
|
||||
unsigned char chSize = 254;
|
||||
unsigned int xSize = nSize;
|
||||
WRITEDATA(os, chSize);
|
||||
WRITEDATA(os, xSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char chSize = UCHAR_MAX;
|
||||
unsigned char chSize = 255;
|
||||
uint64 xSize = nSize;
|
||||
WRITEDATA(os, chSize);
|
||||
WRITEDATA(os, nSize);
|
||||
WRITEDATA(os, xSize);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -195,29 +204,29 @@ uint64 ReadCompactSize(Stream& is)
|
||||
unsigned char chSize;
|
||||
READDATA(is, chSize);
|
||||
uint64 nSizeRet = 0;
|
||||
if (chSize < UCHAR_MAX-2)
|
||||
if (chSize < 253)
|
||||
{
|
||||
nSizeRet = chSize;
|
||||
}
|
||||
else if (chSize == UCHAR_MAX-2)
|
||||
else if (chSize == 253)
|
||||
{
|
||||
unsigned short nSize;
|
||||
READDATA(is, nSize);
|
||||
nSizeRet = nSize;
|
||||
unsigned short xSize;
|
||||
READDATA(is, xSize);
|
||||
nSizeRet = xSize;
|
||||
}
|
||||
else if (chSize == UCHAR_MAX-1)
|
||||
else if (chSize == 254)
|
||||
{
|
||||
unsigned int nSize;
|
||||
READDATA(is, nSize);
|
||||
nSizeRet = nSize;
|
||||
unsigned int xSize;
|
||||
READDATA(is, xSize);
|
||||
nSizeRet = xSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64 nSize;
|
||||
READDATA(is, nSize);
|
||||
nSizeRet = nSize;
|
||||
uint64 xSize;
|
||||
READDATA(is, xSize);
|
||||
nSizeRet = xSize;
|
||||
}
|
||||
if (nSizeRet > (uint64)INT_MAX)
|
||||
if (nSizeRet > (uint64)MAX_SIZE)
|
||||
throw std::ios_base::failure("ReadCompactSize() : size too large");
|
||||
return nSizeRet;
|
||||
}
|
||||
@@ -333,6 +342,16 @@ template<typename K, typename T> unsigned int GetSerializeSize(const std::pair<K
|
||||
template<typename Stream, typename K, typename T> void Serialize(Stream& os, const std::pair<K, T>& item, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename K, typename T> void Unserialize(Stream& is, std::pair<K, T>& item, int nType, int nVersion=VERSION);
|
||||
|
||||
// 3 tuple
|
||||
template<typename T0, typename T1, typename T2> unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2>& item, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename T0, typename T1, typename T2> void Serialize(Stream& os, const boost::tuple<T0, T1, T2>& item, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename T0, typename T1, typename T2> void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVersion=VERSION);
|
||||
|
||||
// 4 tuple
|
||||
template<typename T0, typename T1, typename T2, typename T3> unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Serialize(Stream& os, const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Unserialize(Stream& is, boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion=VERSION);
|
||||
|
||||
// map
|
||||
template<typename K, typename T, typename Pred, typename A> unsigned int GetSerializeSize(const std::map<K, T, Pred, A>& m, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename K, typename T, typename Pred, typename A> void Serialize(Stream& os, const std::map<K, T, Pred, A>& m, int nType, int nVersion=VERSION);
|
||||
@@ -549,6 +568,71 @@ void Unserialize(Stream& is, std::pair<K, T>& item, int nType, int nVersion)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// 3 tuple
|
||||
//
|
||||
template<typename T0, typename T1, typename T2>
|
||||
unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
{
|
||||
unsigned int nSize = 0;
|
||||
nSize += GetSerializeSize(get<0>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(get<1>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(get<2>(item), nType, nVersion);
|
||||
return nSize;
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2>
|
||||
void Serialize(Stream& os, const boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
{
|
||||
Serialize(os, get<0>(item), nType, nVersion);
|
||||
Serialize(os, get<1>(item), nType, nVersion);
|
||||
Serialize(os, get<2>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2>
|
||||
void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
{
|
||||
Unserialize(is, get<0>(item), nType, nVersion);
|
||||
Unserialize(is, get<1>(item), nType, nVersion);
|
||||
Unserialize(is, get<2>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// 4 tuple
|
||||
//
|
||||
template<typename T0, typename T1, typename T2, typename T3>
|
||||
unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
{
|
||||
unsigned int nSize = 0;
|
||||
nSize += GetSerializeSize(get<0>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(get<1>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(get<2>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(get<3>(item), nType, nVersion);
|
||||
return nSize;
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3>
|
||||
void Serialize(Stream& os, const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
{
|
||||
Serialize(os, get<0>(item), nType, nVersion);
|
||||
Serialize(os, get<1>(item), nType, nVersion);
|
||||
Serialize(os, get<2>(item), nType, nVersion);
|
||||
Serialize(os, get<3>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3>
|
||||
void Unserialize(Stream& is, boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
{
|
||||
Unserialize(is, get<0>(item), nType, nVersion);
|
||||
Unserialize(is, get<1>(item), nType, nVersion);
|
||||
Unserialize(is, get<2>(item), nType, nVersion);
|
||||
Unserialize(is, get<3>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// map
|
||||
//
|
||||
@@ -679,6 +763,8 @@ struct secure_allocator : public std::allocator<T>
|
||||
typedef typename base::value_type value_type;
|
||||
secure_allocator() throw() {}
|
||||
secure_allocator(const secure_allocator& a) throw() : base(a) {}
|
||||
template <typename U>
|
||||
secure_allocator(const secure_allocator<U>& a) throw() : base(a) {}
|
||||
~secure_allocator() throw() {}
|
||||
template<typename _Other> struct rebind
|
||||
{ typedef secure_allocator<_Other> other; };
|
||||
@@ -720,39 +806,39 @@ public:
|
||||
typedef vector_type::const_iterator const_iterator;
|
||||
typedef vector_type::reverse_iterator reverse_iterator;
|
||||
|
||||
explicit CDataStream(int nTypeIn=0, int nVersionIn=VERSION)
|
||||
explicit CDataStream(int nTypeIn=SER_NETWORK, int nVersionIn=VERSION)
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
|
||||
CDataStream(const_iterator pbegin, const_iterator pend, int nTypeIn=0, int nVersionIn=VERSION) : vch(pbegin, pend)
|
||||
CDataStream(const_iterator pbegin, const_iterator pend, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(pbegin, pend)
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1300
|
||||
CDataStream(const char* pbegin, const char* pend, int nTypeIn=0, int nVersionIn=VERSION) : vch(pbegin, pend)
|
||||
CDataStream(const char* pbegin, const char* pend, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(pbegin, pend)
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
#endif
|
||||
|
||||
CDataStream(const vector_type& vchIn, int nTypeIn=0, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end())
|
||||
CDataStream(const vector_type& vchIn, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end())
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
|
||||
CDataStream(const vector<char>& vchIn, int nTypeIn=0, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end())
|
||||
CDataStream(const vector<char>& vchIn, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end())
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
|
||||
CDataStream(const vector<unsigned char>& vchIn, int nTypeIn=0, int nVersionIn=VERSION) : vch((char*)&vchIn.begin()[0], (char*)&vchIn.end()[0])
|
||||
CDataStream(const vector<unsigned char>& vchIn, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch((char*)&vchIn.begin()[0], (char*)&vchIn.end()[0])
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
|
||||
void Init(int nTypeIn=0, int nVersionIn=VERSION)
|
||||
void Init(int nTypeIn=SER_NETWORK, int nVersionIn=VERSION)
|
||||
{
|
||||
nReadPos = 0;
|
||||
nType = nTypeIn;
|
||||
|
||||
307
setup.nsi
307
setup.nsi
@@ -1,156 +1,151 @@
|
||||
# Auto-generated by EclipseNSIS Script Wizard
|
||||
# 3.10.2009 19:00:28
|
||||
|
||||
Name Bitcoin
|
||||
|
||||
RequestExecutionLevel highest
|
||||
|
||||
# General Symbol Definitions
|
||||
!define REGKEY "SOFTWARE\$(^Name)"
|
||||
!define VERSION 0.3.2
|
||||
!define COMPANY "Bitcoin project"
|
||||
!define URL http://www.bitcoin.org/
|
||||
|
||||
# MUI Symbol Definitions
|
||||
!define MUI_ICON "src\rc\bitcoin.ico"
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
|
||||
!define MUI_STARTMENUPAGE_DEFAULTFOLDER Bitcoin
|
||||
!define MUI_FINISHPAGE_RUN $INSTDIR\bitcoin.exe
|
||||
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
|
||||
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
|
||||
|
||||
# Included files
|
||||
!include Sections.nsh
|
||||
!include MUI2.nsh
|
||||
|
||||
# Variables
|
||||
Var StartMenuGroup
|
||||
|
||||
# Installer pages
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
# Installer languages
|
||||
!insertmacro MUI_LANGUAGE English
|
||||
|
||||
# Installer attributes
|
||||
OutFile bitcoin-0.3.2-win32-setup.exe
|
||||
InstallDir $PROGRAMFILES\Bitcoin
|
||||
CRCCheck on
|
||||
XPStyle on
|
||||
ShowInstDetails show
|
||||
VIProductVersion 0.3.2.0
|
||||
VIAddVersionKey ProductName Bitcoin
|
||||
VIAddVersionKey ProductVersion "${VERSION}"
|
||||
VIAddVersionKey CompanyName "${COMPANY}"
|
||||
VIAddVersionKey CompanyWebsite "${URL}"
|
||||
VIAddVersionKey FileVersion "${VERSION}"
|
||||
VIAddVersionKey FileDescription ""
|
||||
VIAddVersionKey LegalCopyright ""
|
||||
InstallDirRegKey HKCU "${REGKEY}" Path
|
||||
ShowUninstDetails show
|
||||
|
||||
# Installer sections
|
||||
Section -Main SEC0000
|
||||
SetOutPath $INSTDIR
|
||||
SetOverwrite on
|
||||
File bitcoin.exe
|
||||
File libeay32.dll
|
||||
File mingwm10.dll
|
||||
File license.txt
|
||||
File readme.txt
|
||||
SetOutPath $INSTDIR\daemon
|
||||
File /r daemon\*.*
|
||||
SetOutPath $INSTDIR\locale
|
||||
File /r locale\*.*
|
||||
SetOutPath $INSTDIR\src
|
||||
File /r src\*.*
|
||||
SetOutPath $INSTDIR
|
||||
WriteRegStr HKCU "${REGKEY}\Components" Main 1
|
||||
SectionEnd
|
||||
|
||||
Section -post SEC0001
|
||||
WriteRegStr HKCU "${REGKEY}" Path $INSTDIR
|
||||
SetOutPath $INSTDIR
|
||||
WriteUninstaller $INSTDIR\uninstall.exe
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
CreateDirectory $SMPROGRAMS\$StartMenuGroup
|
||||
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" $INSTDIR\bitcoin.exe
|
||||
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" $INSTDIR\uninstall.exe
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
|
||||
WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
|
||||
WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
|
||||
SectionEnd
|
||||
|
||||
# Macro for selecting uninstaller sections
|
||||
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
|
||||
Push $R0
|
||||
ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}"
|
||||
StrCmp $R0 1 0 next${UNSECTION_ID}
|
||||
!insertmacro SelectSection "${UNSECTION_ID}"
|
||||
GoTo done${UNSECTION_ID}
|
||||
next${UNSECTION_ID}:
|
||||
!insertmacro UnselectSection "${UNSECTION_ID}"
|
||||
done${UNSECTION_ID}:
|
||||
Pop $R0
|
||||
!macroend
|
||||
|
||||
# Uninstaller sections
|
||||
Section /o -un.Main UNSEC0000
|
||||
Delete /REBOOTOK $INSTDIR\bitcoin.exe
|
||||
Delete /REBOOTOK $INSTDIR\libeay32.dll
|
||||
Delete /REBOOTOK $INSTDIR\mingwm10.dll
|
||||
Delete /REBOOTOK $INSTDIR\license.txt
|
||||
Delete /REBOOTOK $INSTDIR\readme.txt
|
||||
RMDir /r /REBOOTOK $INSTDIR\daemon
|
||||
RMDir /r /REBOOTOK $INSTDIR\locale
|
||||
RMDir /r /REBOOTOK $INSTDIR\src
|
||||
DeleteRegValue HKCU "${REGKEY}\Components" Main
|
||||
SectionEnd
|
||||
|
||||
Section -un.post UNSEC0001
|
||||
DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
|
||||
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk"
|
||||
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk"
|
||||
Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk"
|
||||
Delete /REBOOTOK $INSTDIR\uninstall.exe
|
||||
Delete /REBOOTOK $INSTDIR\debug.log
|
||||
Delete /REBOOTOK $INSTDIR\db.log
|
||||
DeleteRegValue HKCU "${REGKEY}" StartMenuGroup
|
||||
DeleteRegValue HKCU "${REGKEY}" Path
|
||||
DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components"
|
||||
DeleteRegKey /IfEmpty HKCU "${REGKEY}"
|
||||
RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
|
||||
RmDir /REBOOTOK $INSTDIR
|
||||
Push $R0
|
||||
StrCpy $R0 $StartMenuGroup 1
|
||||
StrCmp $R0 ">" no_smgroup
|
||||
no_smgroup:
|
||||
Pop $R0
|
||||
SectionEnd
|
||||
|
||||
# Installer functions
|
||||
Function .onInit
|
||||
InitPluginsDir
|
||||
FunctionEnd
|
||||
|
||||
# Uninstaller functions
|
||||
Function un.onInit
|
||||
ReadRegStr $INSTDIR HKCU "${REGKEY}" Path
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
|
||||
!insertmacro SELECT_UNSECTION Main ${UNSEC0000}
|
||||
FunctionEnd
|
||||
Name Bitcoin
|
||||
|
||||
RequestExecutionLevel highest
|
||||
|
||||
# General Symbol Definitions
|
||||
!define REGKEY "SOFTWARE\$(^Name)"
|
||||
!define VERSION 0.3.20
|
||||
!define COMPANY "Bitcoin project"
|
||||
!define URL http://www.bitcoin.org/
|
||||
|
||||
# MUI Symbol Definitions
|
||||
!define MUI_ICON "src\rc\bitcoin.ico"
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
|
||||
!define MUI_STARTMENUPAGE_DEFAULTFOLDER Bitcoin
|
||||
!define MUI_FINISHPAGE_RUN $INSTDIR\bitcoin.exe
|
||||
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
|
||||
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
|
||||
|
||||
# Included files
|
||||
!include Sections.nsh
|
||||
!include MUI2.nsh
|
||||
|
||||
# Variables
|
||||
Var StartMenuGroup
|
||||
|
||||
# Installer pages
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
# Installer languages
|
||||
!insertmacro MUI_LANGUAGE English
|
||||
|
||||
# Installer attributes
|
||||
OutFile bitcoin-0.3.20-win32-setup.exe
|
||||
InstallDir $PROGRAMFILES\Bitcoin
|
||||
CRCCheck on
|
||||
XPStyle on
|
||||
ShowInstDetails show
|
||||
VIProductVersion 0.3.20.0
|
||||
VIAddVersionKey ProductName Bitcoin
|
||||
VIAddVersionKey ProductVersion "${VERSION}"
|
||||
VIAddVersionKey CompanyName "${COMPANY}"
|
||||
VIAddVersionKey CompanyWebsite "${URL}"
|
||||
VIAddVersionKey FileVersion "${VERSION}"
|
||||
VIAddVersionKey FileDescription ""
|
||||
VIAddVersionKey LegalCopyright ""
|
||||
InstallDirRegKey HKCU "${REGKEY}" Path
|
||||
ShowUninstDetails show
|
||||
|
||||
# Installer sections
|
||||
Section -Main SEC0000
|
||||
SetOutPath $INSTDIR
|
||||
SetOverwrite on
|
||||
File bitcoin.exe
|
||||
File libeay32.dll
|
||||
File license.txt
|
||||
File readme.txt
|
||||
SetOutPath $INSTDIR\daemon
|
||||
File /r daemon\*.*
|
||||
SetOutPath $INSTDIR\locale
|
||||
File /r locale\*.*
|
||||
SetOutPath $INSTDIR\src
|
||||
File /r src\*.*
|
||||
SetOutPath $INSTDIR
|
||||
WriteRegStr HKCU "${REGKEY}\Components" Main 1
|
||||
SectionEnd
|
||||
|
||||
Section -post SEC0001
|
||||
WriteRegStr HKCU "${REGKEY}" Path $INSTDIR
|
||||
SetOutPath $INSTDIR
|
||||
WriteUninstaller $INSTDIR\uninstall.exe
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
CreateDirectory $SMPROGRAMS\$StartMenuGroup
|
||||
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" $INSTDIR\bitcoin.exe
|
||||
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" $INSTDIR\uninstall.exe
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
|
||||
WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
|
||||
WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
|
||||
SectionEnd
|
||||
|
||||
# Macro for selecting uninstaller sections
|
||||
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
|
||||
Push $R0
|
||||
ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}"
|
||||
StrCmp $R0 1 0 next${UNSECTION_ID}
|
||||
!insertmacro SelectSection "${UNSECTION_ID}"
|
||||
GoTo done${UNSECTION_ID}
|
||||
next${UNSECTION_ID}:
|
||||
!insertmacro UnselectSection "${UNSECTION_ID}"
|
||||
done${UNSECTION_ID}:
|
||||
Pop $R0
|
||||
!macroend
|
||||
|
||||
# Uninstaller sections
|
||||
Section /o -un.Main UNSEC0000
|
||||
Delete /REBOOTOK $INSTDIR\bitcoin.exe
|
||||
Delete /REBOOTOK $INSTDIR\libeay32.dll
|
||||
Delete /REBOOTOK $INSTDIR\license.txt
|
||||
Delete /REBOOTOK $INSTDIR\readme.txt
|
||||
RMDir /r /REBOOTOK $INSTDIR\daemon
|
||||
RMDir /r /REBOOTOK $INSTDIR\locale
|
||||
RMDir /r /REBOOTOK $INSTDIR\src
|
||||
DeleteRegValue HKCU "${REGKEY}\Components" Main
|
||||
SectionEnd
|
||||
|
||||
Section -un.post UNSEC0001
|
||||
DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
|
||||
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk"
|
||||
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk"
|
||||
Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk"
|
||||
Delete /REBOOTOK $INSTDIR\uninstall.exe
|
||||
Delete /REBOOTOK $INSTDIR\debug.log
|
||||
Delete /REBOOTOK $INSTDIR\db.log
|
||||
DeleteRegValue HKCU "${REGKEY}" StartMenuGroup
|
||||
DeleteRegValue HKCU "${REGKEY}" Path
|
||||
DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components"
|
||||
DeleteRegKey /IfEmpty HKCU "${REGKEY}"
|
||||
RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
|
||||
RmDir /REBOOTOK $INSTDIR
|
||||
Push $R0
|
||||
StrCpy $R0 $StartMenuGroup 1
|
||||
StrCmp $R0 ">" no_smgroup
|
||||
no_smgroup:
|
||||
Pop $R0
|
||||
SectionEnd
|
||||
|
||||
# Installer functions
|
||||
Function .onInit
|
||||
InitPluginsDir
|
||||
FunctionEnd
|
||||
|
||||
# Uninstaller functions
|
||||
Function un.onInit
|
||||
ReadRegStr $INSTDIR HKCU "${REGKEY}" Path
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
|
||||
!insertmacro SELECT_UNSECTION Main ${UNSEC0000}
|
||||
FunctionEnd
|
||||
|
||||
554
sha.cpp
554
sha.cpp
@@ -1,554 +0,0 @@
|
||||
// This file is public domain
|
||||
// SHA routines extracted as a standalone file from:
|
||||
// Crypto++: a C++ Class Library of Cryptographic Schemes
|
||||
// Version 5.5.2 (9/24/2007)
|
||||
// http://www.cryptopp.com
|
||||
|
||||
// sha.cpp - modified by Wei Dai from Steve Reid's public domain sha1.c
|
||||
|
||||
// Steve Reid implemented SHA-1. Wei Dai implemented SHA-2.
|
||||
// Both are in the public domain.
|
||||
|
||||
#include <assert.h>
|
||||
#include <memory.h>
|
||||
#include "sha.h"
|
||||
|
||||
namespace CryptoPP
|
||||
{
|
||||
|
||||
// start of Steve Reid's code
|
||||
|
||||
#define blk0(i) (W[i] = data[i])
|
||||
#define blk1(i) (W[i&15] = rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1))
|
||||
|
||||
void SHA1::InitState(HashWordType *state)
|
||||
{
|
||||
state[0] = 0x67452301L;
|
||||
state[1] = 0xEFCDAB89L;
|
||||
state[2] = 0x98BADCFEL;
|
||||
state[3] = 0x10325476L;
|
||||
state[4] = 0xC3D2E1F0L;
|
||||
}
|
||||
|
||||
#define f1(x,y,z) (z^(x&(y^z)))
|
||||
#define f2(x,y,z) (x^y^z)
|
||||
#define f3(x,y,z) ((x&y)|(z&(x|y)))
|
||||
#define f4(x,y,z) (x^y^z)
|
||||
|
||||
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
||||
#define R0(v,w,x,y,z,i) z+=f1(w,x,y)+blk0(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R1(v,w,x,y,z,i) z+=f1(w,x,y)+blk1(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R2(v,w,x,y,z,i) z+=f2(w,x,y)+blk1(i)+0x6ED9EBA1+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R3(v,w,x,y,z,i) z+=f3(w,x,y)+blk1(i)+0x8F1BBCDC+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R4(v,w,x,y,z,i) z+=f4(w,x,y)+blk1(i)+0xCA62C1D6+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
|
||||
void SHA1::Transform(word32 *state, const word32 *data)
|
||||
{
|
||||
word32 W[16];
|
||||
/* Copy context->state[] to working vars */
|
||||
word32 a = state[0];
|
||||
word32 b = state[1];
|
||||
word32 c = state[2];
|
||||
word32 d = state[3];
|
||||
word32 e = state[4];
|
||||
/* 4 rounds of 20 operations each. Loop unrolled. */
|
||||
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
|
||||
R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
|
||||
R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
|
||||
R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
|
||||
R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
|
||||
R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
|
||||
R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
|
||||
R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
|
||||
R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
|
||||
R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
|
||||
R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
|
||||
R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
|
||||
R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
|
||||
R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
|
||||
R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
|
||||
R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
|
||||
R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
|
||||
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
|
||||
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
|
||||
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
state[4] += e;
|
||||
}
|
||||
|
||||
// end of Steve Reid's code
|
||||
|
||||
// *************************************************************
|
||||
|
||||
void SHA224::InitState(HashWordType *state)
|
||||
{
|
||||
static const word32 s[8] = {0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
void SHA256::InitState(HashWordType *state)
|
||||
{
|
||||
static const word32 s[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
static const word32 SHA256_K[64] = {
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
||||
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
||||
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
||||
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
|
||||
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
|
||||
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
||||
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
||||
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
|
||||
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
|
||||
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
||||
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
||||
};
|
||||
|
||||
#define blk2(i) (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))
|
||||
|
||||
#define Ch(x,y,z) (z^(x&(y^z)))
|
||||
#define Maj(x,y,z) ((x&y)|(z&(x|y)))
|
||||
|
||||
#define a(i) T[(0-i)&7]
|
||||
#define b(i) T[(1-i)&7]
|
||||
#define c(i) T[(2-i)&7]
|
||||
#define d(i) T[(3-i)&7]
|
||||
#define e(i) T[(4-i)&7]
|
||||
#define f(i) T[(5-i)&7]
|
||||
#define g(i) T[(6-i)&7]
|
||||
#define h(i) T[(7-i)&7]
|
||||
|
||||
#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA256_K[i+j]+(j?blk2(i):blk0(i));\
|
||||
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
|
||||
|
||||
// for SHA256
|
||||
#define S0(x) (rotrFixed(x,2)^rotrFixed(x,13)^rotrFixed(x,22))
|
||||
#define S1(x) (rotrFixed(x,6)^rotrFixed(x,11)^rotrFixed(x,25))
|
||||
#define s0(x) (rotrFixed(x,7)^rotrFixed(x,18)^(x>>3))
|
||||
#define s1(x) (rotrFixed(x,17)^rotrFixed(x,19)^(x>>10))
|
||||
|
||||
void SHA256::Transform(word32 *state, const word32 *data)
|
||||
{
|
||||
word32 W[16];
|
||||
word32 T[8];
|
||||
/* Copy context->state[] to working vars */
|
||||
memcpy(T, state, sizeof(T));
|
||||
/* 64 operations, partially loop unrolled */
|
||||
for (unsigned int j=0; j<64; j+=16)
|
||||
{
|
||||
R( 0); R( 1); R( 2); R( 3);
|
||||
R( 4); R( 5); R( 6); R( 7);
|
||||
R( 8); R( 9); R(10); R(11);
|
||||
R(12); R(13); R(14); R(15);
|
||||
}
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a(0);
|
||||
state[1] += b(0);
|
||||
state[2] += c(0);
|
||||
state[3] += d(0);
|
||||
state[4] += e(0);
|
||||
state[5] += f(0);
|
||||
state[6] += g(0);
|
||||
state[7] += h(0);
|
||||
}
|
||||
|
||||
/*
|
||||
// smaller but slower
|
||||
void SHA256_Transform(word32 *state, const word32 *data)
|
||||
{
|
||||
word32 T[20];
|
||||
word32 W[32];
|
||||
unsigned int i = 0, j = 0;
|
||||
word32 *t = T+8;
|
||||
|
||||
memcpy(t, state, 8*4);
|
||||
word32 e = t[4], a = t[0];
|
||||
|
||||
do
|
||||
{
|
||||
word32 w = data[j];
|
||||
W[j] = w;
|
||||
w += K[j];
|
||||
w += t[7];
|
||||
w += S1(e);
|
||||
w += Ch(e, t[5], t[6]);
|
||||
e = t[3] + w;
|
||||
t[3] = t[3+8] = e;
|
||||
w += S0(t[0]);
|
||||
a = w + Maj(a, t[1], t[2]);
|
||||
t[-1] = t[7] = a;
|
||||
--t;
|
||||
++j;
|
||||
if (j%8 == 0)
|
||||
t += 8;
|
||||
} while (j<16);
|
||||
|
||||
do
|
||||
{
|
||||
i = j&0xf;
|
||||
word32 w = s1(W[i+16-2]) + s0(W[i+16-15]) + W[i] + W[i+16-7];
|
||||
W[i+16] = W[i] = w;
|
||||
w += K[j];
|
||||
w += t[7];
|
||||
w += S1(e);
|
||||
w += Ch(e, t[5], t[6]);
|
||||
e = t[3] + w;
|
||||
t[3] = t[3+8] = e;
|
||||
w += S0(t[0]);
|
||||
a = w + Maj(a, t[1], t[2]);
|
||||
t[-1] = t[7] = a;
|
||||
|
||||
w = s1(W[(i+1)+16-2]) + s0(W[(i+1)+16-15]) + W[(i+1)] + W[(i+1)+16-7];
|
||||
W[(i+1)+16] = W[(i+1)] = w;
|
||||
w += K[j+1];
|
||||
w += (t-1)[7];
|
||||
w += S1(e);
|
||||
w += Ch(e, (t-1)[5], (t-1)[6]);
|
||||
e = (t-1)[3] + w;
|
||||
(t-1)[3] = (t-1)[3+8] = e;
|
||||
w += S0((t-1)[0]);
|
||||
a = w + Maj(a, (t-1)[1], (t-1)[2]);
|
||||
(t-1)[-1] = (t-1)[7] = a;
|
||||
|
||||
t-=2;
|
||||
j+=2;
|
||||
if (j%8 == 0)
|
||||
t += 8;
|
||||
} while (j<64);
|
||||
|
||||
state[0] += a;
|
||||
state[1] += t[1];
|
||||
state[2] += t[2];
|
||||
state[3] += t[3];
|
||||
state[4] += e;
|
||||
state[5] += t[5];
|
||||
state[6] += t[6];
|
||||
state[7] += t[7];
|
||||
}
|
||||
*/
|
||||
|
||||
#undef S0
|
||||
#undef S1
|
||||
#undef s0
|
||||
#undef s1
|
||||
#undef R
|
||||
|
||||
// *************************************************************
|
||||
|
||||
#ifdef WORD64_AVAILABLE
|
||||
|
||||
void SHA384::InitState(HashWordType *state)
|
||||
{
|
||||
static const word64 s[8] = {
|
||||
W64LIT(0xcbbb9d5dc1059ed8), W64LIT(0x629a292a367cd507),
|
||||
W64LIT(0x9159015a3070dd17), W64LIT(0x152fecd8f70e5939),
|
||||
W64LIT(0x67332667ffc00b31), W64LIT(0x8eb44a8768581511),
|
||||
W64LIT(0xdb0c2e0d64f98fa7), W64LIT(0x47b5481dbefa4fa4)};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
void SHA512::InitState(HashWordType *state)
|
||||
{
|
||||
static const word64 s[8] = {
|
||||
W64LIT(0x6a09e667f3bcc908), W64LIT(0xbb67ae8584caa73b),
|
||||
W64LIT(0x3c6ef372fe94f82b), W64LIT(0xa54ff53a5f1d36f1),
|
||||
W64LIT(0x510e527fade682d1), W64LIT(0x9b05688c2b3e6c1f),
|
||||
W64LIT(0x1f83d9abfb41bd6b), W64LIT(0x5be0cd19137e2179)};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
CRYPTOPP_ALIGN_DATA(16) static const word64 SHA512_K[80] CRYPTOPP_SECTION_ALIGN16 = {
|
||||
W64LIT(0x428a2f98d728ae22), W64LIT(0x7137449123ef65cd),
|
||||
W64LIT(0xb5c0fbcfec4d3b2f), W64LIT(0xe9b5dba58189dbbc),
|
||||
W64LIT(0x3956c25bf348b538), W64LIT(0x59f111f1b605d019),
|
||||
W64LIT(0x923f82a4af194f9b), W64LIT(0xab1c5ed5da6d8118),
|
||||
W64LIT(0xd807aa98a3030242), W64LIT(0x12835b0145706fbe),
|
||||
W64LIT(0x243185be4ee4b28c), W64LIT(0x550c7dc3d5ffb4e2),
|
||||
W64LIT(0x72be5d74f27b896f), W64LIT(0x80deb1fe3b1696b1),
|
||||
W64LIT(0x9bdc06a725c71235), W64LIT(0xc19bf174cf692694),
|
||||
W64LIT(0xe49b69c19ef14ad2), W64LIT(0xefbe4786384f25e3),
|
||||
W64LIT(0x0fc19dc68b8cd5b5), W64LIT(0x240ca1cc77ac9c65),
|
||||
W64LIT(0x2de92c6f592b0275), W64LIT(0x4a7484aa6ea6e483),
|
||||
W64LIT(0x5cb0a9dcbd41fbd4), W64LIT(0x76f988da831153b5),
|
||||
W64LIT(0x983e5152ee66dfab), W64LIT(0xa831c66d2db43210),
|
||||
W64LIT(0xb00327c898fb213f), W64LIT(0xbf597fc7beef0ee4),
|
||||
W64LIT(0xc6e00bf33da88fc2), W64LIT(0xd5a79147930aa725),
|
||||
W64LIT(0x06ca6351e003826f), W64LIT(0x142929670a0e6e70),
|
||||
W64LIT(0x27b70a8546d22ffc), W64LIT(0x2e1b21385c26c926),
|
||||
W64LIT(0x4d2c6dfc5ac42aed), W64LIT(0x53380d139d95b3df),
|
||||
W64LIT(0x650a73548baf63de), W64LIT(0x766a0abb3c77b2a8),
|
||||
W64LIT(0x81c2c92e47edaee6), W64LIT(0x92722c851482353b),
|
||||
W64LIT(0xa2bfe8a14cf10364), W64LIT(0xa81a664bbc423001),
|
||||
W64LIT(0xc24b8b70d0f89791), W64LIT(0xc76c51a30654be30),
|
||||
W64LIT(0xd192e819d6ef5218), W64LIT(0xd69906245565a910),
|
||||
W64LIT(0xf40e35855771202a), W64LIT(0x106aa07032bbd1b8),
|
||||
W64LIT(0x19a4c116b8d2d0c8), W64LIT(0x1e376c085141ab53),
|
||||
W64LIT(0x2748774cdf8eeb99), W64LIT(0x34b0bcb5e19b48a8),
|
||||
W64LIT(0x391c0cb3c5c95a63), W64LIT(0x4ed8aa4ae3418acb),
|
||||
W64LIT(0x5b9cca4f7763e373), W64LIT(0x682e6ff3d6b2b8a3),
|
||||
W64LIT(0x748f82ee5defb2fc), W64LIT(0x78a5636f43172f60),
|
||||
W64LIT(0x84c87814a1f0ab72), W64LIT(0x8cc702081a6439ec),
|
||||
W64LIT(0x90befffa23631e28), W64LIT(0xa4506cebde82bde9),
|
||||
W64LIT(0xbef9a3f7b2c67915), W64LIT(0xc67178f2e372532b),
|
||||
W64LIT(0xca273eceea26619c), W64LIT(0xd186b8c721c0c207),
|
||||
W64LIT(0xeada7dd6cde0eb1e), W64LIT(0xf57d4f7fee6ed178),
|
||||
W64LIT(0x06f067aa72176fba), W64LIT(0x0a637dc5a2c898a6),
|
||||
W64LIT(0x113f9804bef90dae), W64LIT(0x1b710b35131c471b),
|
||||
W64LIT(0x28db77f523047d84), W64LIT(0x32caab7b40c72493),
|
||||
W64LIT(0x3c9ebe0a15c9bebc), W64LIT(0x431d67c49c100d4c),
|
||||
W64LIT(0x4cc5d4becb3e42b6), W64LIT(0x597f299cfc657e2a),
|
||||
W64LIT(0x5fcb6fab3ad6faec), W64LIT(0x6c44198c4a475817)
|
||||
};
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86
|
||||
// put assembly version in separate function, otherwise MSVC 2005 SP1 doesn't generate correct code for the non-assembly version
|
||||
CRYPTOPP_NAKED static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state, const word64 *data)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
__asm__ __volatile__
|
||||
(
|
||||
".intel_syntax noprefix;"
|
||||
AS1( push ebx)
|
||||
AS2( mov ebx, eax)
|
||||
#else
|
||||
AS1( push ebx)
|
||||
AS1( push esi)
|
||||
AS1( push edi)
|
||||
AS2( lea ebx, SHA512_K)
|
||||
#endif
|
||||
|
||||
AS2( mov eax, esp)
|
||||
AS2( and esp, 0xfffffff0)
|
||||
AS2( sub esp, 27*16) // 17*16 for expanded data, 20*8 for state
|
||||
AS1( push eax)
|
||||
AS2( xor eax, eax)
|
||||
AS2( lea edi, [esp+4+8*8]) // start at middle of state buffer. will decrement pointer each round to avoid copying
|
||||
AS2( lea esi, [esp+4+20*8+8]) // 16-byte alignment, then add 8
|
||||
|
||||
AS2( movq mm4, [ecx+0*8])
|
||||
AS2( movq [edi+0*8], mm4)
|
||||
AS2( movq mm0, [ecx+1*8])
|
||||
AS2( movq [edi+1*8], mm0)
|
||||
AS2( movq mm0, [ecx+2*8])
|
||||
AS2( movq [edi+2*8], mm0)
|
||||
AS2( movq mm0, [ecx+3*8])
|
||||
AS2( movq [edi+3*8], mm0)
|
||||
AS2( movq mm5, [ecx+4*8])
|
||||
AS2( movq [edi+4*8], mm5)
|
||||
AS2( movq mm0, [ecx+5*8])
|
||||
AS2( movq [edi+5*8], mm0)
|
||||
AS2( movq mm0, [ecx+6*8])
|
||||
AS2( movq [edi+6*8], mm0)
|
||||
AS2( movq mm0, [ecx+7*8])
|
||||
AS2( movq [edi+7*8], mm0)
|
||||
ASJ( jmp, 0, f)
|
||||
|
||||
#define SSE2_S0_S1(r, a, b, c) \
|
||||
AS2( movq mm6, r)\
|
||||
AS2( psrlq r, a)\
|
||||
AS2( movq mm7, r)\
|
||||
AS2( psllq mm6, 64-c)\
|
||||
AS2( pxor mm7, mm6)\
|
||||
AS2( psrlq r, b-a)\
|
||||
AS2( pxor mm7, r)\
|
||||
AS2( psllq mm6, c-b)\
|
||||
AS2( pxor mm7, mm6)\
|
||||
AS2( psrlq r, c-b)\
|
||||
AS2( pxor r, mm7)\
|
||||
AS2( psllq mm6, b-a)\
|
||||
AS2( pxor r, mm6)
|
||||
|
||||
#define SSE2_s0(r, a, b, c) \
|
||||
AS2( movdqa xmm6, r)\
|
||||
AS2( psrlq r, a)\
|
||||
AS2( movdqa xmm7, r)\
|
||||
AS2( psllq xmm6, 64-c)\
|
||||
AS2( pxor xmm7, xmm6)\
|
||||
AS2( psrlq r, b-a)\
|
||||
AS2( pxor xmm7, r)\
|
||||
AS2( psrlq r, c-b)\
|
||||
AS2( pxor r, xmm7)\
|
||||
AS2( psllq xmm6, c-a)\
|
||||
AS2( pxor r, xmm6)
|
||||
|
||||
#define SSE2_s1(r, a, b, c) \
|
||||
AS2( movdqa xmm6, r)\
|
||||
AS2( psrlq r, a)\
|
||||
AS2( movdqa xmm7, r)\
|
||||
AS2( psllq xmm6, 64-c)\
|
||||
AS2( pxor xmm7, xmm6)\
|
||||
AS2( psrlq r, b-a)\
|
||||
AS2( pxor xmm7, r)\
|
||||
AS2( psllq xmm6, c-b)\
|
||||
AS2( pxor xmm7, xmm6)\
|
||||
AS2( psrlq r, c-b)\
|
||||
AS2( pxor r, xmm7)
|
||||
|
||||
ASL(SHA512_Round)
|
||||
// k + w is in mm0, a is in mm4, e is in mm5
|
||||
AS2( paddq mm0, [edi+7*8]) // h
|
||||
AS2( movq mm2, [edi+5*8]) // f
|
||||
AS2( movq mm3, [edi+6*8]) // g
|
||||
AS2( pxor mm2, mm3)
|
||||
AS2( pand mm2, mm5)
|
||||
SSE2_S0_S1(mm5,14,18,41)
|
||||
AS2( pxor mm2, mm3)
|
||||
AS2( paddq mm0, mm2) // h += Ch(e,f,g)
|
||||
AS2( paddq mm5, mm0) // h += S1(e)
|
||||
AS2( movq mm2, [edi+1*8]) // b
|
||||
AS2( movq mm1, mm2)
|
||||
AS2( por mm2, mm4)
|
||||
AS2( pand mm2, [edi+2*8]) // c
|
||||
AS2( pand mm1, mm4)
|
||||
AS2( por mm1, mm2)
|
||||
AS2( paddq mm1, mm5) // temp = h + Maj(a,b,c)
|
||||
AS2( paddq mm5, [edi+3*8]) // e = d + h
|
||||
AS2( movq [edi+3*8], mm5)
|
||||
AS2( movq [edi+11*8], mm5)
|
||||
SSE2_S0_S1(mm4,28,34,39) // S0(a)
|
||||
AS2( paddq mm4, mm1) // a = temp + S0(a)
|
||||
AS2( movq [edi-8], mm4)
|
||||
AS2( movq [edi+7*8], mm4)
|
||||
AS1( ret)
|
||||
|
||||
// first 16 rounds
|
||||
ASL(0)
|
||||
AS2( movq mm0, [edx+eax*8])
|
||||
AS2( movq [esi+eax*8], mm0)
|
||||
AS2( movq [esi+eax*8+16*8], mm0)
|
||||
AS2( paddq mm0, [ebx+eax*8])
|
||||
ASC( call, SHA512_Round)
|
||||
AS1( inc eax)
|
||||
AS2( sub edi, 8)
|
||||
AS2( test eax, 7)
|
||||
ASJ( jnz, 0, b)
|
||||
AS2( add edi, 8*8)
|
||||
AS2( cmp eax, 16)
|
||||
ASJ( jne, 0, b)
|
||||
|
||||
// rest of the rounds
|
||||
AS2( movdqu xmm0, [esi+(16-2)*8])
|
||||
ASL(1)
|
||||
// data expansion, W[i-2] already in xmm0
|
||||
AS2( movdqu xmm3, [esi])
|
||||
AS2( paddq xmm3, [esi+(16-7)*8])
|
||||
AS2( movdqa xmm2, [esi+(16-15)*8])
|
||||
SSE2_s1(xmm0, 6, 19, 61)
|
||||
AS2( paddq xmm0, xmm3)
|
||||
SSE2_s0(xmm2, 1, 7, 8)
|
||||
AS2( paddq xmm0, xmm2)
|
||||
AS2( movdq2q mm0, xmm0)
|
||||
AS2( movhlps xmm1, xmm0)
|
||||
AS2( paddq mm0, [ebx+eax*8])
|
||||
AS2( movlps [esi], xmm0)
|
||||
AS2( movlps [esi+8], xmm1)
|
||||
AS2( movlps [esi+8*16], xmm0)
|
||||
AS2( movlps [esi+8*17], xmm1)
|
||||
// 2 rounds
|
||||
ASC( call, SHA512_Round)
|
||||
AS2( sub edi, 8)
|
||||
AS2( movdq2q mm0, xmm1)
|
||||
AS2( paddq mm0, [ebx+eax*8+8])
|
||||
ASC( call, SHA512_Round)
|
||||
// update indices and loop
|
||||
AS2( add esi, 16)
|
||||
AS2( add eax, 2)
|
||||
AS2( sub edi, 8)
|
||||
AS2( test eax, 7)
|
||||
ASJ( jnz, 1, b)
|
||||
// do housekeeping every 8 rounds
|
||||
AS2( mov esi, 0xf)
|
||||
AS2( and esi, eax)
|
||||
AS2( lea esi, [esp+4+20*8+8+esi*8])
|
||||
AS2( add edi, 8*8)
|
||||
AS2( cmp eax, 80)
|
||||
ASJ( jne, 1, b)
|
||||
|
||||
#define SSE2_CombineState(i) \
|
||||
AS2( movq mm0, [edi+i*8])\
|
||||
AS2( paddq mm0, [ecx+i*8])\
|
||||
AS2( movq [ecx+i*8], mm0)
|
||||
|
||||
SSE2_CombineState(0)
|
||||
SSE2_CombineState(1)
|
||||
SSE2_CombineState(2)
|
||||
SSE2_CombineState(3)
|
||||
SSE2_CombineState(4)
|
||||
SSE2_CombineState(5)
|
||||
SSE2_CombineState(6)
|
||||
SSE2_CombineState(7)
|
||||
|
||||
AS1( pop esp)
|
||||
AS1( emms)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
AS1( pop ebx)
|
||||
".att_syntax prefix;"
|
||||
:
|
||||
: "a" (SHA512_K), "c" (state), "d" (data)
|
||||
: "%esi", "%edi", "memory", "cc"
|
||||
);
|
||||
#else
|
||||
AS1( pop edi)
|
||||
AS1( pop esi)
|
||||
AS1( pop ebx)
|
||||
AS1( ret)
|
||||
#endif
|
||||
}
|
||||
#endif // #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
|
||||
void SHA512::Transform(word64 *state, const word64 *data)
|
||||
{
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86
|
||||
if (HasSSE2())
|
||||
{
|
||||
SHA512_SSE2_Transform(state, data);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define S0(x) (rotrFixed(x,28)^rotrFixed(x,34)^rotrFixed(x,39))
|
||||
#define S1(x) (rotrFixed(x,14)^rotrFixed(x,18)^rotrFixed(x,41))
|
||||
#define s0(x) (rotrFixed(x,1)^rotrFixed(x,8)^(x>>7))
|
||||
#define s1(x) (rotrFixed(x,19)^rotrFixed(x,61)^(x>>6))
|
||||
|
||||
#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA512_K[i+j]+(j?blk2(i):blk0(i));\
|
||||
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
|
||||
|
||||
word64 W[16];
|
||||
word64 T[8];
|
||||
/* Copy context->state[] to working vars */
|
||||
memcpy(T, state, sizeof(T));
|
||||
/* 80 operations, partially loop unrolled */
|
||||
for (unsigned int j=0; j<80; j+=16)
|
||||
{
|
||||
R( 0); R( 1); R( 2); R( 3);
|
||||
R( 4); R( 5); R( 6); R( 7);
|
||||
R( 8); R( 9); R(10); R(11);
|
||||
R(12); R(13); R(14); R(15);
|
||||
}
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a(0);
|
||||
state[1] += b(0);
|
||||
state[2] += c(0);
|
||||
state[3] += d(0);
|
||||
state[4] += e(0);
|
||||
state[5] += f(0);
|
||||
state[6] += g(0);
|
||||
state[7] += h(0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
177
sha.h
177
sha.h
@@ -1,177 +0,0 @@
|
||||
// This file is public domain
|
||||
// SHA routines extracted as a standalone file from:
|
||||
// Crypto++: a C++ Class Library of Cryptographic Schemes
|
||||
// Version 5.5.2 (9/24/2007)
|
||||
// http://www.cryptopp.com
|
||||
#ifndef CRYPTOPP_SHA_H
|
||||
#define CRYPTOPP_SHA_H
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace CryptoPP
|
||||
{
|
||||
|
||||
//
|
||||
// Dependencies
|
||||
//
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word16;
|
||||
typedef unsigned int word32;
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef unsigned __int64 word64;
|
||||
#else
|
||||
typedef unsigned long long word64;
|
||||
#endif
|
||||
|
||||
template <class T> inline T rotlFixed(T x, unsigned int y)
|
||||
{
|
||||
assert(y < sizeof(T)*8);
|
||||
return T((x<<y) | (x>>(sizeof(T)*8-y)));
|
||||
}
|
||||
|
||||
template <class T> inline T rotrFixed(T x, unsigned int y)
|
||||
{
|
||||
assert(y < sizeof(T)*8);
|
||||
return T((x>>y) | (x<<(sizeof(T)*8-y)));
|
||||
}
|
||||
|
||||
// ************** endian reversal ***************
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER >= 1400
|
||||
#define CRYPTOPP_FAST_ROTATE(x) 1
|
||||
#elif _MSC_VER >= 1300
|
||||
#define CRYPTOPP_FAST_ROTATE(x) ((x) == 32 | (x) == 64)
|
||||
#else
|
||||
#define CRYPTOPP_FAST_ROTATE(x) ((x) == 32)
|
||||
#endif
|
||||
#elif (defined(__MWERKS__) && TARGET_CPU_PPC) || \
|
||||
(defined(__GNUC__) && (defined(_ARCH_PWR2) || defined(_ARCH_PWR) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_ARCH_COM)))
|
||||
#define CRYPTOPP_FAST_ROTATE(x) ((x) == 32)
|
||||
#elif defined(__GNUC__) && (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86) // depend on GCC's peephole optimization to generate rotate instructions
|
||||
#define CRYPTOPP_FAST_ROTATE(x) 1
|
||||
#else
|
||||
#define CRYPTOPP_FAST_ROTATE(x) 0
|
||||
#endif
|
||||
|
||||
inline byte ByteReverse(byte value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
inline word16 ByteReverse(word16 value)
|
||||
{
|
||||
#ifdef CRYPTOPP_BYTESWAP_AVAILABLE
|
||||
return bswap_16(value);
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
return _byteswap_ushort(value);
|
||||
#else
|
||||
return rotlFixed(value, 8U);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline word32 ByteReverse(word32 value)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
__asm__ ("bswap %0" : "=r" (value) : "0" (value));
|
||||
return value;
|
||||
#elif defined(CRYPTOPP_BYTESWAP_AVAILABLE)
|
||||
return bswap_32(value);
|
||||
#elif defined(__MWERKS__) && TARGET_CPU_PPC
|
||||
return (word32)__lwbrx(&value,0);
|
||||
#elif _MSC_VER >= 1400 || (_MSC_VER >= 1300 && !defined(_DLL))
|
||||
return _byteswap_ulong(value);
|
||||
#elif CRYPTOPP_FAST_ROTATE(32)
|
||||
// 5 instructions with rotate instruction, 9 without
|
||||
return (rotrFixed(value, 8U) & 0xff00ff00) | (rotlFixed(value, 8U) & 0x00ff00ff);
|
||||
#else
|
||||
// 6 instructions with rotate instruction, 8 without
|
||||
value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8);
|
||||
return rotlFixed(value, 16U);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WORD64_AVAILABLE
|
||||
inline word64 ByteReverse(word64 value)
|
||||
{
|
||||
#if defined(__GNUC__) && defined(__x86_64__)
|
||||
__asm__ ("bswap %0" : "=r" (value) : "0" (value));
|
||||
return value;
|
||||
#elif defined(CRYPTOPP_BYTESWAP_AVAILABLE)
|
||||
return bswap_64(value);
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
return _byteswap_uint64(value);
|
||||
#elif defined(CRYPTOPP_SLOW_WORD64)
|
||||
return (word64(ByteReverse(word32(value))) << 32) | ByteReverse(word32(value>>32));
|
||||
#else
|
||||
value = ((value & W64LIT(0xFF00FF00FF00FF00)) >> 8) | ((value & W64LIT(0x00FF00FF00FF00FF)) << 8);
|
||||
value = ((value & W64LIT(0xFFFF0000FFFF0000)) >> 16) | ((value & W64LIT(0x0000FFFF0000FFFF)) << 16);
|
||||
return rotlFixed(value, 32U);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// SHA
|
||||
//
|
||||
|
||||
// http://www.weidai.com/scan-mirror/md.html#SHA-1
|
||||
class SHA1
|
||||
{
|
||||
public:
|
||||
typedef word32 HashWordType;
|
||||
static void InitState(word32 *state);
|
||||
static void Transform(word32 *digest, const word32 *data);
|
||||
static const char * StaticAlgorithmName() {return "SHA-1";}
|
||||
};
|
||||
|
||||
typedef SHA1 SHA; // for backwards compatibility
|
||||
|
||||
// implements the SHA-256 standard
|
||||
class SHA256
|
||||
{
|
||||
public:
|
||||
typedef word32 HashWordType;
|
||||
static void InitState(word32 *state);
|
||||
static void Transform(word32 *digest, const word32 *data);
|
||||
static const char * StaticAlgorithmName() {return "SHA-256";}
|
||||
};
|
||||
|
||||
// implements the SHA-224 standard
|
||||
class SHA224
|
||||
{
|
||||
public:
|
||||
typedef word32 HashWordType;
|
||||
static void InitState(word32 *state);
|
||||
static void Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
|
||||
static const char * StaticAlgorithmName() {return "SHA-224";}
|
||||
};
|
||||
|
||||
#ifdef WORD64_AVAILABLE
|
||||
|
||||
// implements the SHA-512 standard
|
||||
class SHA512
|
||||
{
|
||||
public:
|
||||
typedef word64 HashWordType;
|
||||
static void InitState(word64 *state);
|
||||
static void Transform(word64 *digest, const word64 *data);
|
||||
static const char * StaticAlgorithmName() {return "SHA-512";}
|
||||
};
|
||||
|
||||
// implements the SHA-384 standard
|
||||
class SHA384
|
||||
{
|
||||
public:
|
||||
typedef word64 HashWordType;
|
||||
static void InitState(word64 *state);
|
||||
static void Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
|
||||
static const char * StaticAlgorithmName() {return "SHA-384";}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
475
sha256.cpp
Normal file
475
sha256.cpp
Normal file
@@ -0,0 +1,475 @@
|
||||
// Copyright (c) 2010 Nils Schneider
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
// 4-way 128-bit SSE2 SHA-256
|
||||
|
||||
#ifdef FOURWAYSSE2
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <xmmintrin.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define NPAR 32
|
||||
|
||||
extern void DoubleBlockSHA256(const void* pin, void* pout, const void* pinit, unsigned int hash[8][NPAR], const void* init2);
|
||||
|
||||
static const unsigned int sha256_consts[] = {
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, /* 0 */
|
||||
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, /* 8 */
|
||||
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
||||
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, /* 16 */
|
||||
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, /* 24 */
|
||||
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
||||
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, /* 32 */
|
||||
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, /* 40 */
|
||||
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, /* 48 */
|
||||
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
||||
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, /* 56 */
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
||||
};
|
||||
|
||||
|
||||
static inline __m128i Ch(const __m128i b, const __m128i c, const __m128i d) {
|
||||
return (b & c) ^ (~b & d);
|
||||
}
|
||||
|
||||
static inline __m128i Maj(const __m128i b, const __m128i c, const __m128i d) {
|
||||
return (b & c) ^ (b & d) ^ (c & d);
|
||||
}
|
||||
|
||||
static inline __m128i ROTR(__m128i x, const int n) {
|
||||
return _mm_srli_epi32(x, n) | _mm_slli_epi32(x, 32 - n);
|
||||
}
|
||||
|
||||
static inline __m128i SHR(__m128i x, const int n) {
|
||||
return _mm_srli_epi32(x, n);
|
||||
}
|
||||
|
||||
/* SHA256 Functions */
|
||||
#define BIGSIGMA0_256(x) (ROTR((x), 2) ^ ROTR((x), 13) ^ ROTR((x), 22))
|
||||
#define BIGSIGMA1_256(x) (ROTR((x), 6) ^ ROTR((x), 11) ^ ROTR((x), 25))
|
||||
#define SIGMA0_256(x) (ROTR((x), 7) ^ ROTR((x), 18) ^ SHR((x), 3))
|
||||
#define SIGMA1_256(x) (ROTR((x), 17) ^ ROTR((x), 19) ^ SHR((x), 10))
|
||||
|
||||
static inline unsigned int store32(const __m128i x, int i) {
|
||||
union { unsigned int ret[4]; __m128i x; } box;
|
||||
box.x = x;
|
||||
return box.ret[i];
|
||||
}
|
||||
|
||||
static inline void store_epi32(const __m128i x, unsigned int *x0, unsigned int *x1, unsigned int *x2, unsigned int *x3) {
|
||||
union { unsigned int ret[4]; __m128i x; } box;
|
||||
box.x = x;
|
||||
*x0 = box.ret[3]; *x1 = box.ret[2]; *x2 = box.ret[1]; *x3 = box.ret[0];
|
||||
}
|
||||
|
||||
#define add4(x0, x1, x2, x3) _mm_add_epi32(_mm_add_epi32(_mm_add_epi32(x0, x1), x2), x3)
|
||||
#define add5(x0, x1, x2, x3, x4) _mm_add_epi32(add4(x0, x1, x2, x3), x4)
|
||||
|
||||
#define SHA256ROUND(a, b, c, d, e, f, g, h, i, w) \
|
||||
T1 = add5(h, BIGSIGMA1_256(e), Ch(e, f, g), _mm_set1_epi32(sha256_consts[i]), w); \
|
||||
d = _mm_add_epi32(d, T1); \
|
||||
h = _mm_add_epi32(T1, _mm_add_epi32(BIGSIGMA0_256(a), Maj(a, b, c)));
|
||||
|
||||
static inline void dumpreg(__m128i x, char *msg) {
|
||||
union { unsigned int ret[4]; __m128i x; } box;
|
||||
box.x = x ;
|
||||
printf("%s %08x %08x %08x %08x\n", msg, box.ret[0], box.ret[1], box.ret[2], box.ret[3]);
|
||||
}
|
||||
|
||||
#if 1
|
||||
#define dumpstate(i) printf("%s: %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", \
|
||||
__func__, store32(w0, i), store32(a, i), store32(b, i), store32(c, i), store32(d, i), store32(e, i), store32(f, i), store32(g, i), store32(h, i));
|
||||
#else
|
||||
#define dumpstate()
|
||||
#endif
|
||||
|
||||
// Align by increasing pointer, must have extra space at end of buffer
|
||||
template <size_t nBytes, typename T>
|
||||
T* alignup(T* p)
|
||||
{
|
||||
union
|
||||
{
|
||||
T* ptr;
|
||||
size_t n;
|
||||
} u;
|
||||
u.ptr = p;
|
||||
u.n = (u.n + (nBytes-1)) & ~(nBytes-1);
|
||||
return u.ptr;
|
||||
}
|
||||
|
||||
static const unsigned int pSHA256InitState[8] =
|
||||
{0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
|
||||
|
||||
|
||||
unsigned int ScanHash_4WaySSE2(char* pmidstate, char* pdata, char* phash1, char* phash, unsigned int& nHashesDone)
|
||||
{
|
||||
unsigned int& nNonce = *(unsigned int*)(pdata + 12);
|
||||
for (;;)
|
||||
{
|
||||
nNonce += NPAR;
|
||||
unsigned int thashbuf[9][NPAR];
|
||||
unsigned int (&thash)[9][NPAR] = *alignup<16>(&thashbuf);
|
||||
DoubleBlockSHA256(pdata, phash1, pmidstate, thash, pSHA256InitState);
|
||||
|
||||
for (int j = 0; j < NPAR; j++)
|
||||
{
|
||||
if (thash[7][j] == 0)
|
||||
{
|
||||
for (int i = 0; i < 32/4; i++)
|
||||
((unsigned int*)phash)[i] = thash[i][j];
|
||||
return nNonce + j;
|
||||
}
|
||||
}
|
||||
|
||||
if ((nNonce & 0xffff) == 0)
|
||||
{
|
||||
nHashesDone = 0xffff+1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DoubleBlockSHA256(const void* pin, void* pad, const void *pre, unsigned int thash[9][NPAR], const void *init)
|
||||
{
|
||||
unsigned int* In = (unsigned int*)pin;
|
||||
unsigned int* Pad = (unsigned int*)pad;
|
||||
unsigned int* hPre = (unsigned int*)pre;
|
||||
unsigned int* hInit = (unsigned int*)init;
|
||||
unsigned int i, j, k;
|
||||
|
||||
/* vectors used in calculation */
|
||||
__m128i w0, w1, w2, w3, w4, w5, w6, w7;
|
||||
__m128i w8, w9, w10, w11, w12, w13, w14, w15;
|
||||
__m128i T1;
|
||||
__m128i a, b, c, d, e, f, g, h;
|
||||
__m128i nonce;
|
||||
|
||||
/* nonce offset for vector */
|
||||
__m128i offset = _mm_set_epi32(0x00000003, 0x00000002, 0x00000001, 0x00000000);
|
||||
|
||||
|
||||
for(k = 0; k<NPAR; k+=4) {
|
||||
w0 = _mm_set1_epi32(In[0]);
|
||||
w1 = _mm_set1_epi32(In[1]);
|
||||
w2 = _mm_set1_epi32(In[2]);
|
||||
//w3 = _mm_set1_epi32(In[3]); nonce will be later hacked into the hash
|
||||
w4 = _mm_set1_epi32(In[4]);
|
||||
w5 = _mm_set1_epi32(In[5]);
|
||||
w6 = _mm_set1_epi32(In[6]);
|
||||
w7 = _mm_set1_epi32(In[7]);
|
||||
w8 = _mm_set1_epi32(In[8]);
|
||||
w9 = _mm_set1_epi32(In[9]);
|
||||
w10 = _mm_set1_epi32(In[10]);
|
||||
w11 = _mm_set1_epi32(In[11]);
|
||||
w12 = _mm_set1_epi32(In[12]);
|
||||
w13 = _mm_set1_epi32(In[13]);
|
||||
w14 = _mm_set1_epi32(In[14]);
|
||||
w15 = _mm_set1_epi32(In[15]);
|
||||
|
||||
/* hack nonce into lowest byte of w3 */
|
||||
nonce = _mm_set1_epi32(In[3]);
|
||||
nonce = _mm_add_epi32(nonce, offset);
|
||||
nonce = _mm_add_epi32(nonce, _mm_set1_epi32(k));
|
||||
w3 = nonce;
|
||||
|
||||
a = _mm_set1_epi32(hPre[0]);
|
||||
b = _mm_set1_epi32(hPre[1]);
|
||||
c = _mm_set1_epi32(hPre[2]);
|
||||
d = _mm_set1_epi32(hPre[3]);
|
||||
e = _mm_set1_epi32(hPre[4]);
|
||||
f = _mm_set1_epi32(hPre[5]);
|
||||
g = _mm_set1_epi32(hPre[6]);
|
||||
h = _mm_set1_epi32(hPre[7]);
|
||||
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 0, w0);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 1, w1);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 2, w2);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 3, w3);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 4, w4);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 5, w5);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 6, w6);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 7, w7);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 8, w8);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 9, w9);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 10, w10);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 11, w11);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 12, w12);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 13, w13);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 14, w14);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 15, w15);
|
||||
|
||||
w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 16, w0);
|
||||
w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 17, w1);
|
||||
w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 18, w2);
|
||||
w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 19, w3);
|
||||
w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 20, w4);
|
||||
w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 21, w5);
|
||||
w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 22, w6);
|
||||
w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 23, w7);
|
||||
w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 24, w8);
|
||||
w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 25, w9);
|
||||
w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 26, w10);
|
||||
w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 27, w11);
|
||||
w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 28, w12);
|
||||
w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 29, w13);
|
||||
w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 30, w14);
|
||||
w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 31, w15);
|
||||
|
||||
w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 32, w0);
|
||||
w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 33, w1);
|
||||
w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 34, w2);
|
||||
w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 35, w3);
|
||||
w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 36, w4);
|
||||
w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 37, w5);
|
||||
w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 38, w6);
|
||||
w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 39, w7);
|
||||
w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 40, w8);
|
||||
w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 41, w9);
|
||||
w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 42, w10);
|
||||
w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 43, w11);
|
||||
w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 44, w12);
|
||||
w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 45, w13);
|
||||
w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 46, w14);
|
||||
w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 47, w15);
|
||||
|
||||
w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 48, w0);
|
||||
w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 49, w1);
|
||||
w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 50, w2);
|
||||
w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 51, w3);
|
||||
w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 52, w4);
|
||||
w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 53, w5);
|
||||
w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 54, w6);
|
||||
w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 55, w7);
|
||||
w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 56, w8);
|
||||
w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 57, w9);
|
||||
w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 58, w10);
|
||||
w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 59, w11);
|
||||
w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 60, w12);
|
||||
w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 61, w13);
|
||||
w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 62, w14);
|
||||
w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 63, w15);
|
||||
|
||||
#define store_load(x, i, dest) \
|
||||
T1 = _mm_set1_epi32((hPre)[i]); \
|
||||
dest = _mm_add_epi32(T1, x);
|
||||
|
||||
store_load(a, 0, w0);
|
||||
store_load(b, 1, w1);
|
||||
store_load(c, 2, w2);
|
||||
store_load(d, 3, w3);
|
||||
store_load(e, 4, w4);
|
||||
store_load(f, 5, w5);
|
||||
store_load(g, 6, w6);
|
||||
store_load(h, 7, w7);
|
||||
|
||||
w8 = _mm_set1_epi32(Pad[8]);
|
||||
w9 = _mm_set1_epi32(Pad[9]);
|
||||
w10 = _mm_set1_epi32(Pad[10]);
|
||||
w11 = _mm_set1_epi32(Pad[11]);
|
||||
w12 = _mm_set1_epi32(Pad[12]);
|
||||
w13 = _mm_set1_epi32(Pad[13]);
|
||||
w14 = _mm_set1_epi32(Pad[14]);
|
||||
w15 = _mm_set1_epi32(Pad[15]);
|
||||
|
||||
a = _mm_set1_epi32(hInit[0]);
|
||||
b = _mm_set1_epi32(hInit[1]);
|
||||
c = _mm_set1_epi32(hInit[2]);
|
||||
d = _mm_set1_epi32(hInit[3]);
|
||||
e = _mm_set1_epi32(hInit[4]);
|
||||
f = _mm_set1_epi32(hInit[5]);
|
||||
g = _mm_set1_epi32(hInit[6]);
|
||||
h = _mm_set1_epi32(hInit[7]);
|
||||
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 0, w0);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 1, w1);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 2, w2);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 3, w3);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 4, w4);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 5, w5);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 6, w6);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 7, w7);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 8, w8);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 9, w9);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 10, w10);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 11, w11);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 12, w12);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 13, w13);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 14, w14);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 15, w15);
|
||||
|
||||
w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 16, w0);
|
||||
w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 17, w1);
|
||||
w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 18, w2);
|
||||
w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 19, w3);
|
||||
w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 20, w4);
|
||||
w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 21, w5);
|
||||
w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 22, w6);
|
||||
w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 23, w7);
|
||||
w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 24, w8);
|
||||
w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 25, w9);
|
||||
w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 26, w10);
|
||||
w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 27, w11);
|
||||
w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 28, w12);
|
||||
w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 29, w13);
|
||||
w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 30, w14);
|
||||
w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 31, w15);
|
||||
|
||||
w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 32, w0);
|
||||
w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 33, w1);
|
||||
w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 34, w2);
|
||||
w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 35, w3);
|
||||
w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 36, w4);
|
||||
w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 37, w5);
|
||||
w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 38, w6);
|
||||
w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 39, w7);
|
||||
w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 40, w8);
|
||||
w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 41, w9);
|
||||
w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 42, w10);
|
||||
w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 43, w11);
|
||||
w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 44, w12);
|
||||
w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 45, w13);
|
||||
w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 46, w14);
|
||||
w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 47, w15);
|
||||
|
||||
w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 48, w0);
|
||||
w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 49, w1);
|
||||
w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 50, w2);
|
||||
w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 51, w3);
|
||||
w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 52, w4);
|
||||
w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 53, w5);
|
||||
w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 54, w6);
|
||||
w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 55, w7);
|
||||
w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8);
|
||||
SHA256ROUND(a, b, c, d, e, f, g, h, 56, w8);
|
||||
w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9);
|
||||
SHA256ROUND(h, a, b, c, d, e, f, g, 57, w9);
|
||||
w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10);
|
||||
SHA256ROUND(g, h, a, b, c, d, e, f, 58, w10);
|
||||
w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11);
|
||||
SHA256ROUND(f, g, h, a, b, c, d, e, 59, w11);
|
||||
w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12);
|
||||
SHA256ROUND(e, f, g, h, a, b, c, d, 60, w12);
|
||||
w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13);
|
||||
SHA256ROUND(d, e, f, g, h, a, b, c, 61, w13);
|
||||
w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14);
|
||||
SHA256ROUND(c, d, e, f, g, h, a, b, 62, w14);
|
||||
w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15);
|
||||
SHA256ROUND(b, c, d, e, f, g, h, a, 63, w15);
|
||||
|
||||
/* store resulsts directly in thash */
|
||||
#define store_2(x,i) \
|
||||
w0 = _mm_set1_epi32(hInit[i]); \
|
||||
*(__m128i *)&(thash)[i][0+k] = _mm_add_epi32(w0, x);
|
||||
|
||||
store_2(a, 0);
|
||||
store_2(b, 1);
|
||||
store_2(c, 2);
|
||||
store_2(d, 3);
|
||||
store_2(e, 4);
|
||||
store_2(f, 5);
|
||||
store_2(g, 6);
|
||||
store_2(h, 7);
|
||||
*(__m128i *)&(thash)[8][0+k] = nonce;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // FOURWAYSSE2
|
||||
619
ui.cpp
619
ui.cpp
@@ -14,6 +14,7 @@ DEFINE_EVENT_TYPE(wxEVT_UITHREADCALL)
|
||||
CMainFrame* pframeMain = NULL;
|
||||
CMyTaskBarIcon* ptaskbaricon = NULL;
|
||||
bool fClosedToTray = false;
|
||||
wxLocale g_locale;
|
||||
|
||||
|
||||
|
||||
@@ -102,6 +103,18 @@ int InsertLine(wxListCtrl* listCtrl, void* pdata, const wxString& str0, const wx
|
||||
return nIndex;
|
||||
}
|
||||
|
||||
void SetItemTextColour(wxListCtrl* listCtrl, int nIndex, const wxColour& colour)
|
||||
{
|
||||
// Repaint on Windows is more flickery if the colour has ever been set,
|
||||
// so don't want to set it unless it's different. Default colour has
|
||||
// alpha 0 transparent, so our colours don't match using operator==.
|
||||
wxColour c1 = listCtrl->GetItemTextColour(nIndex);
|
||||
if (!c1.IsOk())
|
||||
c1 = wxColour(0,0,0);
|
||||
if (colour.Red() != c1.Red() || colour.Green() != c1.Green() || colour.Blue() != c1.Blue())
|
||||
listCtrl->SetItemTextColour(nIndex, colour);
|
||||
}
|
||||
|
||||
void SetSelection(wxListCtrl* listCtrl, int nIndex)
|
||||
{
|
||||
int nSize = listCtrl->GetItemCount();
|
||||
@@ -183,7 +196,7 @@ int ThreadSafeMessageBox(const string& message, const string& caption, int style
|
||||
|
||||
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
|
||||
{
|
||||
if (nFeeRequired == 0 || fDaemon)
|
||||
if (nFeeRequired < CENT || nFeeRequired <= nTransactionFee || fDaemon)
|
||||
return true;
|
||||
string strMessage = strprintf(
|
||||
_("This transaction is over the size limit. You can still send it for a fee of %s, "
|
||||
@@ -195,6 +208,8 @@ bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* pa
|
||||
|
||||
void CalledSetStatusBar(const string& strText, int nField)
|
||||
{
|
||||
if (nField == 0 && GetWarnings("statusbar") != "")
|
||||
return;
|
||||
if (pframeMain && pframeMain->m_statusBar)
|
||||
pframeMain->m_statusBar->SetStatusText(strText, nField);
|
||||
}
|
||||
@@ -263,7 +278,7 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
|
||||
m_staticTextBalance->SetLabel(FormatMoney(GetBalance()) + " ");
|
||||
m_listCtrl->SetFocus();
|
||||
ptaskbaricon = new CMyTaskBarIcon();
|
||||
#ifdef __WXMAC__
|
||||
#ifdef __WXMAC_OSX__
|
||||
// Mac automatically moves wxID_EXIT, wxID_PREFERENCES and wxID_ABOUT
|
||||
// to their standard places, leaving these menus empty.
|
||||
GetMenuBar()->Remove(2); // remove Help menu
|
||||
@@ -274,7 +289,7 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
|
||||
int nDateWidth = DateTimeStr(1229413914).size() * 6 + 8;
|
||||
if (!strstr(DateTimeStr(1229413914).c_str(), "2008"))
|
||||
nDateWidth += 12;
|
||||
#ifdef __WXMAC__
|
||||
#ifdef __WXMAC_OSX__
|
||||
nDateWidth += 5;
|
||||
dResize -= 0.01;
|
||||
#endif
|
||||
@@ -375,8 +390,8 @@ void CMainFrame::OnIconize(wxIconizeEvent& event)
|
||||
// to get rid of the deprecated warning. Just ignore it.
|
||||
if (!event.Iconized())
|
||||
fClosedToTray = false;
|
||||
#ifdef __WXGTK__
|
||||
if (mapArgs.count("-minimizetotray")) {
|
||||
#if defined(__WXGTK__) || defined(__WXMAC_OSX__)
|
||||
if (GetBoolArg("-minimizetotray")) {
|
||||
#endif
|
||||
// The tray icon sometimes disappears on ubuntu karmic
|
||||
// Hiding the taskbar button doesn't work cleanly on ubuntu lucid
|
||||
@@ -385,7 +400,7 @@ void CMainFrame::OnIconize(wxIconizeEvent& event)
|
||||
fClosedToTray = true;
|
||||
Show(!fClosedToTray);
|
||||
ptaskbaricon->Show(fMinimizeToTray || fClosedToTray);
|
||||
#ifdef __WXGTK__
|
||||
#if defined(__WXGTK__) || defined(__WXMAC_OSX__)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -431,7 +446,7 @@ int CMainFrame::GetSortIndex(const string& strSort)
|
||||
#endif
|
||||
}
|
||||
|
||||
void CMainFrame::InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5, const wxString& str6)
|
||||
void CMainFrame::InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxColour& colour, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5, const wxString& str6)
|
||||
{
|
||||
strSort = " " + strSort; // leading space to workaround wx2.9.0 ubuntu 9.10 bug
|
||||
long nData = *(long*)&hashKey; // where first char of hidden column is displayed
|
||||
@@ -467,6 +482,7 @@ void CMainFrame::InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSo
|
||||
m_listCtrl->SetItem(nIndex, 5, str5);
|
||||
m_listCtrl->SetItem(nIndex, 6, str6);
|
||||
m_listCtrl->SetItemData(nIndex, nData);
|
||||
SetItemTextColour(m_listCtrl, nIndex, colour);
|
||||
}
|
||||
|
||||
bool CMainFrame::DeleteLine(uint256 hashKey)
|
||||
@@ -512,7 +528,7 @@ string SingleLine(const string& strIn)
|
||||
{
|
||||
string strOut;
|
||||
bool fOneSpace = false;
|
||||
foreach(int c, strIn)
|
||||
foreach(unsigned char c, strIn)
|
||||
{
|
||||
if (isspace(c))
|
||||
{
|
||||
@@ -537,6 +553,8 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
int64 nNet = nCredit - nDebit;
|
||||
uint256 hash = wtx.GetHash();
|
||||
string strStatus = FormatTxStatus(wtx);
|
||||
bool fConfirmed = wtx.fConfirmedDisplayed = wtx.IsConfirmed();
|
||||
wxColour colour = (fConfirmed ? wxColour(0,0,0) : wxColour(128,128,128));
|
||||
map<string, string> mapValue = wtx.mapValue;
|
||||
wtx.nLinesDisplayed = 1;
|
||||
nListViewUpdated++;
|
||||
@@ -637,7 +655,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
{
|
||||
//strDescription += _("Received payment to ");
|
||||
//strDescription += _("Received with address ");
|
||||
strDescription += _("From: unknown, Received with: ");
|
||||
strDescription += _("Received with: ");
|
||||
string strAddress = PubKeyToAddress(vchPubKey);
|
||||
map<string, string>::iterator mi = mapAddressBook.find(strAddress);
|
||||
if (mi != mapAddressBook.end() && !(*mi).second.empty())
|
||||
@@ -655,12 +673,16 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
}
|
||||
}
|
||||
|
||||
InsertLine(fNew, nIndex, hash, strSort,
|
||||
string strCredit = FormatMoney(nNet, true);
|
||||
if (!fConfirmed)
|
||||
strCredit = "[" + strCredit + "]";
|
||||
|
||||
InsertLine(fNew, nIndex, hash, strSort, colour,
|
||||
strStatus,
|
||||
nTime ? DateTimeStr(nTime) : "",
|
||||
SingleLine(strDescription),
|
||||
"",
|
||||
FormatMoney(nNet, true));
|
||||
strCredit);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -675,16 +697,13 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
if (fAllFromMe && fAllToMe)
|
||||
{
|
||||
// Payment to self
|
||||
int64 nValue = wtx.vout[0].nValue;
|
||||
InsertLine(fNew, nIndex, hash, strSort,
|
||||
int64 nChange = wtx.GetChange();
|
||||
InsertLine(fNew, nIndex, hash, strSort, colour,
|
||||
strStatus,
|
||||
nTime ? DateTimeStr(nTime) : "",
|
||||
_("Payment to yourself"),
|
||||
"",
|
||||
"");
|
||||
/// issue: can't tell which is the payment and which is the change anymore
|
||||
// FormatMoney(nNet - nValue, true),
|
||||
// FormatMoney(nValue, true));
|
||||
FormatMoney(-(nDebit - nChange), true),
|
||||
FormatMoney(nCredit - nChange, true));
|
||||
}
|
||||
else if (fAllFromMe)
|
||||
{
|
||||
@@ -727,6 +746,12 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
strDescription += " - ";
|
||||
strDescription += mapValue["message"];
|
||||
}
|
||||
else if (!mapValue["comment"].empty())
|
||||
{
|
||||
if (!strDescription.empty())
|
||||
strDescription += " - ";
|
||||
strDescription += mapValue["comment"];
|
||||
}
|
||||
|
||||
int64 nValue = txout.nValue;
|
||||
if (nTxFee > 0)
|
||||
@@ -735,12 +760,13 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
nTxFee = 0;
|
||||
}
|
||||
|
||||
InsertLine(fNew, nIndex, hash, strprintf("%s-%d", strSort.c_str(), nOut),
|
||||
InsertLine(fNew, nIndex, hash, strprintf("%s-%d", strSort.c_str(), nOut), colour,
|
||||
strStatus,
|
||||
nTime ? DateTimeStr(nTime) : "",
|
||||
SingleLine(strDescription),
|
||||
FormatMoney(-nValue, true),
|
||||
"");
|
||||
nIndex = -1;
|
||||
wtx.nLinesDisplayed++;
|
||||
}
|
||||
}
|
||||
@@ -755,7 +781,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
foreach(const CTxIn& txin, wtx.vin)
|
||||
fAllMine = fAllMine && txin.IsMine();
|
||||
|
||||
InsertLine(fNew, nIndex, hash, strSort,
|
||||
InsertLine(fNew, nIndex, hash, strSort, colour,
|
||||
strStatus,
|
||||
nTime ? DateTimeStr(nTime) : "",
|
||||
"",
|
||||
@@ -882,13 +908,17 @@ void CMainFrame::RefreshStatusColumn()
|
||||
continue;
|
||||
}
|
||||
CWalletTx& wtx = (*mi).second;
|
||||
if (wtx.IsCoinBase() || wtx.GetTxTime() != wtx.nTimeDisplayed)
|
||||
if (wtx.IsCoinBase() ||
|
||||
wtx.GetTxTime() != wtx.nTimeDisplayed ||
|
||||
wtx.IsConfirmed() != wtx.fConfirmedDisplayed)
|
||||
{
|
||||
if (!InsertTransaction(wtx, false, nIndex))
|
||||
m_listCtrl->DeleteItem(nIndex--);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_listCtrl->SetItem(nIndex, 2, FormatTxStatus(wtx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1010,6 +1040,14 @@ void CMainFrame::OnPaintListCtrl(wxPaintEvent& event)
|
||||
RefreshStatusColumn();
|
||||
|
||||
// Update status bar
|
||||
static string strPrevWarning;
|
||||
string strWarning = GetWarnings("statusbar");
|
||||
if (strWarning != "")
|
||||
m_statusBar->SetStatusText(string(" ") + _(strWarning), 0);
|
||||
else if (strPrevWarning != "")
|
||||
m_statusBar->SetStatusText("", 0);
|
||||
strPrevWarning = strWarning;
|
||||
|
||||
string strGen = "";
|
||||
if (fGenerateBitcoins)
|
||||
strGen = _(" Generating");
|
||||
@@ -1017,12 +1055,9 @@ void CMainFrame::OnPaintListCtrl(wxPaintEvent& event)
|
||||
strGen = _("(not connected)");
|
||||
m_statusBar->SetStatusText(strGen, 1);
|
||||
|
||||
string strStatus = strprintf(_(" %d connections %d blocks %d transactions"), vNodes.size(), nBestHeight + 1, nTransactionCount);
|
||||
string strStatus = strprintf(_(" %d connections %d blocks %d transactions"), vNodes.size(), nBestHeight, nTransactionCount);
|
||||
m_statusBar->SetStatusText(strStatus, 2);
|
||||
|
||||
if (fDebug && GetTime() - nThreadSocketHandlerHeartbeat > 60)
|
||||
m_statusBar->SetStatusText(" ERROR: ThreadSocketHandler has stopped", 0);
|
||||
|
||||
// Update receiving address
|
||||
string strDefaultAddress = PubKeyToAddress(vchDefaultKey);
|
||||
if (m_textCtrlAddress->GetValue() != strDefaultAddress)
|
||||
@@ -1132,14 +1167,14 @@ void CMainFrame::OnButtonNew(wxCommandEvent& event)
|
||||
// Ask name
|
||||
CGetTextFromUserDialog dialog(this,
|
||||
_("New Receiving Address"),
|
||||
_("It's good policy to use a new address for each payment you receive.\n\nLabel"),
|
||||
_("You should use a new address for each payment you receive.\n\nLabel"),
|
||||
"");
|
||||
if (!dialog.ShowModal())
|
||||
return;
|
||||
string strName = dialog.GetValue();
|
||||
|
||||
// Generate new key
|
||||
string strAddress = PubKeyToAddress(GenerateNewKey());
|
||||
string strAddress = PubKeyToAddress(GetKeyFromKeyPool());
|
||||
|
||||
// Save
|
||||
SetAddressBookName(strAddress, strName);
|
||||
@@ -1344,10 +1379,10 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails
|
||||
if (fAllToMe)
|
||||
{
|
||||
// Payment to self
|
||||
/// issue: can't tell which is the payment and which is the change anymore
|
||||
//int64 nValue = wtx.vout[0].nValue;
|
||||
//strHTML += _("<b>Debit:</b> ") + FormatMoney(-nValue) + "<br>";
|
||||
//strHTML += _("<b>Credit:</b> ") + FormatMoney(nValue) + "<br>";
|
||||
int64 nChange = wtx.GetChange();
|
||||
int64 nValue = nCredit - nChange;
|
||||
strHTML += _("<b>Debit:</b> ") + FormatMoney(-nValue) + "<br>";
|
||||
strHTML += _("<b>Credit:</b> ") + FormatMoney(nValue) + "<br>";
|
||||
}
|
||||
|
||||
int64 nTxFee = nDebit - wtx.GetValueOut();
|
||||
@@ -1376,6 +1411,8 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails
|
||||
//
|
||||
if (!wtx.mapValue["message"].empty())
|
||||
strHTML += string() + "<br><b>" + _("Message:") + "</b><br>" + HtmlEscape(wtx.mapValue["message"], true) + "<br>";
|
||||
if (!wtx.mapValue["comment"].empty())
|
||||
strHTML += string() + "<br><b>" + _("Comment:") + "</b><br>" + HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
|
||||
|
||||
if (wtx.IsCoinBase())
|
||||
strHTML += string() + "<br>" + _("Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.") + "<br>";
|
||||
@@ -1394,7 +1431,10 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails
|
||||
if (txout.IsMine())
|
||||
strHTML += "<b>Credit:</b> " + FormatMoney(txout.GetCredit()) + "<br>";
|
||||
|
||||
strHTML += "<b>Inputs:</b><br>";
|
||||
strHTML += "<br><b>Transaction:</b><br>";
|
||||
strHTML += HtmlEscape(wtx.ToString(), true);
|
||||
|
||||
strHTML += "<br><b>Inputs:</b><br>";
|
||||
CRITICAL_BLOCK(cs_mapWallet)
|
||||
{
|
||||
foreach(const CTxIn& txin, wtx.vin)
|
||||
@@ -1413,9 +1453,6 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
strHTML += "<br><hr><br><b>Transaction:</b><br>";
|
||||
strHTML += HtmlEscape(wtx.ToString(), true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1429,14 +1466,163 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails
|
||||
|
||||
void CTxDetailsDialog::OnButtonOK(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
//Destroy();
|
||||
EndModal(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Startup folder
|
||||
//
|
||||
|
||||
#ifdef __WXMSW__
|
||||
string StartupShortcutPath()
|
||||
{
|
||||
return MyGetSpecialFolderPath(CSIDL_STARTUP, true) + "\\Bitcoin.lnk";
|
||||
}
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
return filesystem::exists(StartupShortcutPath().c_str());
|
||||
}
|
||||
|
||||
void SetStartOnSystemStartup(bool fAutoStart)
|
||||
{
|
||||
// If the shortcut exists already, remove it for updating
|
||||
remove(StartupShortcutPath().c_str());
|
||||
|
||||
if (fAutoStart)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
// Get a pointer to the IShellLink interface.
|
||||
IShellLink* psl = NULL;
|
||||
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL,
|
||||
CLSCTX_INPROC_SERVER, IID_IShellLink,
|
||||
reinterpret_cast<void**>(&psl));
|
||||
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
// Get the current executable path
|
||||
TCHAR pszExePath[MAX_PATH];
|
||||
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
|
||||
|
||||
// Set the path to the shortcut target
|
||||
psl->SetPath(pszExePath);
|
||||
PathRemoveFileSpec(pszExePath);
|
||||
psl->SetWorkingDirectory(pszExePath);
|
||||
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
|
||||
|
||||
// Query IShellLink for the IPersistFile interface for
|
||||
// saving the shortcut in persistent storage.
|
||||
IPersistFile* ppf = NULL;
|
||||
hres = psl->QueryInterface(IID_IPersistFile,
|
||||
reinterpret_cast<void**>(&ppf));
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
WCHAR pwsz[MAX_PATH];
|
||||
// Ensure that the string is ANSI.
|
||||
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().c_str(), -1, pwsz, MAX_PATH);
|
||||
// Save the link by calling IPersistFile::Save.
|
||||
hres = ppf->Save(pwsz, TRUE);
|
||||
ppf->Release();
|
||||
}
|
||||
psl->Release();
|
||||
}
|
||||
CoUninitialize();
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__WXGTK__)
|
||||
|
||||
// Follow the Desktop Application Autostart Spec:
|
||||
// http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
|
||||
|
||||
boost::filesystem::path GetAutostartDir()
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
char* pszConfigHome = getenv("XDG_CONFIG_HOME");
|
||||
if (pszConfigHome) return fs::path(pszConfigHome) / fs::path("autostart");
|
||||
char* pszHome = getenv("HOME");
|
||||
if (pszHome) return fs::path(pszHome) / fs::path(".config/autostart");
|
||||
return fs::path();
|
||||
}
|
||||
|
||||
boost::filesystem::path GetAutostartFilePath()
|
||||
{
|
||||
return GetAutostartDir() / boost::filesystem::path("bitcoin.desktop");
|
||||
}
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
boost::filesystem::ifstream optionFile(GetAutostartFilePath());
|
||||
if (!optionFile.good())
|
||||
return false;
|
||||
// Scan through file for "Hidden=true":
|
||||
string line;
|
||||
while (!optionFile.eof())
|
||||
{
|
||||
getline(optionFile, line);
|
||||
if (line.find("Hidden") != string::npos &&
|
||||
line.find("true") != string::npos)
|
||||
return false;
|
||||
}
|
||||
optionFile.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetStartOnSystemStartup(bool fAutoStart)
|
||||
{
|
||||
if (!fAutoStart)
|
||||
{
|
||||
unlink(GetAutostartFilePath().native_file_string().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
char pszExePath[MAX_PATH+1];
|
||||
memset(pszExePath, 0, sizeof(pszExePath));
|
||||
if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
|
||||
return;
|
||||
|
||||
boost::filesystem::create_directories(GetAutostartDir());
|
||||
|
||||
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), ios_base::out|ios_base::trunc);
|
||||
if (!optionFile.good())
|
||||
{
|
||||
wxMessageBox(_("Cannot write autostart/bitcoin.desktop file"), "Bitcoin");
|
||||
return;
|
||||
}
|
||||
// Write a bitcoin.desktop file to the autostart directory:
|
||||
optionFile << "[Desktop Entry]\n";
|
||||
optionFile << "Type=Application\n";
|
||||
optionFile << "Name=Bitcoin\n";
|
||||
optionFile << "Exec=" << pszExePath << "\n";
|
||||
optionFile << "Terminal=false\n";
|
||||
optionFile << "Hidden=false\n";
|
||||
optionFile.close();
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
// TODO: OSX startup stuff; see:
|
||||
// http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/CustomLogin.html
|
||||
|
||||
bool GetStartOnSystemStartup() { return false; }
|
||||
void SetStartOnSystemStartup(bool fAutoStart) { }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// COptionsDialog
|
||||
@@ -1449,9 +1635,12 @@ COptionsDialog::COptionsDialog(wxWindow* parent) : COptionsDialogBase(parent)
|
||||
//m_listBox->Append(_("Test 2"));
|
||||
m_listBox->SetSelection(0);
|
||||
SelectPage(0);
|
||||
#ifdef __WXGTK__
|
||||
#ifndef __WXMSW__
|
||||
SetSize(1.0 * GetSize().GetWidth(), 1.2 * GetSize().GetHeight());
|
||||
#endif
|
||||
#if defined(__WXGTK__) || defined(__WXMAC_OSX__)
|
||||
m_checkBoxStartOnSystemStartup->SetLabel(_("&Start Bitcoin on window system startup"));
|
||||
if (!mapArgs.count("-minimizetotray"))
|
||||
if (!GetBoolArg("-minimizetotray"))
|
||||
{
|
||||
// Minimize to tray is just too buggy on Linux
|
||||
fMinimizeToTray = false;
|
||||
@@ -1546,12 +1735,12 @@ void COptionsDialog::OnKillFocusProxy(wxFocusEvent& event)
|
||||
void COptionsDialog::OnButtonOK(wxCommandEvent& event)
|
||||
{
|
||||
OnButtonApply(event);
|
||||
Close();
|
||||
EndModal(false);
|
||||
}
|
||||
|
||||
void COptionsDialog::OnButtonCancel(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
EndModal(false);
|
||||
}
|
||||
|
||||
void COptionsDialog::OnButtonApply(wxCommandEvent& event)
|
||||
@@ -1606,6 +1795,7 @@ void COptionsDialog::OnButtonApply(wxCommandEvent& event)
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CAboutDialog
|
||||
@@ -1613,7 +1803,7 @@ void COptionsDialog::OnButtonApply(wxCommandEvent& event)
|
||||
|
||||
CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent)
|
||||
{
|
||||
m_staticTextVersion->SetLabel(strprintf(_("version %d.%d.%d beta"), VERSION/10000, (VERSION/100)%100, VERSION%100));
|
||||
m_staticTextVersion->SetLabel(strprintf(_("version %s%s BETA"), FormatVersion(VERSION).c_str(), pszSubVer));
|
||||
|
||||
// Change (c) into UTF-8 or ANSI copyright symbol
|
||||
wxString str = m_staticTextMain->GetLabel();
|
||||
@@ -1637,7 +1827,7 @@ CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent)
|
||||
|
||||
void CAboutDialog::OnButtonOK(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
EndModal(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1699,7 +1889,7 @@ void CSendDialog::OnTextAddress(wxCommandEvent& event)
|
||||
{
|
||||
strFromSave = m_textCtrlFrom->GetValue();
|
||||
strMessageSave = m_textCtrlMessage->GetValue();
|
||||
m_textCtrlFrom->SetValue(_("Will appear as \"From: Unknown\""));
|
||||
m_textCtrlFrom->SetValue(_("n/a"));
|
||||
m_textCtrlMessage->SetValue(_("Can't include a message when sending to a Bitcoin address"));
|
||||
}
|
||||
else if (fEnable && !fEnabledPrev)
|
||||
@@ -1746,69 +1936,78 @@ void CSendDialog::OnButtonPaste(wxCommandEvent& event)
|
||||
|
||||
void CSendDialog::OnButtonSend(wxCommandEvent& event)
|
||||
{
|
||||
CWalletTx wtx;
|
||||
string strAddress = (string)m_textCtrlAddress->GetValue();
|
||||
static CCriticalSection cs_sendlock;
|
||||
TRY_CRITICAL_BLOCK(cs_sendlock)
|
||||
{
|
||||
CWalletTx wtx;
|
||||
string strAddress = (string)m_textCtrlAddress->GetValue();
|
||||
|
||||
// Parse amount
|
||||
int64 nValue = 0;
|
||||
if (!ParseMoney(m_textCtrlAmount->GetValue(), nValue) || nValue <= 0)
|
||||
{
|
||||
wxMessageBox(_("Error in amount "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
if (nValue > GetBalance())
|
||||
{
|
||||
wxMessageBox(_("Amount exceeds your balance "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
if (nValue + nTransactionFee > GetBalance())
|
||||
{
|
||||
wxMessageBox(string(_("Total exceeds your balance when the ")) + FormatMoney(nTransactionFee) + _(" transaction fee is included "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse bitcoin address
|
||||
uint160 hash160;
|
||||
bool fBitcoinAddress = AddressToHash160(strAddress, hash160);
|
||||
|
||||
if (fBitcoinAddress)
|
||||
{
|
||||
// Send to bitcoin address
|
||||
CScript scriptPubKey;
|
||||
scriptPubKey << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
|
||||
string strError = SendMoney(scriptPubKey, nValue, wtx, true);
|
||||
if (strError == "")
|
||||
wxMessageBox(_("Payment sent "), _("Sending..."));
|
||||
else if (strError != "ABORTED")
|
||||
wxMessageBox(strError + " ", _("Sending..."));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse IP address
|
||||
CAddress addr(strAddress);
|
||||
if (!addr.IsValid())
|
||||
// Parse amount
|
||||
int64 nValue = 0;
|
||||
if (!ParseMoney(m_textCtrlAmount->GetValue(), nValue) || nValue <= 0)
|
||||
{
|
||||
wxMessageBox(_("Invalid address "), _("Send Coins"));
|
||||
wxMessageBox(_("Error in amount "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
if (nValue > GetBalance())
|
||||
{
|
||||
wxMessageBox(_("Amount exceeds your balance "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
if (nValue + nTransactionFee > GetBalance())
|
||||
{
|
||||
wxMessageBox(string(_("Total exceeds your balance when the ")) + FormatMoney(nTransactionFee) + _(" transaction fee is included "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Message
|
||||
wtx.mapValue["to"] = strAddress;
|
||||
wtx.mapValue["from"] = m_textCtrlFrom->GetValue();
|
||||
wtx.mapValue["message"] = m_textCtrlMessage->GetValue();
|
||||
// Parse bitcoin address
|
||||
uint160 hash160;
|
||||
bool fBitcoinAddress = AddressToHash160(strAddress, hash160);
|
||||
|
||||
// Send to IP address
|
||||
CSendingDialog* pdialog = new CSendingDialog(this, addr, nValue, wtx);
|
||||
if (!pdialog->ShowModal())
|
||||
return;
|
||||
if (fBitcoinAddress)
|
||||
{
|
||||
// Send to bitcoin address
|
||||
CScript scriptPubKey;
|
||||
scriptPubKey << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
|
||||
string strError = SendMoney(scriptPubKey, nValue, wtx, true);
|
||||
if (strError == "")
|
||||
wxMessageBox(_("Payment sent "), _("Sending..."));
|
||||
else if (strError == "ABORTED")
|
||||
return; // leave send dialog open
|
||||
else
|
||||
{
|
||||
wxMessageBox(strError + " ", _("Sending..."));
|
||||
EndModal(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse IP address
|
||||
CAddress addr(strAddress);
|
||||
if (!addr.IsValid())
|
||||
{
|
||||
wxMessageBox(_("Invalid address "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Message
|
||||
wtx.mapValue["to"] = strAddress;
|
||||
wtx.mapValue["from"] = m_textCtrlFrom->GetValue();
|
||||
wtx.mapValue["message"] = m_textCtrlMessage->GetValue();
|
||||
|
||||
// Send to IP address
|
||||
CSendingDialog* pdialog = new CSendingDialog(this, addr, nValue, wtx);
|
||||
if (!pdialog->ShowModal())
|
||||
return;
|
||||
}
|
||||
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
if (!mapAddressBook.count(strAddress))
|
||||
SetAddressBookName(strAddress, "");
|
||||
|
||||
EndModal(true);
|
||||
}
|
||||
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
if (!mapAddressBook.count(strAddress))
|
||||
SetAddressBookName(strAddress, "");
|
||||
|
||||
EndModal(true);
|
||||
}
|
||||
|
||||
void CSendDialog::OnButtonCancel(wxCommandEvent& event)
|
||||
@@ -2027,8 +2226,12 @@ void CSendingDialog::OnReply2(CDataStream& vRecv)
|
||||
if (nRet > 0)
|
||||
{
|
||||
string strMessage;
|
||||
vRecv >> strMessage;
|
||||
Error(_("Transfer was not accepted"));
|
||||
if (!vRecv.empty())
|
||||
vRecv >> strMessage;
|
||||
if (nRet == 2)
|
||||
Error(_("Recipient is not accepting transactions sent by IP address"));
|
||||
else
|
||||
Error(_("Transfer was not accepted"));
|
||||
//// todo: enlarge the window and enable a hidden white box to put seller's message
|
||||
return;
|
||||
}
|
||||
@@ -2059,9 +2262,9 @@ void CSendingDialog::OnReply2(CDataStream& vRecv)
|
||||
Error(_("Insufficient funds"));
|
||||
return;
|
||||
}
|
||||
CKey key;
|
||||
CReserveKey reservekey;
|
||||
int64 nFeeRequired;
|
||||
if (!CreateTransaction(scriptPubKey, nPrice, wtx, key, nFeeRequired))
|
||||
if (!CreateTransaction(scriptPubKey, nPrice, wtx, reservekey, nFeeRequired))
|
||||
{
|
||||
if (nPrice + nFeeRequired > GetBalance())
|
||||
Error(strprintf(_("This is an oversized transaction that requires a transaction fee of %s"), FormatMoney(nFeeRequired).c_str()));
|
||||
@@ -2101,7 +2304,7 @@ void CSendingDialog::OnReply2(CDataStream& vRecv)
|
||||
return;
|
||||
|
||||
// Commit
|
||||
if (!CommitTransaction(wtx, key))
|
||||
if (!CommitTransaction(wtx, reservekey))
|
||||
{
|
||||
Error(_("The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."));
|
||||
return;
|
||||
@@ -2372,14 +2575,14 @@ void CAddressBookDialog::OnButtonNew(wxCommandEvent& event)
|
||||
// Ask name
|
||||
CGetTextFromUserDialog dialog(this,
|
||||
_("New Receiving Address"),
|
||||
_("It's good policy to use a new address for each payment you receive.\n\nLabel"),
|
||||
_("You should use a new address for each payment you receive.\n\nLabel"),
|
||||
"");
|
||||
if (!dialog.ShowModal())
|
||||
return;
|
||||
strName = dialog.GetValue();
|
||||
|
||||
// Generate new key
|
||||
strAddress = PubKeyToAddress(GenerateNewKey());
|
||||
strAddress = PubKeyToAddress(GetKeyFromKeyPool());
|
||||
}
|
||||
|
||||
// Add to list and select it
|
||||
@@ -2537,20 +2740,18 @@ wxMenu* CMyTaskBarIcon::CreatePopupMenu()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMyApp
|
||||
//
|
||||
|
||||
void CreateMainWindow()
|
||||
{
|
||||
pframeMain = new CMainFrame(NULL);
|
||||
if (mapArgs.count("-min"))
|
||||
if (GetBoolArg("-min"))
|
||||
pframeMain->Iconize(true);
|
||||
#ifdef __WXGTK__
|
||||
if (!mapArgs.count("-minimizetotray"))
|
||||
#if defined(__WXGTK__) || defined(__WXMAC_OSX__)
|
||||
if (!GetBoolArg("-minimizetotray"))
|
||||
fMinimizeToTray = false;
|
||||
#endif
|
||||
pframeMain->Show(true); // have to show first to get taskbar button to hide
|
||||
@@ -2560,3 +2761,189 @@ void CreateMainWindow()
|
||||
ptaskbaricon->Show(fMinimizeToTray || fClosedToTray);
|
||||
CreateThread(ThreadDelayedRepaint, NULL);
|
||||
}
|
||||
|
||||
|
||||
// Define a new application
|
||||
class CMyApp : public wxApp
|
||||
{
|
||||
public:
|
||||
CMyApp(){};
|
||||
~CMyApp(){};
|
||||
bool OnInit();
|
||||
bool OnInit2();
|
||||
int OnExit();
|
||||
|
||||
// Hook Initialize so we can start without GUI
|
||||
virtual bool Initialize(int& argc, wxChar** argv);
|
||||
|
||||
// 2nd-level exception handling: we get all the exceptions occurring in any
|
||||
// event handler here
|
||||
virtual bool OnExceptionInMainLoop();
|
||||
|
||||
// 3rd, and final, level exception handling: whenever an unhandled
|
||||
// exception is caught, this function is called
|
||||
virtual void OnUnhandledException();
|
||||
|
||||
// and now for something different: this function is called in case of a
|
||||
// crash (e.g. dereferencing null pointer, division by 0, ...)
|
||||
virtual void OnFatalException();
|
||||
};
|
||||
|
||||
IMPLEMENT_APP(CMyApp)
|
||||
|
||||
bool CMyApp::Initialize(int& argc, wxChar** argv)
|
||||
{
|
||||
for (int i = 1; i < argc; i++)
|
||||
if (!IsSwitchChar(argv[i][0]))
|
||||
fCommandLine = true;
|
||||
|
||||
if (!fCommandLine)
|
||||
{
|
||||
// wxApp::Initialize will remove environment-specific parameters,
|
||||
// so it's too early to call ParseParameters yet
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
wxString str = argv[i];
|
||||
#ifdef __WXMSW__
|
||||
if (str.size() >= 1 && str[0] == '/')
|
||||
str[0] = '-';
|
||||
char pszLower[MAX_PATH];
|
||||
strlcpy(pszLower, str.c_str(), sizeof(pszLower));
|
||||
strlwr(pszLower);
|
||||
str = pszLower;
|
||||
#endif
|
||||
if (str == "-daemon")
|
||||
fDaemon = true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __WXGTK__
|
||||
if (fDaemon || fCommandLine)
|
||||
{
|
||||
// Call the original Initialize while suppressing error messages
|
||||
// and ignoring failure. If unable to initialize GTK, it fails
|
||||
// near the end so hopefully the last few things don't matter.
|
||||
{
|
||||
wxLogNull logNo;
|
||||
wxApp::Initialize(argc, argv);
|
||||
}
|
||||
|
||||
if (fDaemon)
|
||||
{
|
||||
// Daemonize
|
||||
pid_t pid = fork();
|
||||
if (pid < 0)
|
||||
{
|
||||
fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
|
||||
return false;
|
||||
}
|
||||
if (pid > 0)
|
||||
pthread_exit((void*)0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return wxApp::Initialize(argc, argv);
|
||||
}
|
||||
|
||||
bool CMyApp::OnInit()
|
||||
{
|
||||
#if defined(__WXMSW__) && defined(__WXDEBUG__) && defined(GUI)
|
||||
// Disable malfunctioning wxWidgets debug assertion
|
||||
extern int g_isPainting;
|
||||
g_isPainting = 10000;
|
||||
#endif
|
||||
#ifdef GUI
|
||||
wxImage::AddHandler(new wxPNGHandler);
|
||||
#endif
|
||||
#if defined(__WXMSW__ ) || defined(__WXMAC_OSX__)
|
||||
SetAppName("Bitcoin");
|
||||
#else
|
||||
SetAppName("bitcoin");
|
||||
#endif
|
||||
#ifdef __WXMSW__
|
||||
#if wxUSE_UNICODE
|
||||
// Hack to set wxConvLibc codepage to UTF-8 on Windows,
|
||||
// may break if wxMBConv_win32 implementation in strconv.cpp changes.
|
||||
class wxMBConv_win32 : public wxMBConv
|
||||
{
|
||||
public:
|
||||
long m_CodePage;
|
||||
size_t m_minMBCharWidth;
|
||||
};
|
||||
if (((wxMBConv_win32*)&wxConvLibc)->m_CodePage == CP_ACP)
|
||||
((wxMBConv_win32*)&wxConvLibc)->m_CodePage = CP_UTF8;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Load locale/<lang>/LC_MESSAGES/bitcoin.mo language file
|
||||
g_locale.Init(wxLANGUAGE_DEFAULT, 0);
|
||||
g_locale.AddCatalogLookupPathPrefix("locale");
|
||||
#ifndef __WXMSW__
|
||||
g_locale.AddCatalogLookupPathPrefix("/usr/share/locale");
|
||||
g_locale.AddCatalogLookupPathPrefix("/usr/local/share/locale");
|
||||
#endif
|
||||
g_locale.AddCatalog("wxstd"); // wxWidgets standard translations, if any
|
||||
g_locale.AddCatalog("bitcoin");
|
||||
|
||||
return AppInit(argc, argv);
|
||||
}
|
||||
|
||||
int CMyApp::OnExit()
|
||||
{
|
||||
Shutdown(NULL);
|
||||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
bool CMyApp::OnExceptionInMainLoop()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
PrintException(&e, "CMyApp::OnExceptionInMainLoop()");
|
||||
wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PrintException(NULL, "CMyApp::OnExceptionInMainLoop()");
|
||||
wxLogWarning("Unknown exception");
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMyApp::OnUnhandledException()
|
||||
{
|
||||
// this shows how we may let some exception propagate uncaught
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
PrintException(&e, "CMyApp::OnUnhandledException()");
|
||||
wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PrintException(NULL, "CMyApp::OnUnhandledException()");
|
||||
wxLogWarning("Unknown exception");
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void CMyApp::OnFatalException()
|
||||
{
|
||||
wxMessageBox(_("Program has crashed and will terminate. "), "Bitcoin", wxOK | wxICON_ERROR);
|
||||
}
|
||||
|
||||
80
ui.h
80
ui.h
@@ -4,15 +4,27 @@
|
||||
|
||||
DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1)
|
||||
|
||||
#if wxUSE_GUI
|
||||
static const bool fGUI=true;
|
||||
#else
|
||||
static const bool fGUI=false;
|
||||
#endif
|
||||
|
||||
|
||||
extern wxLocale g_locale;
|
||||
|
||||
|
||||
|
||||
void HandleCtrlA(wxKeyEvent& event);
|
||||
void UIThreadCall(boost::function0<void>);
|
||||
int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1);
|
||||
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent);
|
||||
void CalledSetStatusBar(const string& strText, int nField);
|
||||
void MainFrameRepaint();
|
||||
void CreateMainWindow();
|
||||
void SetStartOnSystemStartup(bool fAutoStart);
|
||||
|
||||
|
||||
|
||||
|
||||
inline int MyMessageBox(const wxString& message, const wxString& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1)
|
||||
{
|
||||
#if wxUSE_GUI
|
||||
#ifdef GUI
|
||||
if (!fDaemon)
|
||||
return wxMessageBox(message, caption, style, parent, x, y);
|
||||
#endif
|
||||
@@ -25,49 +37,6 @@ inline int MyMessageBox(const wxString& message, const wxString& caption="Messag
|
||||
|
||||
|
||||
|
||||
void HandleCtrlA(wxKeyEvent& event);
|
||||
string FormatTxStatus(const CWalletTx& wtx);
|
||||
void UIThreadCall(boost::function0<void>);
|
||||
int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1);
|
||||
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent);
|
||||
void CalledSetStatusBar(const string& strText, int nField);
|
||||
void MainFrameRepaint();
|
||||
void CreateMainWindow();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if !wxUSE_GUI
|
||||
inline int ThreadSafeMessageBox(const string& message, const string& caption, int style, wxWindow* parent, int x, int y)
|
||||
{
|
||||
return MyMessageBox(message, caption, style, parent, x, y);
|
||||
}
|
||||
|
||||
inline bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void CalledSetStatusBar(const string& strText, int nField)
|
||||
{
|
||||
}
|
||||
|
||||
inline void UIThreadCall(boost::function0<void> fn)
|
||||
{
|
||||
}
|
||||
|
||||
inline void MainFrameRepaint()
|
||||
{
|
||||
}
|
||||
|
||||
inline void CreateMainWindow()
|
||||
{
|
||||
}
|
||||
#else // wxUSE_GUI
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CMainFrame : public CMainFrameBase
|
||||
@@ -126,7 +95,7 @@ public:
|
||||
|
||||
void OnUIThreadCall(wxCommandEvent& event);
|
||||
int GetSortIndex(const string& strSort);
|
||||
void InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxString& str1, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5);
|
||||
void InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxColour& colour, const wxString& str1, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5);
|
||||
bool DeleteLine(uint256 hashKey);
|
||||
bool InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex=-1);
|
||||
void RefreshListCtrl();
|
||||
@@ -334,11 +303,10 @@ public:
|
||||
m_textCtrl2->SetValue(strValue2);
|
||||
y += 46 + wxString(strMessage2).Freq('\n') * 14;
|
||||
}
|
||||
if (!fWindows)
|
||||
{
|
||||
x *= 1.14;
|
||||
y *= 1.14;
|
||||
}
|
||||
#ifndef __WXMSW__
|
||||
x = x * 114 / 100;
|
||||
y = y * 114 / 100;
|
||||
#endif
|
||||
SetSize(x, y);
|
||||
}
|
||||
|
||||
@@ -375,5 +343,3 @@ public:
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
30
ui.rc
30
ui.rc
@@ -1,15 +1,15 @@
|
||||
bitcoin ICON "rc/bitcoin.ico"
|
||||
|
||||
#include "wx/msw/wx.rc"
|
||||
|
||||
check ICON "rc/check.ico"
|
||||
send16 BITMAP "rc/send16.bmp"
|
||||
send16mask BITMAP "rc/send16mask.bmp"
|
||||
send16masknoshadow BITMAP "rc/send16masknoshadow.bmp"
|
||||
send20 BITMAP "rc/send20.bmp"
|
||||
send20mask BITMAP "rc/send20mask.bmp"
|
||||
addressbook16 BITMAP "rc/addressbook16.bmp"
|
||||
addressbook16mask BITMAP "rc/addressbook16mask.bmp"
|
||||
addressbook20 BITMAP "rc/addressbook20.bmp"
|
||||
addressbook20mask BITMAP "rc/addressbook20mask.bmp"
|
||||
favicon ICON "rc/favicon.ico"
|
||||
bitcoin ICON "rc/bitcoin.ico"
|
||||
|
||||
#include "wx/msw/wx.rc"
|
||||
|
||||
check ICON "rc/check.ico"
|
||||
send16 BITMAP "rc/send16.bmp"
|
||||
send16mask BITMAP "rc/send16mask.bmp"
|
||||
send16masknoshadow BITMAP "rc/send16masknoshadow.bmp"
|
||||
send20 BITMAP "rc/send20.bmp"
|
||||
send20mask BITMAP "rc/send20mask.bmp"
|
||||
addressbook16 BITMAP "rc/addressbook16.bmp"
|
||||
addressbook16mask BITMAP "rc/addressbook16mask.bmp"
|
||||
addressbook20 BITMAP "rc/addressbook20.bmp"
|
||||
addressbook20mask BITMAP "rc/addressbook20mask.bmp"
|
||||
favicon ICON "rc/favicon.ico"
|
||||
|
||||
48
uibase.cpp
48
uibase.cpp
@@ -61,7 +61,6 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
m_toolBar->Realize();
|
||||
|
||||
m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
|
||||
m_statusBar->SetBackgroundColour( wxColour( 240, 240, 240 ) );
|
||||
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||
@@ -352,28 +351,6 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w
|
||||
|
||||
bSizer69->Add( 0, 16, 0, wxEXPAND, 5 );
|
||||
|
||||
m_staticText32 = new wxStaticText( m_panelMain, wxID_ANY, _("Optional transaction fee you give to the nodes that process your transactions."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText32->Wrap( -1 );
|
||||
m_staticText32->Hide();
|
||||
|
||||
bSizer69->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizer56;
|
||||
bSizer56 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText31 = new wxStaticText( m_panelMain, wxID_ANY, _("Transaction fee:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText31->Wrap( -1 );
|
||||
m_staticText31->Hide();
|
||||
|
||||
bSizer56->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlTransactionFee = new wxTextCtrl( m_panelMain, wxID_TRANSACTIONFEE, wxEmptyString, wxDefaultPosition, wxSize( 70,-1 ), 0 );
|
||||
m_textCtrlTransactionFee->Hide();
|
||||
|
||||
bSizer56->Add( m_textCtrlTransactionFee, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
bSizer69->Add( bSizer56, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer71;
|
||||
bSizer71 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
@@ -435,6 +412,25 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w
|
||||
|
||||
bSizer69->Add( bSizer103, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer69->Add( 0, 1, 0, 0, 5 );
|
||||
|
||||
m_staticText32 = new wxStaticText( m_panelMain, wxID_ANY, _("Optional transaction fee per KB that helps make sure your transactions are processed quickly. Most transactions are 1KB. Fee 0.01 recommended."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText32->Wrap( 365 );
|
||||
bSizer69->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSizer56;
|
||||
bSizer56 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText31 = new wxStaticText( m_panelMain, wxID_ANY, _("Pay transaction fee:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText31->Wrap( -1 );
|
||||
bSizer56->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlTransactionFee = new wxTextCtrl( m_panelMain, wxID_TRANSACTIONFEE, wxEmptyString, wxDefaultPosition, wxSize( 70,-1 ), 0 );
|
||||
bSizer56->Add( m_textCtrlTransactionFee, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
bSizer69->Add( bSizer56, 0, wxEXPAND, 5 );
|
||||
|
||||
m_panelMain->SetSizer( bSizer69 );
|
||||
m_panelMain->Layout();
|
||||
bSizer69->Fit( m_panelMain );
|
||||
@@ -486,12 +482,12 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w
|
||||
|
||||
// Connect Events
|
||||
m_listBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( COptionsDialogBase::OnListBox ), NULL, this );
|
||||
m_textCtrlTransactionFee->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusTransactionFee ), NULL, this );
|
||||
m_checkBoxLimitProcessors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxLimitProcessors ), NULL, this );
|
||||
m_checkBoxMinimizeToTray->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxMinimizeToTray ), NULL, this );
|
||||
m_checkBoxUseProxy->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxUseProxy ), NULL, this );
|
||||
m_textCtrlProxyIP->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this );
|
||||
m_textCtrlProxyPort->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this );
|
||||
m_textCtrlTransactionFee->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusTransactionFee ), NULL, this );
|
||||
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonOK ), NULL, this );
|
||||
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonCancel ), NULL, this );
|
||||
m_buttonApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonApply ), NULL, this );
|
||||
@@ -501,12 +497,12 @@ COptionsDialogBase::~COptionsDialogBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_listBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( COptionsDialogBase::OnListBox ), NULL, this );
|
||||
m_textCtrlTransactionFee->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusTransactionFee ), NULL, this );
|
||||
m_checkBoxLimitProcessors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxLimitProcessors ), NULL, this );
|
||||
m_checkBoxMinimizeToTray->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxMinimizeToTray ), NULL, this );
|
||||
m_checkBoxUseProxy->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxUseProxy ), NULL, this );
|
||||
m_textCtrlProxyIP->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this );
|
||||
m_textCtrlProxyPort->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this );
|
||||
m_textCtrlTransactionFee->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusTransactionFee ), NULL, this );
|
||||
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonOK ), NULL, this );
|
||||
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonCancel ), NULL, this );
|
||||
m_buttonApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonApply ), NULL, this );
|
||||
@@ -554,7 +550,7 @@ CAboutDialogBase::CAboutDialogBase( wxWindow* parent, wxWindowID id, const wxStr
|
||||
|
||||
bSizer631->Add( 0, 4, 0, wxEXPAND, 5 );
|
||||
|
||||
m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright (c) 2009-2010 Satoshi Nakamoto.\n\nThis is experimental software.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young (eay@cryptsoft.com)."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright (c) 2009-2010 Bitcoin Developers\n\nThis is experimental software.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young (eay@cryptsoft.com)."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextMain->Wrap( -1 );
|
||||
bSizer631->Add( m_staticTextMain, 0, wxALL, 5 );
|
||||
|
||||
|
||||
17
uibase.h
17
uibase.h
@@ -47,9 +47,9 @@
|
||||
#define wxID_TEXTCTRLADDRESS 1004
|
||||
#define wxID_BUTTONNEW 1005
|
||||
#define wxID_BUTTONCOPY 1006
|
||||
#define wxID_TRANSACTIONFEE 1007
|
||||
#define wxID_PROXYIP 1008
|
||||
#define wxID_PROXYPORT 1009
|
||||
#define wxID_PROXYIP 1007
|
||||
#define wxID_PROXYPORT 1008
|
||||
#define wxID_TRANSACTIONFEE 1009
|
||||
#define wxID_TEXTCTRLPAYTO 1010
|
||||
#define wxID_BUTTONPASTE 1011
|
||||
#define wxID_BUTTONADDRESSBOOK 1012
|
||||
@@ -163,9 +163,6 @@ class COptionsDialogBase : public wxDialog
|
||||
wxScrolledWindow* m_scrolledWindow;
|
||||
wxPanel* m_panelMain;
|
||||
|
||||
wxStaticText* m_staticText32;
|
||||
wxStaticText* m_staticText31;
|
||||
wxTextCtrl* m_textCtrlTransactionFee;
|
||||
wxCheckBox* m_checkBoxLimitProcessors;
|
||||
wxSpinCtrl* m_spinCtrlLimitProcessors;
|
||||
wxStaticText* m_staticText35;
|
||||
@@ -178,6 +175,10 @@ class COptionsDialogBase : public wxDialog
|
||||
wxTextCtrl* m_textCtrlProxyIP;
|
||||
wxStaticText* m_staticTextProxyPort;
|
||||
wxTextCtrl* m_textCtrlProxyPort;
|
||||
|
||||
wxStaticText* m_staticText32;
|
||||
wxStaticText* m_staticText31;
|
||||
wxTextCtrl* m_textCtrlTransactionFee;
|
||||
wxPanel* m_panelTest2;
|
||||
|
||||
wxStaticText* m_staticText321;
|
||||
@@ -188,11 +189,11 @@ class COptionsDialogBase : public wxDialog
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnListBox( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnKillFocusTransactionFee( wxFocusEvent& event ){ event.Skip(); }
|
||||
virtual void OnCheckBoxLimitProcessors( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnCheckBoxMinimizeToTray( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnCheckBoxUseProxy( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnKillFocusProxy( wxFocusEvent& event ){ event.Skip(); }
|
||||
virtual void OnKillFocusTransactionFee( wxFocusEvent& event ){ event.Skip(); }
|
||||
virtual void OnButtonOK( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnButtonCancel( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnButtonApply( wxCommandEvent& event ){ event.Skip(); }
|
||||
@@ -227,7 +228,7 @@ class CAboutDialogBase : public wxDialog
|
||||
|
||||
public:
|
||||
wxStaticText* m_staticTextVersion;
|
||||
CAboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 532,329 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
CAboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 532,333 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~CAboutDialogBase();
|
||||
|
||||
};
|
||||
|
||||
12674
uiproject.fbp
12674
uiproject.fbp
File diff suppressed because it is too large
Load Diff
258
util.cpp
258
util.cpp
@@ -11,9 +11,20 @@ bool fDebug = false;
|
||||
bool fPrintToConsole = false;
|
||||
bool fPrintToDebugger = false;
|
||||
char pszSetDataDir[MAX_PATH] = "";
|
||||
bool fRequestShutdown = false;
|
||||
bool fShutdown = false;
|
||||
bool fDaemon = false;
|
||||
bool fCommandLine = false;
|
||||
string strMiscWarning;
|
||||
bool fTestNet = false;
|
||||
bool fNoListen = false;
|
||||
|
||||
|
||||
|
||||
|
||||
// Workaround for "multiple definition of `_tls_used'"
|
||||
// http://svn.boost.org/trac/boost/ticket/4258
|
||||
extern "C" void tss_cleanup_implemented() { }
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +81,7 @@ instance_of_cinit;
|
||||
void RandAddSeed()
|
||||
{
|
||||
// Seed with CPU performance counter
|
||||
int64 nCounter = PerformanceCounter();
|
||||
int64 nCounter = GetPerformanceCounter();
|
||||
RAND_add(&nCounter, sizeof(nCounter), 1.5);
|
||||
memset(&nCounter, 0, sizeof(nCounter));
|
||||
}
|
||||
@@ -95,12 +106,8 @@ void RandAddSeedPerfmon()
|
||||
RegCloseKey(HKEY_PERFORMANCE_DATA);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
{
|
||||
uint256 hash;
|
||||
SHA256(pdata, nSize, (unsigned char*)&hash);
|
||||
RAND_add(&hash, sizeof(hash), min(nSize/500.0, (double)sizeof(hash)));
|
||||
hash = 0;
|
||||
RAND_add(pdata, nSize, nSize/100.0);
|
||||
memset(pdata, 0, nSize);
|
||||
|
||||
printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize);
|
||||
}
|
||||
#endif
|
||||
@@ -121,6 +128,11 @@ uint64 GetRand(uint64 nMax)
|
||||
return (nRand % nMax);
|
||||
}
|
||||
|
||||
int GetRandInt(int nMax)
|
||||
{
|
||||
return GetRand(nMax);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -134,7 +146,7 @@ uint64 GetRand(uint64 nMax)
|
||||
inline int OutputDebugStringF(const char* pszFormat, ...)
|
||||
{
|
||||
int ret = 0;
|
||||
if (fPrintToConsole || wxTheApp == NULL)
|
||||
if (fPrintToConsole)
|
||||
{
|
||||
// print to console
|
||||
va_list arg_ptr;
|
||||
@@ -145,10 +157,16 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
|
||||
else
|
||||
{
|
||||
// print to debug.log
|
||||
char pszFile[MAX_PATH+100];
|
||||
GetDataDir(pszFile);
|
||||
strlcat(pszFile, "/debug.log", sizeof(pszFile));
|
||||
FILE* fileout = fopen(pszFile, "a");
|
||||
static FILE* fileout = NULL;
|
||||
|
||||
if (!fileout)
|
||||
{
|
||||
char pszFile[MAX_PATH+100];
|
||||
GetDataDir(pszFile);
|
||||
strlcat(pszFile, "/debug.log", sizeof(pszFile));
|
||||
fileout = fopen(pszFile, "a");
|
||||
if (fileout) setbuf(fileout, NULL); // unbuffered
|
||||
}
|
||||
if (fileout)
|
||||
{
|
||||
//// Debug print useful for profiling
|
||||
@@ -157,15 +175,15 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
|
||||
va_start(arg_ptr, pszFormat);
|
||||
ret = vfprintf(fileout, pszFormat, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
fclose(fileout);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
if (fPrintToDebugger)
|
||||
{
|
||||
// accumulate a line at a time
|
||||
static CCriticalSection cs_OutputDebugStringF;
|
||||
|
||||
// accumulate a line at a time
|
||||
CRITICAL_BLOCK(cs_OutputDebugStringF)
|
||||
{
|
||||
static char pszBuffer[50000];
|
||||
@@ -362,11 +380,6 @@ bool ParseMoney(const char* pszIn, int64& nRet)
|
||||
|
||||
vector<unsigned char> ParseHex(const char* psz)
|
||||
{
|
||||
vector<unsigned char> vch;
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
vch.reserve((strlen(psz)+1)/3);
|
||||
|
||||
static char phexdigit[256] =
|
||||
{ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
@@ -385,28 +398,26 @@ vector<unsigned char> ParseHex(const char* psz)
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, };
|
||||
|
||||
while (*psz)
|
||||
// convert hex dump to vector
|
||||
vector<unsigned char> vch;
|
||||
loop
|
||||
{
|
||||
char c = phexdigit[(unsigned char)*psz++];
|
||||
if (c == -1)
|
||||
break;
|
||||
unsigned char n = (c << 4);
|
||||
if (*psz)
|
||||
{
|
||||
char c = phexdigit[(unsigned char)*psz++];
|
||||
if (c == -1)
|
||||
break;
|
||||
n |= c;
|
||||
vch.push_back(n);
|
||||
}
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
char c = phexdigit[(unsigned char)*psz++];
|
||||
if (c == (char)-1)
|
||||
break;
|
||||
unsigned char n = (c << 4);
|
||||
c = phexdigit[(unsigned char)*psz++];
|
||||
if (c == (char)-1)
|
||||
break;
|
||||
n |= c;
|
||||
vch.push_back(n);
|
||||
}
|
||||
|
||||
return vch;
|
||||
}
|
||||
|
||||
vector<unsigned char> ParseHex(const std::string& str)
|
||||
vector<unsigned char> ParseHex(const string& str)
|
||||
{
|
||||
return ParseHex(str.c_str());
|
||||
}
|
||||
@@ -416,7 +427,7 @@ void ParseParameters(int argc, char* argv[])
|
||||
{
|
||||
mapArgs.clear();
|
||||
mapMultiArgs.clear();
|
||||
for (int i = 0; i < argc; i++)
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
char psz[10000];
|
||||
strlcpy(psz, argv[i], sizeof(psz));
|
||||
@@ -431,6 +442,8 @@ void ParseParameters(int argc, char* argv[])
|
||||
if (psz[0] == '/')
|
||||
psz[0] = '-';
|
||||
#endif
|
||||
if (psz[0] != '-')
|
||||
break;
|
||||
mapArgs[psz] = pszValue;
|
||||
mapMultiArgs[psz].push_back(pszValue);
|
||||
}
|
||||
@@ -439,6 +452,7 @@ void ParseParameters(int argc, char* argv[])
|
||||
|
||||
const char* wxGetTranslation(const char* pszEnglish)
|
||||
{
|
||||
#ifdef GUI
|
||||
// Wrapper of wxGetTranslation returning the same const char* type as was passed in
|
||||
static CCriticalSection cs;
|
||||
CRITICAL_BLOCK(cs)
|
||||
@@ -465,9 +479,40 @@ const char* wxGetTranslation(const char* pszEnglish)
|
||||
return pszCached;
|
||||
}
|
||||
return NULL;
|
||||
#else
|
||||
return pszEnglish;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool WildcardMatch(const char* psz, const char* mask)
|
||||
{
|
||||
loop
|
||||
{
|
||||
switch (*mask)
|
||||
{
|
||||
case '\0':
|
||||
return (*psz == '\0');
|
||||
case '*':
|
||||
return WildcardMatch(psz, mask+1) || (*psz && WildcardMatch(psz+1, mask));
|
||||
case '?':
|
||||
if (*psz == '\0')
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
if (*psz != *mask)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
psz++;
|
||||
mask++;
|
||||
}
|
||||
}
|
||||
|
||||
bool WildcardMatch(const string& str, const string& mask)
|
||||
{
|
||||
return WildcardMatch(str.c_str(), mask.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -483,8 +528,6 @@ void FormatException(char* pszMessage, std::exception* pex, const char* pszThrea
|
||||
pszModule[0] = '\0';
|
||||
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
|
||||
#else
|
||||
// might not be thread safe, uses wxString
|
||||
//const char* pszModule = wxStandardPaths::Get().GetExecutablePath().mb_str();
|
||||
const char* pszModule = "bitcoin";
|
||||
#endif
|
||||
if (pex)
|
||||
@@ -497,21 +540,47 @@ void FormatException(char* pszMessage, std::exception* pex, const char* pszThrea
|
||||
|
||||
void LogException(std::exception* pex, const char* pszThread)
|
||||
{
|
||||
char pszMessage[1000];
|
||||
char pszMessage[10000];
|
||||
FormatException(pszMessage, pex, pszThread);
|
||||
printf("\n%s", pszMessage);
|
||||
}
|
||||
|
||||
void PrintException(std::exception* pex, const char* pszThread)
|
||||
{
|
||||
char pszMessage[1000];
|
||||
char pszMessage[10000];
|
||||
FormatException(pszMessage, pex, pszThread);
|
||||
printf("\n\n************************\n%s\n", pszMessage);
|
||||
fprintf(stderr, "\n\n************************\n%s\n", pszMessage);
|
||||
if (wxTheApp && !fDaemon && fGUI)
|
||||
MyMessageBox(pszMessage, "Error", wxOK | wxICON_ERROR);
|
||||
strMiscWarning = pszMessage;
|
||||
#ifdef GUI
|
||||
if (wxTheApp && !fDaemon)
|
||||
MyMessageBox(pszMessage, "Bitcoin", wxOK | wxICON_ERROR);
|
||||
#endif
|
||||
throw;
|
||||
//DebugBreak();
|
||||
}
|
||||
|
||||
void ThreadOneMessageBox(string strMessage)
|
||||
{
|
||||
// Skip message boxes if one is already open
|
||||
static bool fMessageBoxOpen;
|
||||
if (fMessageBoxOpen)
|
||||
return;
|
||||
fMessageBoxOpen = true;
|
||||
ThreadSafeMessageBox(strMessage, "Bitcoin", wxOK | wxICON_EXCLAMATION);
|
||||
fMessageBoxOpen = false;
|
||||
}
|
||||
|
||||
void PrintExceptionContinue(std::exception* pex, const char* pszThread)
|
||||
{
|
||||
char pszMessage[10000];
|
||||
FormatException(pszMessage, pex, pszThread);
|
||||
printf("\n\n************************\n%s\n", pszMessage);
|
||||
fprintf(stderr, "\n\n************************\n%s\n", pszMessage);
|
||||
strMiscWarning = pszMessage;
|
||||
#ifdef GUI
|
||||
if (wxTheApp && !fDaemon)
|
||||
boost::thread(boost::bind(ThreadOneMessageBox, string(pszMessage)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -572,10 +641,10 @@ string GetDefaultDataDir()
|
||||
string strHome = pszHome;
|
||||
if (strHome[strHome.size()-1] != '/')
|
||||
strHome += '/';
|
||||
#ifdef __WXOSX__
|
||||
#ifdef __WXMAC_OSX__
|
||||
// Mac
|
||||
strHome += "Library/Application Support/";
|
||||
_mkdir(strHome.c_str());
|
||||
filesystem::create_directory(strHome.c_str());
|
||||
return strHome + "Bitcoin";
|
||||
#else
|
||||
// Unix
|
||||
@@ -587,15 +656,11 @@ string GetDefaultDataDir()
|
||||
void GetDataDir(char* pszDir)
|
||||
{
|
||||
// pszDir must be at least MAX_PATH length.
|
||||
int nVariation;
|
||||
if (pszSetDataDir[0] != 0)
|
||||
{
|
||||
strlcpy(pszDir, pszSetDataDir, MAX_PATH);
|
||||
static bool fMkdirDone;
|
||||
if (!fMkdirDone)
|
||||
{
|
||||
fMkdirDone = true;
|
||||
_mkdir(pszDir);
|
||||
}
|
||||
nVariation = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -603,12 +668,23 @@ void GetDataDir(char* pszDir)
|
||||
// value so we don't have to do memory allocations after that.
|
||||
static char pszCachedDir[MAX_PATH];
|
||||
if (pszCachedDir[0] == 0)
|
||||
{
|
||||
//strlcpy(pszCachedDir, wxStandardPaths::Get().GetUserDataDir().c_str(), sizeof(pszCachedDir));
|
||||
strlcpy(pszCachedDir, GetDefaultDataDir().c_str(), sizeof(pszCachedDir));
|
||||
_mkdir(pszCachedDir);
|
||||
}
|
||||
strlcpy(pszDir, pszCachedDir, MAX_PATH);
|
||||
nVariation = 1;
|
||||
}
|
||||
if (fTestNet)
|
||||
{
|
||||
char* p = pszDir + strlen(pszDir);
|
||||
if (p > pszDir && p[-1] != '/' && p[-1] != '\\')
|
||||
*p++ = '/';
|
||||
strcpy(p, "testnet");
|
||||
nVariation += 2;
|
||||
}
|
||||
static bool pfMkdir[4];
|
||||
if (!pfMkdir[nVariation])
|
||||
{
|
||||
pfMkdir[nVariation] = true;
|
||||
filesystem::create_directory(pszDir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,6 +695,38 @@ string GetDataDir()
|
||||
return pszDir;
|
||||
}
|
||||
|
||||
string GetConfigFile()
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
fs::path pathConfig(GetArg("-conf", "bitcoin.conf"));
|
||||
if (!pathConfig.is_complete())
|
||||
pathConfig = fs::path(GetDataDir()) / pathConfig;
|
||||
return pathConfig.string();
|
||||
}
|
||||
|
||||
void ReadConfigFile(map<string, string>& mapSettingsRet,
|
||||
map<string, vector<string> >& mapMultiSettingsRet)
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
namespace pod = boost::program_options::detail;
|
||||
|
||||
fs::ifstream streamConfig(GetConfigFile());
|
||||
if (!streamConfig.good())
|
||||
return;
|
||||
|
||||
set<string> setOptions;
|
||||
setOptions.insert("*");
|
||||
|
||||
for (pod::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it)
|
||||
{
|
||||
// Don't overwrite existing settings so command line settings override bitcoin.conf
|
||||
string strKey = string("-") + it->string_key;
|
||||
if (mapSettingsRet.count(strKey) == 0)
|
||||
mapSettingsRet[strKey] = it->value[0];
|
||||
mapMultiSettingsRet[strKey].push_back(it->value[0]);
|
||||
}
|
||||
}
|
||||
|
||||
int GetFilesize(FILE* file)
|
||||
{
|
||||
int nSavePos = ftell(file);
|
||||
@@ -656,18 +764,12 @@ void ShrinkDebugFile()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// "Never go to sea with two chronometers; take one or three."
|
||||
// Our three chronometers are:
|
||||
// Our three time sources are:
|
||||
// - System clock
|
||||
// - Median of other server's clocks
|
||||
// - NTP servers
|
||||
//
|
||||
// note: NTP isn't implemented yet, so until then we just use the median
|
||||
// of other nodes clocks to correct ours.
|
||||
// - Median of other nodes's clocks
|
||||
// - The user (asking the user to fix the system clock if the first two disagree)
|
||||
//
|
||||
int64 GetTime()
|
||||
{
|
||||
@@ -700,13 +802,33 @@ void AddTimeData(unsigned int ip, int64 nTime)
|
||||
{
|
||||
sort(vTimeOffsets.begin(), vTimeOffsets.end());
|
||||
int64 nMedian = vTimeOffsets[vTimeOffsets.size()/2];
|
||||
nTimeOffset = nMedian;
|
||||
if ((nMedian > 0 ? nMedian : -nMedian) > 5 * 60)
|
||||
// Only let other nodes change our time by so much
|
||||
if (abs64(nMedian) < 70 * 60)
|
||||
{
|
||||
// Only let other nodes change our clock so far before we
|
||||
// go to the NTP servers
|
||||
/// todo: Get time from NTP servers, then set a flag
|
||||
/// to make sure it doesn't get changed again
|
||||
nTimeOffset = nMedian;
|
||||
}
|
||||
else
|
||||
{
|
||||
nTimeOffset = 0;
|
||||
|
||||
static bool fDone;
|
||||
if (!fDone)
|
||||
{
|
||||
// If nobody has a time different than ours but within 5 minutes of ours, give a warning
|
||||
bool fMatch = false;
|
||||
foreach(int64 nOffset, vTimeOffsets)
|
||||
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
|
||||
fMatch = true;
|
||||
|
||||
if (!fMatch)
|
||||
{
|
||||
fDone = true;
|
||||
string strMessage = _("Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly.");
|
||||
strMiscWarning = strMessage;
|
||||
printf("*** %s\n", strMessage.c_str());
|
||||
boost::thread(boost::bind(ThreadSafeMessageBox, strMessage+" ", string("Bitcoin"), wxOK | wxICON_EXCLAMATION, (wxWindow*)NULL, -1, -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach(int64 n, vTimeOffsets)
|
||||
printf("%+"PRI64d" ", n);
|
||||
|
||||
170
util.h
170
util.h
@@ -54,8 +54,21 @@ inline T& REF(const T& val)
|
||||
return (T&)val;
|
||||
}
|
||||
|
||||
// Align by increasing pointer, must have extra space at end of buffer
|
||||
template <size_t nBytes, typename T>
|
||||
T* alignup(T* p)
|
||||
{
|
||||
union
|
||||
{
|
||||
T* ptr;
|
||||
size_t n;
|
||||
} u;
|
||||
u.ptr = p;
|
||||
u.n = (u.n + (nBytes-1)) & ~(nBytes-1);
|
||||
return u.ptr;
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
static const bool fWindows = true;
|
||||
#define MSG_NOSIGNAL 0
|
||||
#define MSG_DONTWAIT 0
|
||||
#ifndef UINT64_MAX
|
||||
@@ -70,7 +83,6 @@ static const bool fWindows = true;
|
||||
#define unlink _unlink
|
||||
typedef int socklen_t;
|
||||
#else
|
||||
static const bool fWindows = false;
|
||||
#define WSAGetLastError() errno
|
||||
#define WSAEWOULDBLOCK EWOULDBLOCK
|
||||
#define WSAEMSGSIZE EMSGSIZE
|
||||
@@ -84,10 +96,12 @@ typedef u_int SOCKET;
|
||||
#define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d)
|
||||
#define strlwr(psz) to_lower(psz)
|
||||
#define _strlwr(psz) to_lower(psz)
|
||||
#define _mkdir(psz) filesystem::create_directory(psz)
|
||||
#define MAX_PATH 1024
|
||||
#define Sleep(n) wxMilliSleep(n)
|
||||
#define Beep(n1,n2) (0)
|
||||
inline void Sleep(int64 n)
|
||||
{
|
||||
boost::thread::sleep(boost::get_system_time() + boost::posix_time::milliseconds(n));
|
||||
}
|
||||
#endif
|
||||
|
||||
inline int myclosesocket(SOCKET& hSocket)
|
||||
@@ -104,6 +118,13 @@ inline int myclosesocket(SOCKET& hSocket)
|
||||
}
|
||||
#define closesocket(s) myclosesocket(s)
|
||||
|
||||
#ifndef GUI
|
||||
inline const char* _(const char* psz)
|
||||
{
|
||||
return psz;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -119,9 +140,13 @@ extern bool fDebug;
|
||||
extern bool fPrintToConsole;
|
||||
extern bool fPrintToDebugger;
|
||||
extern char pszSetDataDir[MAX_PATH];
|
||||
extern bool fRequestShutdown;
|
||||
extern bool fShutdown;
|
||||
extern bool fDaemon;
|
||||
extern bool fCommandLine;
|
||||
extern string strMiscWarning;
|
||||
extern bool fTestNet;
|
||||
extern bool fNoListen;
|
||||
|
||||
void RandAddSeed();
|
||||
void RandAddSeedPerfmon();
|
||||
@@ -129,24 +154,30 @@ int OutputDebugStringF(const char* pszFormat, ...);
|
||||
int my_snprintf(char* buffer, size_t limit, const char* format, ...);
|
||||
string strprintf(const char* format, ...);
|
||||
bool error(const char* format, ...);
|
||||
void PrintException(std::exception* pex, const char* pszThread);
|
||||
void LogException(std::exception* pex, const char* pszThread);
|
||||
void PrintException(std::exception* pex, const char* pszThread);
|
||||
void PrintExceptionContinue(std::exception* pex, const char* pszThread);
|
||||
void ParseString(const string& str, char c, vector<string>& v);
|
||||
string FormatMoney(int64 n, bool fPlus=false);
|
||||
bool ParseMoney(const string& str, int64& nRet);
|
||||
bool ParseMoney(const char* pszIn, int64& nRet);
|
||||
vector<unsigned char> ParseHex(const char* psz);
|
||||
vector<unsigned char> ParseHex(const std::string& str);
|
||||
vector<unsigned char> ParseHex(const string& str);
|
||||
void ParseParameters(int argc, char* argv[]);
|
||||
const char* wxGetTranslation(const char* psz);
|
||||
bool WildcardMatch(const char* psz, const char* mask);
|
||||
bool WildcardMatch(const string& str, const string& mask);
|
||||
int GetFilesize(FILE* file);
|
||||
void GetDataDir(char* pszDirRet);
|
||||
string GetConfigFile();
|
||||
void ReadConfigFile(map<string, string>& mapSettingsRet, map<string, vector<string> >& mapMultiSettingsRet);
|
||||
#ifdef __WXMSW__
|
||||
string MyGetSpecialFolderPath(int nFolder, bool fCreate);
|
||||
#endif
|
||||
string GetDefaultDataDir();
|
||||
string GetDataDir();
|
||||
void ShrinkDebugFile();
|
||||
int GetRandInt(int nMax);
|
||||
uint64 GetRand(uint64 nMax);
|
||||
int64 GetTime();
|
||||
int64 GetAdjustedTime();
|
||||
@@ -275,18 +306,26 @@ inline int64 roundint64(double d)
|
||||
return (int64)(d > 0 ? d + 0.5 : d - 0.5);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
string HexStr(const T itbegin, const T itend, bool fSpaces=true)
|
||||
inline int64 abs64(int64 n)
|
||||
{
|
||||
return (n >= 0 ? n : -n);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
string HexStr(const T itbegin, const T itend, bool fSpaces=false)
|
||||
{
|
||||
if (itbegin == itend)
|
||||
return "";
|
||||
const unsigned char* pbegin = (const unsigned char*)&itbegin[0];
|
||||
const unsigned char* pend = pbegin + (itend - itbegin) * sizeof(itbegin[0]);
|
||||
string str;
|
||||
str.reserve((pend-pbegin) * (fSpaces ? 3 : 2));
|
||||
for (const unsigned char* p = pbegin; p != pend; p++)
|
||||
str += strprintf((fSpaces && p != pend-1 ? "%02x " : "%02x"), *p);
|
||||
return str;
|
||||
}
|
||||
|
||||
inline string HexStr(vector<unsigned char> vch, bool fSpaces=true)
|
||||
inline string HexStr(const vector<unsigned char>& vch, bool fSpaces=false)
|
||||
{
|
||||
return HexStr(vch.begin(), vch.end(), fSpaces);
|
||||
}
|
||||
@@ -294,26 +333,34 @@ inline string HexStr(vector<unsigned char> vch, bool fSpaces=true)
|
||||
template<typename T>
|
||||
string HexNumStr(const T itbegin, const T itend, bool f0x=true)
|
||||
{
|
||||
if (itbegin == itend)
|
||||
return "";
|
||||
const unsigned char* pbegin = (const unsigned char*)&itbegin[0];
|
||||
const unsigned char* pend = pbegin + (itend - itbegin) * sizeof(itbegin[0]);
|
||||
string str = (f0x ? "0x" : "");
|
||||
str.reserve(str.size() + (pend-pbegin) * 2);
|
||||
for (const unsigned char* p = pend-1; p >= pbegin; p--)
|
||||
str += strprintf("%02X", *p);
|
||||
str += strprintf("%02x", *p);
|
||||
return str;
|
||||
}
|
||||
|
||||
inline string HexNumStr(const vector<unsigned char>& vch, bool f0x=true)
|
||||
{
|
||||
return HexNumStr(vch.begin(), vch.end(), f0x);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void PrintHex(const T pbegin, const T pend, const char* pszFormat="%s", bool fSpaces=true)
|
||||
{
|
||||
printf(pszFormat, HexStr(pbegin, pend, fSpaces).c_str());
|
||||
}
|
||||
|
||||
inline void PrintHex(vector<unsigned char> vch, const char* pszFormat="%s", bool fSpaces=true)
|
||||
inline void PrintHex(const vector<unsigned char>& vch, const char* pszFormat="%s", bool fSpaces=true)
|
||||
{
|
||||
printf(pszFormat, HexStr(vch, fSpaces).c_str());
|
||||
}
|
||||
|
||||
inline int64 PerformanceCounter()
|
||||
inline int64 GetPerformanceCounter()
|
||||
{
|
||||
int64 nCounter = 0;
|
||||
#ifdef __WXMSW__
|
||||
@@ -348,7 +395,47 @@ void skipspaces(T& it)
|
||||
++it;
|
||||
}
|
||||
|
||||
inline bool IsSwitchChar(char c)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
return c == '-' || c == '/';
|
||||
#else
|
||||
return c == '-';
|
||||
#endif
|
||||
}
|
||||
|
||||
inline string GetArg(const string& strArg, const string& strDefault)
|
||||
{
|
||||
if (mapArgs.count(strArg))
|
||||
return mapArgs[strArg];
|
||||
return strDefault;
|
||||
}
|
||||
|
||||
inline int64 GetArg(const string& strArg, int64 nDefault)
|
||||
{
|
||||
if (mapArgs.count(strArg))
|
||||
return atoi64(mapArgs[strArg]);
|
||||
return nDefault;
|
||||
}
|
||||
|
||||
inline bool GetBoolArg(const string& strArg)
|
||||
{
|
||||
if (mapArgs.count(strArg))
|
||||
{
|
||||
if (mapArgs[strArg].empty())
|
||||
return true;
|
||||
return (atoi(mapArgs[strArg]) != 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline string FormatVersion(int nVersion)
|
||||
{
|
||||
if (nVersion%100 == 0)
|
||||
return strprintf("%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100);
|
||||
else
|
||||
return strprintf("%d.%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100, nVersion%100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -369,16 +456,16 @@ inline void heapchk()
|
||||
}
|
||||
|
||||
// Randomize the stack to help protect against buffer overrun exploits
|
||||
#define IMPLEMENT_RANDOMIZE_STACK(ThreadFn) \
|
||||
{ \
|
||||
static char nLoops; \
|
||||
if (nLoops <= 0) \
|
||||
nLoops = GetRand(20) + 1; \
|
||||
if (nLoops-- > 1) \
|
||||
{ \
|
||||
ThreadFn; \
|
||||
return; \
|
||||
} \
|
||||
#define IMPLEMENT_RANDOMIZE_STACK(ThreadFn) \
|
||||
{ \
|
||||
static char nLoops; \
|
||||
if (nLoops <= 0) \
|
||||
nLoops = GetRand(20) + 1; \
|
||||
if (nLoops-- > 1) \
|
||||
{ \
|
||||
ThreadFn; \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CATCH_PRINT_EXCEPTION(pszFn) \
|
||||
@@ -400,8 +487,9 @@ inline void heapchk()
|
||||
template<typename T1>
|
||||
inline uint256 Hash(const T1 pbegin, const T1 pend)
|
||||
{
|
||||
static unsigned char pblank[1];
|
||||
uint256 hash1;
|
||||
SHA256((unsigned char*)&pbegin[0], (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1);
|
||||
SHA256((pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1);
|
||||
uint256 hash2;
|
||||
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
|
||||
return hash2;
|
||||
@@ -411,11 +499,12 @@ template<typename T1, typename T2>
|
||||
inline uint256 Hash(const T1 p1begin, const T1 p1end,
|
||||
const T2 p2begin, const T2 p2end)
|
||||
{
|
||||
static unsigned char pblank[1];
|
||||
uint256 hash1;
|
||||
SHA256_CTX ctx;
|
||||
SHA256_Init(&ctx);
|
||||
SHA256_Update(&ctx, (unsigned char*)&p1begin[0], (p1end - p1begin) * sizeof(p1begin[0]));
|
||||
SHA256_Update(&ctx, (unsigned char*)&p2begin[0], (p2end - p2begin) * sizeof(p2begin[0]));
|
||||
SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0]));
|
||||
SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0]));
|
||||
SHA256_Final((unsigned char*)&hash1, &ctx);
|
||||
uint256 hash2;
|
||||
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
|
||||
@@ -427,12 +516,13 @@ inline uint256 Hash(const T1 p1begin, const T1 p1end,
|
||||
const T2 p2begin, const T2 p2end,
|
||||
const T3 p3begin, const T3 p3end)
|
||||
{
|
||||
static unsigned char pblank[1];
|
||||
uint256 hash1;
|
||||
SHA256_CTX ctx;
|
||||
SHA256_Init(&ctx);
|
||||
SHA256_Update(&ctx, (unsigned char*)&p1begin[0], (p1end - p1begin) * sizeof(p1begin[0]));
|
||||
SHA256_Update(&ctx, (unsigned char*)&p2begin[0], (p2end - p2begin) * sizeof(p2begin[0]));
|
||||
SHA256_Update(&ctx, (unsigned char*)&p3begin[0], (p3end - p3begin) * sizeof(p3begin[0]));
|
||||
SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0]));
|
||||
SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0]));
|
||||
SHA256_Update(&ctx, (p3begin == p3end ? pblank : (unsigned char*)&p3begin[0]), (p3end - p3begin) * sizeof(p3begin[0]));
|
||||
SHA256_Final((unsigned char*)&hash1, &ctx);
|
||||
uint256 hash2;
|
||||
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
|
||||
@@ -544,3 +634,27 @@ inline void ExitThread(unsigned int nExitCode)
|
||||
pthread_exit((void*)nExitCode);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline bool AffinityBugWorkaround(void(*pfn)(void*))
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
// Sometimes after a few hours affinity gets stuck on one processor
|
||||
DWORD dwProcessAffinityMask = -1;
|
||||
DWORD dwSystemAffinityMask = -1;
|
||||
GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask);
|
||||
DWORD dwPrev1 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask);
|
||||
DWORD dwPrev2 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask);
|
||||
if (dwPrev2 != dwProcessAffinityMask)
|
||||
{
|
||||
printf("AffinityBugWorkaround() : SetThreadAffinityMask=%d, ProcessAffinityMask=%d, restarting thread\n", dwPrev2, dwProcessAffinityMask);
|
||||
if (!CreateThread(pfn, NULL))
|
||||
printf("Error: CreateThread() failed\n");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,278 +1,278 @@
|
||||
/* XPM */
|
||||
static const char * addressbook16_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 256 2",
|
||||
" c #FFFFFF",
|
||||
". c #F7FFFF",
|
||||
"X c #F7F7FF",
|
||||
"o c #EFF7FF",
|
||||
"O c #E6EFF7",
|
||||
"+ c #E6E6F7",
|
||||
"@ c #CEE6F7",
|
||||
"# c #DEDEEF",
|
||||
"$ c #D6DEEF",
|
||||
"% c #D6DEE6",
|
||||
"& c #CEDEF7",
|
||||
"* c #CEDEEF",
|
||||
"= c #EFF708",
|
||||
"- c #C5DEF7",
|
||||
"; c #CED6EF",
|
||||
": c None",
|
||||
"> c #C5D6E6",
|
||||
", c #BDD6F7",
|
||||
"< c #BDD6EF",
|
||||
"1 c #D6CECE",
|
||||
"2 c #BDCEE6",
|
||||
"3 c #BDC5E6",
|
||||
"4 c #B5C5DE",
|
||||
"5 c #BDD631",
|
||||
"6 c #ADBDDE",
|
||||
"7 c #B5B5BD",
|
||||
"8 c #A5B5D6",
|
||||
"9 c #00FFFF",
|
||||
"0 c #9CB5CE",
|
||||
"q c #9CADD6",
|
||||
"w c #94A5D6",
|
||||
"e c #8CA5D6",
|
||||
"r c #8CA5CE",
|
||||
"t c #8CA5C5",
|
||||
"y c #849CC5",
|
||||
"u c #7B9CD6",
|
||||
"i c #7B9CCE",
|
||||
"p c #31BDCE",
|
||||
"a c #6B9CD6",
|
||||
"s c #00F708",
|
||||
"d c #8494AD",
|
||||
"f c #7B94B5",
|
||||
"g c #6B94D6",
|
||||
"h c #6B9C84",
|
||||
"j c #7B8CAD",
|
||||
"k c #738CAD",
|
||||
"l c #638CC5",
|
||||
"z c #10CE42",
|
||||
"x c #638CBD",
|
||||
"c c #7B849C",
|
||||
"v c #73849C",
|
||||
"b c #6B84A5",
|
||||
"n c #7B7BA5",
|
||||
"m c #6B849C",
|
||||
"M c #7B8C42",
|
||||
"N c #5A84C5",
|
||||
"B c #29AD6B",
|
||||
"V c #F74A4A",
|
||||
"C c #6384A5",
|
||||
"Z c #5284C5",
|
||||
"A c #637BA5",
|
||||
"S c #637B9C",
|
||||
"D c #9C637B",
|
||||
"F c #6B7B5A",
|
||||
"G c #637394",
|
||||
"H c #52739C",
|
||||
"J c #5A7384",
|
||||
"K c #526B94",
|
||||
"L c #426B94",
|
||||
"P c #52638C",
|
||||
"I c #426B7B",
|
||||
"U c #5A5A8C",
|
||||
"Y c #524A7B",
|
||||
"T c #425273",
|
||||
"R c #21636B",
|
||||
"E c #106394",
|
||||
"W c #106B52",
|
||||
"Q c #3A4273",
|
||||
"! c #31426B",
|
||||
"~ c #523163",
|
||||
"^ c #29426B",
|
||||
"/ c #293A63",
|
||||
"( c #213A63",
|
||||
") c #193A63",
|
||||
"_ c #193163",
|
||||
"` c #19315A",
|
||||
"' c #212963",
|
||||
"] c #10315A",
|
||||
"[ c #082952",
|
||||
"{ c #FFCC33",
|
||||
"} c #33FF33",
|
||||
"| c #66FF33",
|
||||
" . c #99FF33",
|
||||
".. c #CCFF33",
|
||||
"X. c #FFFF33",
|
||||
"o. c #000066",
|
||||
"O. c #330066",
|
||||
"+. c #660066",
|
||||
"@. c #990066",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
": : : : : : : : : : : : : : : : ",
|
||||
": : H H H A d : 7 G K H H : : : ",
|
||||
"n n c X 4 k j X b n n : ",
|
||||
"n 2 c $ 8 6 4 x < + 4 4 C V ~ : ",
|
||||
"n * c X o $ y N u 6 $ + b D Y : ",
|
||||
"n * c X > g , S z R : ",
|
||||
"n * c * r r y g , 6 r q S s W : ",
|
||||
"n * c X 4 N u + m B I : ",
|
||||
"n * c X ; a - S 5 F : ",
|
||||
"n * c * r r r g - S = M : ",
|
||||
"n * c X 4 N - m h J : ",
|
||||
"n * c X ; a - A 9 E : ",
|
||||
"n * ( ] ` ^ P l y T / / ( p L : ",
|
||||
"n O > 0 f ) ! t 8 % n : ",
|
||||
"U U U U U U U ' Q U U U U U U : ",
|
||||
": : : : : : : : : : : : : : : : "
|
||||
};
|
||||
/* XPM */
|
||||
static const char * addressbook16_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 256 2",
|
||||
" c #FFFFFF",
|
||||
". c #F7FFFF",
|
||||
"X c #F7F7FF",
|
||||
"o c #EFF7FF",
|
||||
"O c #E6EFF7",
|
||||
"+ c #E6E6F7",
|
||||
"@ c #CEE6F7",
|
||||
"# c #DEDEEF",
|
||||
"$ c #D6DEEF",
|
||||
"% c #D6DEE6",
|
||||
"& c #CEDEF7",
|
||||
"* c #CEDEEF",
|
||||
"= c #EFF708",
|
||||
"- c #C5DEF7",
|
||||
"; c #CED6EF",
|
||||
": c None",
|
||||
"> c #C5D6E6",
|
||||
", c #BDD6F7",
|
||||
"< c #BDD6EF",
|
||||
"1 c #D6CECE",
|
||||
"2 c #BDCEE6",
|
||||
"3 c #BDC5E6",
|
||||
"4 c #B5C5DE",
|
||||
"5 c #BDD631",
|
||||
"6 c #ADBDDE",
|
||||
"7 c #B5B5BD",
|
||||
"8 c #A5B5D6",
|
||||
"9 c #00FFFF",
|
||||
"0 c #9CB5CE",
|
||||
"q c #9CADD6",
|
||||
"w c #94A5D6",
|
||||
"e c #8CA5D6",
|
||||
"r c #8CA5CE",
|
||||
"t c #8CA5C5",
|
||||
"y c #849CC5",
|
||||
"u c #7B9CD6",
|
||||
"i c #7B9CCE",
|
||||
"p c #31BDCE",
|
||||
"a c #6B9CD6",
|
||||
"s c #00F708",
|
||||
"d c #8494AD",
|
||||
"f c #7B94B5",
|
||||
"g c #6B94D6",
|
||||
"h c #6B9C84",
|
||||
"j c #7B8CAD",
|
||||
"k c #738CAD",
|
||||
"l c #638CC5",
|
||||
"z c #10CE42",
|
||||
"x c #638CBD",
|
||||
"c c #7B849C",
|
||||
"v c #73849C",
|
||||
"b c #6B84A5",
|
||||
"n c #7B7BA5",
|
||||
"m c #6B849C",
|
||||
"M c #7B8C42",
|
||||
"N c #5A84C5",
|
||||
"B c #29AD6B",
|
||||
"V c #F74A4A",
|
||||
"C c #6384A5",
|
||||
"Z c #5284C5",
|
||||
"A c #637BA5",
|
||||
"S c #637B9C",
|
||||
"D c #9C637B",
|
||||
"F c #6B7B5A",
|
||||
"G c #637394",
|
||||
"H c #52739C",
|
||||
"J c #5A7384",
|
||||
"K c #526B94",
|
||||
"L c #426B94",
|
||||
"P c #52638C",
|
||||
"I c #426B7B",
|
||||
"U c #5A5A8C",
|
||||
"Y c #524A7B",
|
||||
"T c #425273",
|
||||
"R c #21636B",
|
||||
"E c #106394",
|
||||
"W c #106B52",
|
||||
"Q c #3A4273",
|
||||
"! c #31426B",
|
||||
"~ c #523163",
|
||||
"^ c #29426B",
|
||||
"/ c #293A63",
|
||||
"( c #213A63",
|
||||
") c #193A63",
|
||||
"_ c #193163",
|
||||
"` c #19315A",
|
||||
"' c #212963",
|
||||
"] c #10315A",
|
||||
"[ c #082952",
|
||||
"{ c #FFCC33",
|
||||
"} c #33FF33",
|
||||
"| c #66FF33",
|
||||
" . c #99FF33",
|
||||
".. c #CCFF33",
|
||||
"X. c #FFFF33",
|
||||
"o. c #000066",
|
||||
"O. c #330066",
|
||||
"+. c #660066",
|
||||
"@. c #990066",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
": : : : : : : : : : : : : : : : ",
|
||||
": : H H H A d : 7 G K H H : : : ",
|
||||
"n n c X 4 k j X b n n : ",
|
||||
"n 2 c $ 8 6 4 x < + 4 4 C V ~ : ",
|
||||
"n * c X o $ y N u 6 $ + b D Y : ",
|
||||
"n * c X > g , S z R : ",
|
||||
"n * c * r r y g , 6 r q S s W : ",
|
||||
"n * c X 4 N u + m B I : ",
|
||||
"n * c X ; a - S 5 F : ",
|
||||
"n * c * r r r g - S = M : ",
|
||||
"n * c X 4 N - m h J : ",
|
||||
"n * c X ; a - A 9 E : ",
|
||||
"n * ( ] ` ^ P l y T / / ( p L : ",
|
||||
"n O > 0 f ) ! t 8 % n : ",
|
||||
"U U U U U U U ' Q U U U U U U : ",
|
||||
": : : : : : : : : : : : : : : : "
|
||||
};
|
||||
|
||||
@@ -1,282 +1,282 @@
|
||||
/* XPM */
|
||||
static const char * addressbook20_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"20 20 256 2",
|
||||
" c #FFFFFF",
|
||||
". c #F7FFFF",
|
||||
"X c #F7F7FF",
|
||||
"o c #EFF7FF",
|
||||
"O c #EFF7F7",
|
||||
"+ c #E6EFFF",
|
||||
"@ c #E6EFF7",
|
||||
"# c #DEEFFF",
|
||||
"$ c #DEE6F7",
|
||||
"% c #DEE6EF",
|
||||
"& c #D6E6F7",
|
||||
"* c #FFFF00",
|
||||
"= c #DEDEE6",
|
||||
"- c #D6DEE6",
|
||||
"; c #D6D6DE",
|
||||
": c #CED6E6",
|
||||
"> c None",
|
||||
", c #C5D6E6",
|
||||
"< c #C5CEE6",
|
||||
"1 c #B5CEEF",
|
||||
"2 c #C5C5C5",
|
||||
"3 c #C5DE31",
|
||||
"4 c #B5C5DE",
|
||||
"5 c #BDC5C5",
|
||||
"6 c #ADC5EF",
|
||||
"7 c #B5C5CE",
|
||||
"8 c #BDBDBD",
|
||||
"9 c #B5BDCE",
|
||||
"0 c #ADBDDE",
|
||||
"q c #ADBDD6",
|
||||
"w c #B5CE52",
|
||||
"e c #ADB5C5",
|
||||
"r c #00FFFF",
|
||||
"t c #A5B5C5",
|
||||
"y c #9CB5CE",
|
||||
"u c #94B5DE",
|
||||
"i c #9CADD6",
|
||||
"p c #A5ADB5",
|
||||
"a c #94ADDE",
|
||||
"s c #94ADD6",
|
||||
"d c #9CADBD",
|
||||
"f c #8CADDE",
|
||||
"g c #BD9CA5",
|
||||
"h c #9CA5BD",
|
||||
"j c #9CA5B5",
|
||||
"k c #29D6E6",
|
||||
"l c #8CA5CE",
|
||||
"z c #849CCE",
|
||||
"x c #6BA5C5",
|
||||
"c c #739CDE",
|
||||
"v c #00FF00",
|
||||
"b c #739CD6",
|
||||
"n c #7B94CE",
|
||||
"m c #8494AD",
|
||||
"M c #7394CE",
|
||||
"N c #7B94B5",
|
||||
"B c #4AB584",
|
||||
"V c #848CB5",
|
||||
"C c #6B94CE",
|
||||
"Z c #6394D6",
|
||||
"A c #6394CE",
|
||||
"S c #7B8CAD",
|
||||
"D c #6B8CC5",
|
||||
"F c #738CAD",
|
||||
"G c #5294B5",
|
||||
"H c #6B84C5",
|
||||
"J c #7384A5",
|
||||
"K c #73849C",
|
||||
"L c #738494",
|
||||
"P c #FF4A4A",
|
||||
"I c #FF4A42",
|
||||
"U c #737B8C",
|
||||
"Y c #637BAD",
|
||||
"T c #527BBD",
|
||||
"R c #637394",
|
||||
"E c #637352",
|
||||
"W c #5A6B8C",
|
||||
"Q c #526B9C",
|
||||
"! c #63638C",
|
||||
"~ c #5A734A",
|
||||
"^ c #4A6B9C",
|
||||
"/ c #526B63",
|
||||
"( c #0884A5",
|
||||
") c #526384",
|
||||
"_ c #52637B",
|
||||
"` c #4A6B5A",
|
||||
"' c #52636B",
|
||||
"] c #525A8C",
|
||||
"[ c #525A7B",
|
||||
"{ c #426363",
|
||||
"} c #4A5A7B",
|
||||
"| c #425A8C",
|
||||
" . c #196B94",
|
||||
".. c #3A5A8C",
|
||||
"X. c #3A5A84",
|
||||
"o. c #087B4A",
|
||||
"O. c #21636B",
|
||||
"+. c #634263",
|
||||
"@. c #3A527B",
|
||||
"#. c #424A84",
|
||||
"$. c #315284",
|
||||
"%. c #295284",
|
||||
"&. c #3A4A6B",
|
||||
"*. c #42427B",
|
||||
"=. c #424273",
|
||||
"-. c #294A84",
|
||||
";. c #3A3A73",
|
||||
":. c #194284",
|
||||
">. c #104A63",
|
||||
",. c #213A6B",
|
||||
"<. c #31316B",
|
||||
"1. c #21315A",
|
||||
"2. c #212163",
|
||||
"3. c #08295A",
|
||||
"4. c #082152",
|
||||
"5. c #101952",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"> > > > > > > > > > > > > > > > > > > > ",
|
||||
"> > > > > > > > > > > > > > > > > > > > ",
|
||||
"> > U $.| | ^ S 2 > p W | | @.L > > > > ",
|
||||
"8 5 R - < Y j S O - ) g e > > ",
|
||||
"! V K - % a Q # - +.P <.> > ",
|
||||
"! & K - 0 z n D C b f n n z q +.P <.> > ",
|
||||
"! & K - % M A 1 - %.G #.> > ",
|
||||
"! & K - % u b # - o.v >.> > ",
|
||||
"! & K - 0 z n H M b 6 z n z q o.v >.> > ",
|
||||
"! & K - X - M A a - O.B @.> > ",
|
||||
"! & K - X % u b # - ` 3 / > > ",
|
||||
"! & K - 0 l i 4 u b # - ~ * E > > ",
|
||||
"! & K - X o $ s T b # - { w ' > > ",
|
||||
"! & K - % f b # - .k -.> > ",
|
||||
"! & K m d t 7 , u b # ; 9 9 h ( r :.> > ",
|
||||
"! & h _ _ [ &.4.$.A ,.1.} _ _ F x ] > > ",
|
||||
"! @ , y N _ 3._ N y , @ ! > > ",
|
||||
"*.*.*.*.*.*.*.*.;.5.*.*.*.*.*.*.*.2.> > ",
|
||||
"> > > > > > > > > > > > > > > > > > > > ",
|
||||
"> > > > > > > > > > > > > > > > > > > > "
|
||||
};
|
||||
/* XPM */
|
||||
static const char * addressbook20_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"20 20 256 2",
|
||||
" c #FFFFFF",
|
||||
". c #F7FFFF",
|
||||
"X c #F7F7FF",
|
||||
"o c #EFF7FF",
|
||||
"O c #EFF7F7",
|
||||
"+ c #E6EFFF",
|
||||
"@ c #E6EFF7",
|
||||
"# c #DEEFFF",
|
||||
"$ c #DEE6F7",
|
||||
"% c #DEE6EF",
|
||||
"& c #D6E6F7",
|
||||
"* c #FFFF00",
|
||||
"= c #DEDEE6",
|
||||
"- c #D6DEE6",
|
||||
"; c #D6D6DE",
|
||||
": c #CED6E6",
|
||||
"> c None",
|
||||
", c #C5D6E6",
|
||||
"< c #C5CEE6",
|
||||
"1 c #B5CEEF",
|
||||
"2 c #C5C5C5",
|
||||
"3 c #C5DE31",
|
||||
"4 c #B5C5DE",
|
||||
"5 c #BDC5C5",
|
||||
"6 c #ADC5EF",
|
||||
"7 c #B5C5CE",
|
||||
"8 c #BDBDBD",
|
||||
"9 c #B5BDCE",
|
||||
"0 c #ADBDDE",
|
||||
"q c #ADBDD6",
|
||||
"w c #B5CE52",
|
||||
"e c #ADB5C5",
|
||||
"r c #00FFFF",
|
||||
"t c #A5B5C5",
|
||||
"y c #9CB5CE",
|
||||
"u c #94B5DE",
|
||||
"i c #9CADD6",
|
||||
"p c #A5ADB5",
|
||||
"a c #94ADDE",
|
||||
"s c #94ADD6",
|
||||
"d c #9CADBD",
|
||||
"f c #8CADDE",
|
||||
"g c #BD9CA5",
|
||||
"h c #9CA5BD",
|
||||
"j c #9CA5B5",
|
||||
"k c #29D6E6",
|
||||
"l c #8CA5CE",
|
||||
"z c #849CCE",
|
||||
"x c #6BA5C5",
|
||||
"c c #739CDE",
|
||||
"v c #00FF00",
|
||||
"b c #739CD6",
|
||||
"n c #7B94CE",
|
||||
"m c #8494AD",
|
||||
"M c #7394CE",
|
||||
"N c #7B94B5",
|
||||
"B c #4AB584",
|
||||
"V c #848CB5",
|
||||
"C c #6B94CE",
|
||||
"Z c #6394D6",
|
||||
"A c #6394CE",
|
||||
"S c #7B8CAD",
|
||||
"D c #6B8CC5",
|
||||
"F c #738CAD",
|
||||
"G c #5294B5",
|
||||
"H c #6B84C5",
|
||||
"J c #7384A5",
|
||||
"K c #73849C",
|
||||
"L c #738494",
|
||||
"P c #FF4A4A",
|
||||
"I c #FF4A42",
|
||||
"U c #737B8C",
|
||||
"Y c #637BAD",
|
||||
"T c #527BBD",
|
||||
"R c #637394",
|
||||
"E c #637352",
|
||||
"W c #5A6B8C",
|
||||
"Q c #526B9C",
|
||||
"! c #63638C",
|
||||
"~ c #5A734A",
|
||||
"^ c #4A6B9C",
|
||||
"/ c #526B63",
|
||||
"( c #0884A5",
|
||||
") c #526384",
|
||||
"_ c #52637B",
|
||||
"` c #4A6B5A",
|
||||
"' c #52636B",
|
||||
"] c #525A8C",
|
||||
"[ c #525A7B",
|
||||
"{ c #426363",
|
||||
"} c #4A5A7B",
|
||||
"| c #425A8C",
|
||||
" . c #196B94",
|
||||
".. c #3A5A8C",
|
||||
"X. c #3A5A84",
|
||||
"o. c #087B4A",
|
||||
"O. c #21636B",
|
||||
"+. c #634263",
|
||||
"@. c #3A527B",
|
||||
"#. c #424A84",
|
||||
"$. c #315284",
|
||||
"%. c #295284",
|
||||
"&. c #3A4A6B",
|
||||
"*. c #42427B",
|
||||
"=. c #424273",
|
||||
"-. c #294A84",
|
||||
";. c #3A3A73",
|
||||
":. c #194284",
|
||||
">. c #104A63",
|
||||
",. c #213A6B",
|
||||
"<. c #31316B",
|
||||
"1. c #21315A",
|
||||
"2. c #212163",
|
||||
"3. c #08295A",
|
||||
"4. c #082152",
|
||||
"5. c #101952",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"> > > > > > > > > > > > > > > > > > > > ",
|
||||
"> > > > > > > > > > > > > > > > > > > > ",
|
||||
"> > U $.| | ^ S 2 > p W | | @.L > > > > ",
|
||||
"8 5 R - < Y j S O - ) g e > > ",
|
||||
"! V K - % a Q # - +.P <.> > ",
|
||||
"! & K - 0 z n D C b f n n z q +.P <.> > ",
|
||||
"! & K - % M A 1 - %.G #.> > ",
|
||||
"! & K - % u b # - o.v >.> > ",
|
||||
"! & K - 0 z n H M b 6 z n z q o.v >.> > ",
|
||||
"! & K - X - M A a - O.B @.> > ",
|
||||
"! & K - X % u b # - ` 3 / > > ",
|
||||
"! & K - 0 l i 4 u b # - ~ * E > > ",
|
||||
"! & K - X o $ s T b # - { w ' > > ",
|
||||
"! & K - % f b # - .k -.> > ",
|
||||
"! & K m d t 7 , u b # ; 9 9 h ( r :.> > ",
|
||||
"! & h _ _ [ &.4.$.A ,.1.} _ _ F x ] > > ",
|
||||
"! @ , y N _ 3._ N y , @ ! > > ",
|
||||
"*.*.*.*.*.*.*.*.;.5.*.*.*.*.*.*.*.2.> > ",
|
||||
"> > > > > > > > > > > > > > > > > > > > ",
|
||||
"> > > > > > > > > > > > > > > > > > > > "
|
||||
};
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/* XPM */
|
||||
static const char * check_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 3 1",
|
||||
" c #008000",
|
||||
". c #00FF00",
|
||||
"X c None",
|
||||
/* pixels */
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXX XXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXX . XXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXX .. XXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXX . XXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX .. XXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXX XX . XXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXX . .. XXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXX .. . XXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXX ... XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXX . XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXX XXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
||||
};
|
||||
/* XPM */
|
||||
static const char * check_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 3 1",
|
||||
" c #008000",
|
||||
". c #00FF00",
|
||||
"X c None",
|
||||
/* pixels */
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXX XXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXX . XXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXX .. XXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXX . XXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX .. XXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXX XX . XXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXX . .. XXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXX .. . XXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXX ... XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXX . XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXX XXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
||||
};
|
||||
|
||||
556
xpm/send16.xpm
556
xpm/send16.xpm
@@ -1,278 +1,278 @@
|
||||
/* XPM */
|
||||
static const char * send16_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 256 2",
|
||||
" c #ADF7AD",
|
||||
". c #9CFF9C",
|
||||
"X c None",
|
||||
"o c #ADEFAD",
|
||||
"O c #94FF94",
|
||||
"+ c #D6CECE",
|
||||
"@ c #8CFF8C",
|
||||
"# c #CECECE",
|
||||
"$ c #CECEC5",
|
||||
"% c #84FF84",
|
||||
"& c #CEC5C5",
|
||||
"* c #73FF73",
|
||||
"= c #C5C5C5",
|
||||
"- c #6BFF6B",
|
||||
"; c #73F773",
|
||||
": c #C5BDBD",
|
||||
"> c #6BF76B",
|
||||
", c #BDBDBD",
|
||||
"< c #63F763",
|
||||
"1 c #B5B5B5",
|
||||
"2 c #52F752",
|
||||
"3 c #42FF42",
|
||||
"4 c #3AFF3A",
|
||||
"5 c #ADADAD",
|
||||
"6 c #ADADA5",
|
||||
"7 c #4AEF4A",
|
||||
"8 c #29FF29",
|
||||
"9 c #A5A5A5",
|
||||
"0 c #42E642",
|
||||
"q c #9CA59C",
|
||||
"w c #3AE63A",
|
||||
"e c #10FF10",
|
||||
"r c #08FF08",
|
||||
"t c #949C94",
|
||||
"y c #00FF00",
|
||||
"u c #00F700",
|
||||
"i c #8C948C",
|
||||
"p c #00EF00",
|
||||
"a c #08E608",
|
||||
"s c #10DE10",
|
||||
"d c #00E600",
|
||||
"f c #00DE00",
|
||||
"g c #19C519",
|
||||
"h c #00CE00",
|
||||
"j c #00C500",
|
||||
"k c #008C00",
|
||||
"l c #008400",
|
||||
"z c #669900",
|
||||
"x c #999900",
|
||||
"c c #CC9900",
|
||||
"v c #FF9900",
|
||||
"b c #00CC00",
|
||||
"n c #33CC00",
|
||||
"m c #66CC00",
|
||||
"M c #99CC00",
|
||||
"N c #CCCC00",
|
||||
"B c #FFCC00",
|
||||
"V c #66FF00",
|
||||
"C c #99FF00",
|
||||
"Z c #CCFF00",
|
||||
"A c #000033",
|
||||
"S c #330033",
|
||||
"D c #660033",
|
||||
"F c #990033",
|
||||
"G c #CC0033",
|
||||
"H c #FF0033",
|
||||
"J c #003333",
|
||||
"K c #333333",
|
||||
"L c #663333",
|
||||
"P c #993333",
|
||||
"I c #CC3333",
|
||||
"U c #FF3333",
|
||||
"Y c #006633",
|
||||
"T c #336633",
|
||||
"R c #666633",
|
||||
"E c #996633",
|
||||
"W c #CC6633",
|
||||
"Q c #FF6633",
|
||||
"! c #009933",
|
||||
"~ c #339933",
|
||||
"^ c #669933",
|
||||
"/ c #999933",
|
||||
"( c #CC9933",
|
||||
") c #FF9933",
|
||||
"_ c #00CC33",
|
||||
"` c #33CC33",
|
||||
"' c #66CC33",
|
||||
"] c #99CC33",
|
||||
"[ c #CCCC33",
|
||||
"{ c #FFCC33",
|
||||
"} c #33FF33",
|
||||
"| c #66FF33",
|
||||
" . c #99FF33",
|
||||
".. c #CCFF33",
|
||||
"X. c #FFFF33",
|
||||
"o. c #000066",
|
||||
"O. c #330066",
|
||||
"+. c #660066",
|
||||
"@. c #990066",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"X X X X X X X k k X X X X X X X ",
|
||||
"X X X X X X X k j k X X X X X X ",
|
||||
"X X X X X X X k o j k X X X X X ",
|
||||
"X X X X X X X k * o j k X X X X ",
|
||||
"l k k k k k k k * * . j k X X X ",
|
||||
"l @ @ @ @ @ @ @ 4 e e % j k X X ",
|
||||
"l O 3 8 e r r r r r r e ; j k X ",
|
||||
"l @ e e r r r r r u p a f < j k ",
|
||||
"l @ r u p a a a a a f f w j k i ",
|
||||
"l O ; ; ; ; ; < a f b 0 j k t : ",
|
||||
"l k k k k k k k s j 7 j k q = X ",
|
||||
"X $ = = = = = k g 7 j k 9 & X X ",
|
||||
"X X X X X X X k 2 j k 6 $ X X X ",
|
||||
"X X X X X X X k j k 5 + X X X X ",
|
||||
"X X X X X X X k k 1 + X X X X X ",
|
||||
"X X X X X X X = , X X X X X X X "
|
||||
};
|
||||
/* XPM */
|
||||
static const char * send16_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 256 2",
|
||||
" c #ADF7AD",
|
||||
". c #9CFF9C",
|
||||
"X c None",
|
||||
"o c #ADEFAD",
|
||||
"O c #94FF94",
|
||||
"+ c #D6CECE",
|
||||
"@ c #8CFF8C",
|
||||
"# c #CECECE",
|
||||
"$ c #CECEC5",
|
||||
"% c #84FF84",
|
||||
"& c #CEC5C5",
|
||||
"* c #73FF73",
|
||||
"= c #C5C5C5",
|
||||
"- c #6BFF6B",
|
||||
"; c #73F773",
|
||||
": c #C5BDBD",
|
||||
"> c #6BF76B",
|
||||
", c #BDBDBD",
|
||||
"< c #63F763",
|
||||
"1 c #B5B5B5",
|
||||
"2 c #52F752",
|
||||
"3 c #42FF42",
|
||||
"4 c #3AFF3A",
|
||||
"5 c #ADADAD",
|
||||
"6 c #ADADA5",
|
||||
"7 c #4AEF4A",
|
||||
"8 c #29FF29",
|
||||
"9 c #A5A5A5",
|
||||
"0 c #42E642",
|
||||
"q c #9CA59C",
|
||||
"w c #3AE63A",
|
||||
"e c #10FF10",
|
||||
"r c #08FF08",
|
||||
"t c #949C94",
|
||||
"y c #00FF00",
|
||||
"u c #00F700",
|
||||
"i c #8C948C",
|
||||
"p c #00EF00",
|
||||
"a c #08E608",
|
||||
"s c #10DE10",
|
||||
"d c #00E600",
|
||||
"f c #00DE00",
|
||||
"g c #19C519",
|
||||
"h c #00CE00",
|
||||
"j c #00C500",
|
||||
"k c #008C00",
|
||||
"l c #008400",
|
||||
"z c #669900",
|
||||
"x c #999900",
|
||||
"c c #CC9900",
|
||||
"v c #FF9900",
|
||||
"b c #00CC00",
|
||||
"n c #33CC00",
|
||||
"m c #66CC00",
|
||||
"M c #99CC00",
|
||||
"N c #CCCC00",
|
||||
"B c #FFCC00",
|
||||
"V c #66FF00",
|
||||
"C c #99FF00",
|
||||
"Z c #CCFF00",
|
||||
"A c #000033",
|
||||
"S c #330033",
|
||||
"D c #660033",
|
||||
"F c #990033",
|
||||
"G c #CC0033",
|
||||
"H c #FF0033",
|
||||
"J c #003333",
|
||||
"K c #333333",
|
||||
"L c #663333",
|
||||
"P c #993333",
|
||||
"I c #CC3333",
|
||||
"U c #FF3333",
|
||||
"Y c #006633",
|
||||
"T c #336633",
|
||||
"R c #666633",
|
||||
"E c #996633",
|
||||
"W c #CC6633",
|
||||
"Q c #FF6633",
|
||||
"! c #009933",
|
||||
"~ c #339933",
|
||||
"^ c #669933",
|
||||
"/ c #999933",
|
||||
"( c #CC9933",
|
||||
") c #FF9933",
|
||||
"_ c #00CC33",
|
||||
"` c #33CC33",
|
||||
"' c #66CC33",
|
||||
"] c #99CC33",
|
||||
"[ c #CCCC33",
|
||||
"{ c #FFCC33",
|
||||
"} c #33FF33",
|
||||
"| c #66FF33",
|
||||
" . c #99FF33",
|
||||
".. c #CCFF33",
|
||||
"X. c #FFFF33",
|
||||
"o. c #000066",
|
||||
"O. c #330066",
|
||||
"+. c #660066",
|
||||
"@. c #990066",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"X X X X X X X k k X X X X X X X ",
|
||||
"X X X X X X X k j k X X X X X X ",
|
||||
"X X X X X X X k o j k X X X X X ",
|
||||
"X X X X X X X k * o j k X X X X ",
|
||||
"l k k k k k k k * * . j k X X X ",
|
||||
"l @ @ @ @ @ @ @ 4 e e % j k X X ",
|
||||
"l O 3 8 e r r r r r r e ; j k X ",
|
||||
"l @ e e r r r r r u p a f < j k ",
|
||||
"l @ r u p a a a a a f f w j k i ",
|
||||
"l O ; ; ; ; ; < a f b 0 j k t : ",
|
||||
"l k k k k k k k s j 7 j k q = X ",
|
||||
"X $ = = = = = k g 7 j k 9 & X X ",
|
||||
"X X X X X X X k 2 j k 6 $ X X X ",
|
||||
"X X X X X X X k j k 5 + X X X X ",
|
||||
"X X X X X X X k k 1 + X X X X X ",
|
||||
"X X X X X X X = , X X X X X X X "
|
||||
};
|
||||
|
||||
@@ -1,278 +1,278 @@
|
||||
/* XPM */
|
||||
static const char * send16noshadow_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 256 2",
|
||||
" c #ADF7AD",
|
||||
". c #9CFF9C",
|
||||
"X c None",
|
||||
"o c #ADEFAD",
|
||||
"O c #94FF94",
|
||||
"+ c #D6CECE",
|
||||
"@ c #8CFF8C",
|
||||
"# c #CECECE",
|
||||
"$ c #CECEC5",
|
||||
"% c #84FF84",
|
||||
"& c #CEC5C5",
|
||||
"* c #73FF73",
|
||||
"= c #C5C5C5",
|
||||
"- c #6BFF6B",
|
||||
"; c #73F773",
|
||||
": c #C5BDBD",
|
||||
"> c #6BF76B",
|
||||
", c #BDBDBD",
|
||||
"< c #63F763",
|
||||
"1 c #B5B5B5",
|
||||
"2 c #52F752",
|
||||
"3 c #42FF42",
|
||||
"4 c #3AFF3A",
|
||||
"5 c #ADADAD",
|
||||
"6 c #ADADA5",
|
||||
"7 c #4AEF4A",
|
||||
"8 c #29FF29",
|
||||
"9 c #A5A5A5",
|
||||
"0 c #42E642",
|
||||
"q c #9CA59C",
|
||||
"w c #3AE63A",
|
||||
"e c #10FF10",
|
||||
"r c #08FF08",
|
||||
"t c #949C94",
|
||||
"y c #00FF00",
|
||||
"u c #00F700",
|
||||
"i c #8C948C",
|
||||
"p c #00EF00",
|
||||
"a c #08E608",
|
||||
"s c #10DE10",
|
||||
"d c #00E600",
|
||||
"f c #00DE00",
|
||||
"g c #19C519",
|
||||
"h c #00CE00",
|
||||
"j c #00C500",
|
||||
"k c #008C00",
|
||||
"l c #008400",
|
||||
"z c #669900",
|
||||
"x c #999900",
|
||||
"c c #CC9900",
|
||||
"v c #FF9900",
|
||||
"b c #00CC00",
|
||||
"n c #33CC00",
|
||||
"m c #66CC00",
|
||||
"M c #99CC00",
|
||||
"N c #CCCC00",
|
||||
"B c #FFCC00",
|
||||
"V c #66FF00",
|
||||
"C c #99FF00",
|
||||
"Z c #CCFF00",
|
||||
"A c #000033",
|
||||
"S c #330033",
|
||||
"D c #660033",
|
||||
"F c #990033",
|
||||
"G c #CC0033",
|
||||
"H c #FF0033",
|
||||
"J c #003333",
|
||||
"K c #333333",
|
||||
"L c #663333",
|
||||
"P c #993333",
|
||||
"I c #CC3333",
|
||||
"U c #FF3333",
|
||||
"Y c #006633",
|
||||
"T c #336633",
|
||||
"R c #666633",
|
||||
"E c #996633",
|
||||
"W c #CC6633",
|
||||
"Q c #FF6633",
|
||||
"! c #009933",
|
||||
"~ c #339933",
|
||||
"^ c #669933",
|
||||
"/ c #999933",
|
||||
"( c #CC9933",
|
||||
") c #FF9933",
|
||||
"_ c #00CC33",
|
||||
"` c #33CC33",
|
||||
"' c #66CC33",
|
||||
"] c #99CC33",
|
||||
"[ c #CCCC33",
|
||||
"{ c #FFCC33",
|
||||
"} c #33FF33",
|
||||
"| c #66FF33",
|
||||
" . c #99FF33",
|
||||
".. c #CCFF33",
|
||||
"X. c #FFFF33",
|
||||
"o. c #000066",
|
||||
"O. c #330066",
|
||||
"+. c #660066",
|
||||
"@. c #990066",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"X X X X X X X k k X X X X X X X ",
|
||||
"X X X X X X X k j k X X X X X X ",
|
||||
"X X X X X X X k o j k X X X X X ",
|
||||
"X X X X X X X k * o j k X X X X ",
|
||||
"l k k k k k k k * * . j k X X X ",
|
||||
"l @ @ @ @ @ @ @ 4 e e % j k X X ",
|
||||
"l O 3 8 e r r r r r r e ; j k X ",
|
||||
"l @ e e r r r r r u p a f < j k ",
|
||||
"l @ r u p a a a a a f f w j k X ",
|
||||
"l O ; ; ; ; ; < a f b 0 j k X X ",
|
||||
"l k k k k k k k s j 7 j k X X X ",
|
||||
"X X X X X X X k g 7 j k X X X X ",
|
||||
"X X X X X X X k 2 j k X X X X X ",
|
||||
"X X X X X X X k j k X X X X X X ",
|
||||
"X X X X X X X k k X X X X X X X ",
|
||||
"X X X X X X X X X X X X X X X X "
|
||||
};
|
||||
/* XPM */
|
||||
static const char * send16noshadow_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 256 2",
|
||||
" c #ADF7AD",
|
||||
". c #9CFF9C",
|
||||
"X c None",
|
||||
"o c #ADEFAD",
|
||||
"O c #94FF94",
|
||||
"+ c #D6CECE",
|
||||
"@ c #8CFF8C",
|
||||
"# c #CECECE",
|
||||
"$ c #CECEC5",
|
||||
"% c #84FF84",
|
||||
"& c #CEC5C5",
|
||||
"* c #73FF73",
|
||||
"= c #C5C5C5",
|
||||
"- c #6BFF6B",
|
||||
"; c #73F773",
|
||||
": c #C5BDBD",
|
||||
"> c #6BF76B",
|
||||
", c #BDBDBD",
|
||||
"< c #63F763",
|
||||
"1 c #B5B5B5",
|
||||
"2 c #52F752",
|
||||
"3 c #42FF42",
|
||||
"4 c #3AFF3A",
|
||||
"5 c #ADADAD",
|
||||
"6 c #ADADA5",
|
||||
"7 c #4AEF4A",
|
||||
"8 c #29FF29",
|
||||
"9 c #A5A5A5",
|
||||
"0 c #42E642",
|
||||
"q c #9CA59C",
|
||||
"w c #3AE63A",
|
||||
"e c #10FF10",
|
||||
"r c #08FF08",
|
||||
"t c #949C94",
|
||||
"y c #00FF00",
|
||||
"u c #00F700",
|
||||
"i c #8C948C",
|
||||
"p c #00EF00",
|
||||
"a c #08E608",
|
||||
"s c #10DE10",
|
||||
"d c #00E600",
|
||||
"f c #00DE00",
|
||||
"g c #19C519",
|
||||
"h c #00CE00",
|
||||
"j c #00C500",
|
||||
"k c #008C00",
|
||||
"l c #008400",
|
||||
"z c #669900",
|
||||
"x c #999900",
|
||||
"c c #CC9900",
|
||||
"v c #FF9900",
|
||||
"b c #00CC00",
|
||||
"n c #33CC00",
|
||||
"m c #66CC00",
|
||||
"M c #99CC00",
|
||||
"N c #CCCC00",
|
||||
"B c #FFCC00",
|
||||
"V c #66FF00",
|
||||
"C c #99FF00",
|
||||
"Z c #CCFF00",
|
||||
"A c #000033",
|
||||
"S c #330033",
|
||||
"D c #660033",
|
||||
"F c #990033",
|
||||
"G c #CC0033",
|
||||
"H c #FF0033",
|
||||
"J c #003333",
|
||||
"K c #333333",
|
||||
"L c #663333",
|
||||
"P c #993333",
|
||||
"I c #CC3333",
|
||||
"U c #FF3333",
|
||||
"Y c #006633",
|
||||
"T c #336633",
|
||||
"R c #666633",
|
||||
"E c #996633",
|
||||
"W c #CC6633",
|
||||
"Q c #FF6633",
|
||||
"! c #009933",
|
||||
"~ c #339933",
|
||||
"^ c #669933",
|
||||
"/ c #999933",
|
||||
"( c #CC9933",
|
||||
") c #FF9933",
|
||||
"_ c #00CC33",
|
||||
"` c #33CC33",
|
||||
"' c #66CC33",
|
||||
"] c #99CC33",
|
||||
"[ c #CCCC33",
|
||||
"{ c #FFCC33",
|
||||
"} c #33FF33",
|
||||
"| c #66FF33",
|
||||
" . c #99FF33",
|
||||
".. c #CCFF33",
|
||||
"X. c #FFFF33",
|
||||
"o. c #000066",
|
||||
"O. c #330066",
|
||||
"+. c #660066",
|
||||
"@. c #990066",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"X X X X X X X k k X X X X X X X ",
|
||||
"X X X X X X X k j k X X X X X X ",
|
||||
"X X X X X X X k o j k X X X X X ",
|
||||
"X X X X X X X k * o j k X X X X ",
|
||||
"l k k k k k k k * * . j k X X X ",
|
||||
"l @ @ @ @ @ @ @ 4 e e % j k X X ",
|
||||
"l O 3 8 e r r r r r r e ; j k X ",
|
||||
"l @ e e r r r r r u p a f < j k ",
|
||||
"l @ r u p a a a a a f f w j k X ",
|
||||
"l O ; ; ; ; ; < a f b 0 j k X X ",
|
||||
"l k k k k k k k s j 7 j k X X X ",
|
||||
"X X X X X X X k g 7 j k X X X X ",
|
||||
"X X X X X X X k 2 j k X X X X X ",
|
||||
"X X X X X X X k j k X X X X X X ",
|
||||
"X X X X X X X k k X X X X X X X ",
|
||||
"X X X X X X X X X X X X X X X X "
|
||||
};
|
||||
|
||||
564
xpm/send20.xpm
564
xpm/send20.xpm
@@ -1,282 +1,282 @@
|
||||
/* XPM */
|
||||
static const char * send20_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"20 20 256 2",
|
||||
" c #CEFFCE",
|
||||
". c #BDFFBD",
|
||||
"X c #C5F7C5",
|
||||
"o c #B5FFB5",
|
||||
"O c #ADFFAD",
|
||||
"+ c #A5FFA5",
|
||||
"@ c #9CFF9C",
|
||||
"# c None",
|
||||
"$ c #94FF94",
|
||||
"% c #D6CECE",
|
||||
"& c #8CFF8C",
|
||||
"* c #CECEC5",
|
||||
"= c #84FF84",
|
||||
"- c #94EF94",
|
||||
"; c #7BFF7B",
|
||||
": c #CEC5C5",
|
||||
"> c #73FF73",
|
||||
", c #C5C5C5",
|
||||
"< c #C5C5BD",
|
||||
"1 c #6BFF6B",
|
||||
"2 c #BDC5B5",
|
||||
"3 c #63FF63",
|
||||
"4 c #6BF76B",
|
||||
"5 c #BDBDBD",
|
||||
"6 c #BDBDB5",
|
||||
"7 c #5AFF5A",
|
||||
"8 c #63F763",
|
||||
"9 c #B5BDB5",
|
||||
"0 c #B5BDAD",
|
||||
"q c #52FF52",
|
||||
"w c #BDB5B5",
|
||||
"e c #5AF75A",
|
||||
"r c #B5B5B5",
|
||||
"t c #B5B5AD",
|
||||
"y c #52F752",
|
||||
"u c #42FF42",
|
||||
"i c #52EF52",
|
||||
"p c #ADADAD",
|
||||
"a c #ADADA5",
|
||||
"s c #4AEF4A",
|
||||
"d c #31FF31",
|
||||
"f c #29FF29",
|
||||
"g c #A5A5A5",
|
||||
"h c #21FF21",
|
||||
"j c #5AD65A",
|
||||
"k c #42E642",
|
||||
"l c #94AD94",
|
||||
"z c #4ADE4A",
|
||||
"x c #3AE63A",
|
||||
"c c #5ACE5A",
|
||||
"v c #10FF10",
|
||||
"b c #9C9C9C",
|
||||
"n c #31E631",
|
||||
"m c #08FF08",
|
||||
"M c #949C94",
|
||||
"N c #84A584",
|
||||
"B c #00FF00",
|
||||
"V c #3AD63A",
|
||||
"C c #52C552",
|
||||
"Z c #00F700",
|
||||
"A c #8C948C",
|
||||
"S c #849484",
|
||||
"D c #00EF00",
|
||||
"F c #739C73",
|
||||
"G c #08E608",
|
||||
"H c #4AB54A",
|
||||
"J c #31C531",
|
||||
"K c #00E600",
|
||||
"L c #739473",
|
||||
"P c #00DE00",
|
||||
"I c #63945A",
|
||||
"U c #6B8C6B",
|
||||
"Y c #00D600",
|
||||
"T c #42A542",
|
||||
"R c #638C63",
|
||||
"E c #00CE00",
|
||||
"W c #21B521",
|
||||
"Q c #5A8C5A",
|
||||
"! c #00C500",
|
||||
"~ c #528C52",
|
||||
"^ c #3A9C3A",
|
||||
"/ c #4A8C4A",
|
||||
"( c #00BD00",
|
||||
") c #319431",
|
||||
"_ c #219C21",
|
||||
"` c #318C31",
|
||||
"' c #3A843A",
|
||||
"] c #219421",
|
||||
"[ c #298C29",
|
||||
"{ c #318431",
|
||||
"} c #218C21",
|
||||
"| c #218C19",
|
||||
" . c #198C19",
|
||||
".. c #218421",
|
||||
"X. c #297B29",
|
||||
"o. c #198419",
|
||||
"O. c #217B21",
|
||||
"+. c #108410",
|
||||
"@. c #197B19",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"# # # # # # # # # # # # # # # # # # # # ",
|
||||
"# # # # # # # ` 0 # # # # # # # # # # # ",
|
||||
"# # # # # # # ..` l # # # # # # # # # # ",
|
||||
"# # # # # # # [ X ) N # # # # # # # # # ",
|
||||
"# # # # # # # [ &X. ^ F # # # # # # # # ",
|
||||
"# # # # # # # } o & o T I : # # # # # # ",
|
||||
"` ` ` ` ` ` ` ` + 7 ; + H ~ < # # # # # ",
|
||||
"` = = = = = = - @ d v h $ C ' 5 # # # # ",
|
||||
"` = = 3 u h v v v m m m v ; c { 6 # # # ",
|
||||
"` = f v v m m m m m m Z G G 4 j ..t # # ",
|
||||
"` = v m m m Z Z D D G G G P n ; _ R 5 # ",
|
||||
"` = m Z G G G G G G G P Y x 4 _ Q g # # ",
|
||||
"` = $ $ $ $ $ & e P P E k 8 .U g # # # ",
|
||||
"..[ ......[ [ ] e Y ! s i o.L p # # # # ",
|
||||
"# # 5 6 6 6 9 ..i ( i z o.S t # # # # # ",
|
||||
"# # # # # # # } i i V O.A r # # # # # # ",
|
||||
"# # # # # # # } 7 J X.M 6 # # # # # # # ",
|
||||
"# # # # # # # | W ' b < # # # # # # # # ",
|
||||
"# # # # # # # @.~ g , # # # # # # # # # ",
|
||||
"# # # # # # # 6 < , # # # # # # # # # # "
|
||||
};
|
||||
/* XPM */
|
||||
static const char * send20_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"20 20 256 2",
|
||||
" c #CEFFCE",
|
||||
". c #BDFFBD",
|
||||
"X c #C5F7C5",
|
||||
"o c #B5FFB5",
|
||||
"O c #ADFFAD",
|
||||
"+ c #A5FFA5",
|
||||
"@ c #9CFF9C",
|
||||
"# c None",
|
||||
"$ c #94FF94",
|
||||
"% c #D6CECE",
|
||||
"& c #8CFF8C",
|
||||
"* c #CECEC5",
|
||||
"= c #84FF84",
|
||||
"- c #94EF94",
|
||||
"; c #7BFF7B",
|
||||
": c #CEC5C5",
|
||||
"> c #73FF73",
|
||||
", c #C5C5C5",
|
||||
"< c #C5C5BD",
|
||||
"1 c #6BFF6B",
|
||||
"2 c #BDC5B5",
|
||||
"3 c #63FF63",
|
||||
"4 c #6BF76B",
|
||||
"5 c #BDBDBD",
|
||||
"6 c #BDBDB5",
|
||||
"7 c #5AFF5A",
|
||||
"8 c #63F763",
|
||||
"9 c #B5BDB5",
|
||||
"0 c #B5BDAD",
|
||||
"q c #52FF52",
|
||||
"w c #BDB5B5",
|
||||
"e c #5AF75A",
|
||||
"r c #B5B5B5",
|
||||
"t c #B5B5AD",
|
||||
"y c #52F752",
|
||||
"u c #42FF42",
|
||||
"i c #52EF52",
|
||||
"p c #ADADAD",
|
||||
"a c #ADADA5",
|
||||
"s c #4AEF4A",
|
||||
"d c #31FF31",
|
||||
"f c #29FF29",
|
||||
"g c #A5A5A5",
|
||||
"h c #21FF21",
|
||||
"j c #5AD65A",
|
||||
"k c #42E642",
|
||||
"l c #94AD94",
|
||||
"z c #4ADE4A",
|
||||
"x c #3AE63A",
|
||||
"c c #5ACE5A",
|
||||
"v c #10FF10",
|
||||
"b c #9C9C9C",
|
||||
"n c #31E631",
|
||||
"m c #08FF08",
|
||||
"M c #949C94",
|
||||
"N c #84A584",
|
||||
"B c #00FF00",
|
||||
"V c #3AD63A",
|
||||
"C c #52C552",
|
||||
"Z c #00F700",
|
||||
"A c #8C948C",
|
||||
"S c #849484",
|
||||
"D c #00EF00",
|
||||
"F c #739C73",
|
||||
"G c #08E608",
|
||||
"H c #4AB54A",
|
||||
"J c #31C531",
|
||||
"K c #00E600",
|
||||
"L c #739473",
|
||||
"P c #00DE00",
|
||||
"I c #63945A",
|
||||
"U c #6B8C6B",
|
||||
"Y c #00D600",
|
||||
"T c #42A542",
|
||||
"R c #638C63",
|
||||
"E c #00CE00",
|
||||
"W c #21B521",
|
||||
"Q c #5A8C5A",
|
||||
"! c #00C500",
|
||||
"~ c #528C52",
|
||||
"^ c #3A9C3A",
|
||||
"/ c #4A8C4A",
|
||||
"( c #00BD00",
|
||||
") c #319431",
|
||||
"_ c #219C21",
|
||||
"` c #318C31",
|
||||
"' c #3A843A",
|
||||
"] c #219421",
|
||||
"[ c #298C29",
|
||||
"{ c #318431",
|
||||
"} c #218C21",
|
||||
"| c #218C19",
|
||||
" . c #198C19",
|
||||
".. c #218421",
|
||||
"X. c #297B29",
|
||||
"o. c #198419",
|
||||
"O. c #217B21",
|
||||
"+. c #108410",
|
||||
"@. c #197B19",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"# # # # # # # # # # # # # # # # # # # # ",
|
||||
"# # # # # # # ` 0 # # # # # # # # # # # ",
|
||||
"# # # # # # # ..` l # # # # # # # # # # ",
|
||||
"# # # # # # # [ X ) N # # # # # # # # # ",
|
||||
"# # # # # # # [ &X. ^ F # # # # # # # # ",
|
||||
"# # # # # # # } o & o T I : # # # # # # ",
|
||||
"` ` ` ` ` ` ` ` + 7 ; + H ~ < # # # # # ",
|
||||
"` = = = = = = - @ d v h $ C ' 5 # # # # ",
|
||||
"` = = 3 u h v v v m m m v ; c { 6 # # # ",
|
||||
"` = f v v m m m m m m Z G G 4 j ..t # # ",
|
||||
"` = v m m m Z Z D D G G G P n ; _ R 5 # ",
|
||||
"` = m Z G G G G G G G P Y x 4 _ Q g # # ",
|
||||
"` = $ $ $ $ $ & e P P E k 8 .U g # # # ",
|
||||
"..[ ......[ [ ] e Y ! s i o.L p # # # # ",
|
||||
"# # 5 6 6 6 9 ..i ( i z o.S t # # # # # ",
|
||||
"# # # # # # # } i i V O.A r # # # # # # ",
|
||||
"# # # # # # # } 7 J X.M 6 # # # # # # # ",
|
||||
"# # # # # # # | W ' b < # # # # # # # # ",
|
||||
"# # # # # # # @.~ g , # # # # # # # # # ",
|
||||
"# # # # # # # 6 < , # # # # # # # # # # "
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user