mirror of
https://github.com/xmrig/xmrig.git
synced 2026-06-22 12:12:36 -04:00
Compare commits
570 Commits
master
...
43f73163d2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43f73163d2 | ||
|
|
a936d10725 | ||
|
|
69b5f93a1b | ||
|
|
ce2a38e59a | ||
|
|
bfebb46d62 | ||
|
|
e40dffac86 | ||
|
|
09b15aca7a | ||
|
|
bf3831c05b | ||
|
|
7445870414 | ||
|
|
9d537fc2ad | ||
|
|
b14fcf3745 | ||
|
|
1e758c9090 | ||
|
|
c313c1795f | ||
|
|
923dbdf429 | ||
|
|
06c383eddb | ||
|
|
0925865286 | ||
|
|
245822ff1f | ||
|
|
402b70c5bb | ||
|
|
f17975703c | ||
|
|
b7c536073d | ||
|
|
2c543fe47a | ||
|
|
b8b5b8003b | ||
|
|
ea561aca4d | ||
|
|
6e89f28d97 | ||
|
|
4b6759adf9 | ||
|
|
8ddf8de6b7 | ||
|
|
e4eb9ea581 | ||
|
|
72abe1174a | ||
|
|
2a53e73ed5 | ||
|
|
bbe90047b8 | ||
|
|
69ac8baec5 | ||
|
|
bdeb44ec15 | ||
|
|
615715e215 | ||
|
|
eab57aab40 | ||
|
|
53dfbae437 | ||
|
|
3800f67e8a | ||
|
|
004eab8a0b | ||
|
|
523a738fca | ||
|
|
be26d56f66 | ||
|
|
0e5b54b80a | ||
|
|
7f801d0904 | ||
|
|
41d5be9c65 | ||
|
|
4065036ea7 | ||
|
|
ecdb1929e2 | ||
|
|
c807e955d3 | ||
|
|
6f5cbd7e53 | ||
|
|
dabb2f7118 | ||
|
|
1a0df95d66 | ||
|
|
3c907d6bc4 | ||
|
|
67d796e7b5 | ||
|
|
e3320d766d | ||
|
|
2feb99053f | ||
|
|
9afe95e454 | ||
|
|
449982aad2 | ||
|
|
f60350ed6c | ||
|
|
cf10b0ca26 | ||
|
|
53e2715638 | ||
|
|
5aebdb84bd | ||
|
|
39a77fa92d | ||
|
|
7261d47c0e | ||
|
|
28b86148ed | ||
|
|
6e39eee85b | ||
|
|
22ab8c6254 | ||
|
|
349303201a | ||
|
|
356ff5c700 | ||
|
|
097462e12e | ||
|
|
7c13cbfc98 | ||
|
|
aceef09f1f | ||
|
|
13f721dd78 | ||
|
|
29fa5c61e0 | ||
|
|
e76dcad6bc | ||
|
|
13bb0f14e1 | ||
|
|
efb40419e8 | ||
|
|
054c0a174b | ||
|
|
945a9cbcb9 | ||
|
|
9d0d6ad9b6 | ||
|
|
5579440640 | ||
|
|
74f39ac947 | ||
|
|
ea93d0a3ad | ||
|
|
62b422d5b7 | ||
|
|
027a39e22f | ||
|
|
442353b31e | ||
|
|
8a1ca690eb | ||
|
|
36b38d88a1 | ||
|
|
28ad107de8 | ||
|
|
ba2f07a1f7 | ||
|
|
4c6d815b19 | ||
|
|
fef0e217c1 | ||
|
|
b765a6d3fb | ||
|
|
50bffd39d8 | ||
|
|
59f1b7d19b | ||
|
|
b0beffc4f0 | ||
|
|
76122aedf4 | ||
|
|
76d0982296 | ||
|
|
289139a5be | ||
|
|
3fdd5375be | ||
|
|
699db24ce7 | ||
|
|
bc20f3a1d5 | ||
|
|
ce3a19cec1 | ||
|
|
13a6b1f7b5 | ||
|
|
6c75526d3e | ||
|
|
fd8ed2c6a6 | ||
|
|
50c6ad9449 | ||
|
|
57d9d3ea7c | ||
|
|
504f608871 | ||
|
|
174663bb50 | ||
|
|
4fe9f373a4 | ||
|
|
777765b4fd | ||
|
|
5d35f324fc | ||
|
|
4108d2d823 | ||
|
|
7c6289b331 | ||
|
|
1b89b14886 | ||
|
|
a0e2ac262c | ||
|
|
da669975e1 | ||
|
|
f6380d72e1 | ||
|
|
85bc258811 | ||
|
|
ab9287b7e2 | ||
|
|
e97fb6ee5b | ||
|
|
89ca7edb59 | ||
|
|
ef99595476 | ||
|
|
aa0b9280e2 | ||
|
|
344c967881 | ||
|
|
158bf879c1 | ||
|
|
cfe1469c43 | ||
|
|
5088fbdfad | ||
|
|
eebb03a9eb | ||
|
|
5dce0225b3 | ||
|
|
6cc0c74351 | ||
|
|
0c1fda1ada | ||
|
|
621d6cf03e | ||
|
|
53861b97f0 | ||
|
|
d3d1b111fb | ||
|
|
3a7eb49630 | ||
|
|
1719879f7e | ||
|
|
966aaa72ca | ||
|
|
7ddea5c68b | ||
|
|
821c04ed0e | ||
|
|
54e736aaaa | ||
|
|
2a6e64ca7d | ||
|
|
77a951a6a4 | ||
|
|
60c9c0c07d | ||
|
|
c8cc5c573c | ||
|
|
2c0a18d140 | ||
|
|
59f90d76a8 | ||
|
|
4bc236bfcf | ||
|
|
78dcdbd2dd | ||
|
|
8724ce7328 | ||
|
|
49278bc57f | ||
|
|
e3c96628df | ||
|
|
e0ea3d704d | ||
|
|
6e63e92349 | ||
|
|
4bafc9f3c0 | ||
|
|
d17818bb24 | ||
|
|
a57d1bbbda | ||
|
|
33d5563baf | ||
|
|
bdb83b555d | ||
|
|
f650a73845 | ||
|
|
e3dc4db54f | ||
|
|
b1edcb31bd | ||
|
|
294c9acee3 | ||
|
|
81b629acad | ||
|
|
5a8a726f69 | ||
|
|
37149127f4 | ||
|
|
08e7720f30 | ||
|
|
5e351798e0 | ||
|
|
7c2ebd847e | ||
|
|
ef7a7a75a2 | ||
|
|
6b406cf82c | ||
|
|
2cf2fcaf8c | ||
|
|
45f45cf8cc | ||
|
|
61fed602be | ||
|
|
f9c7ee9002 | ||
|
|
8c3eae0598 | ||
|
|
9514cfd7fd | ||
|
|
78c018a2d6 | ||
|
|
c715fc618c | ||
|
|
21b156cbda | ||
|
|
a6b6f22d08 | ||
|
|
651306a57a | ||
|
|
f4f5367a78 | ||
|
|
822dfe5aef | ||
|
|
57e38f070a | ||
|
|
58dd3294d0 | ||
|
|
a979845882 | ||
|
|
22c39226b0 | ||
|
|
54ee6bbd5d | ||
|
|
d4164ad366 | ||
|
|
5499d5a97a | ||
|
|
aaf1ff1460 | ||
|
|
35edf9a93c | ||
|
|
38c9f4e4d7 | ||
|
|
2a40277cf9 | ||
|
|
8de748fa65 | ||
|
|
47acc49471 | ||
|
|
b9a84ef8e1 | ||
|
|
087715bd93 | ||
|
|
780e2bcd1c | ||
|
|
338b0b10f5 | ||
|
|
176f0edef3 | ||
|
|
48c4f3c870 | ||
|
|
b994d6f8c8 | ||
|
|
26e91c516b | ||
|
|
5eafa9e455 | ||
|
|
50b1bf8a1d | ||
|
|
a334a9a956 | ||
|
|
aa56d62a78 | ||
|
|
d530624a0d | ||
|
|
284a6f06d9 | ||
|
|
a397865b54 | ||
|
|
cb67ab46fc | ||
|
|
c4ff8c4064 | ||
|
|
aaaaf5c1ed | ||
|
|
be3388b5ea | ||
|
|
316af8c2b9 | ||
|
|
5b2b02f2d7 | ||
|
|
29653a1ccf | ||
|
|
aab5b7f55e | ||
|
|
57e8fe51e3 | ||
|
|
e2ea726a6a | ||
|
|
30fdc92884 | ||
|
|
42235a56da | ||
|
|
717e2ac7b6 | ||
|
|
92ebd18f0b | ||
|
|
32b49797d9 | ||
|
|
0ada4ca4ac | ||
|
|
ca42206c42 | ||
|
|
42ab70462f | ||
|
|
0e753f5077 | ||
|
|
135d70c361 | ||
|
|
51c783a313 | ||
|
|
1d74e9fd3c | ||
|
|
d89305bfcb | ||
|
|
df7a8d1a52 | ||
|
|
4fb6c935d4 | ||
|
|
a457b5fe51 | ||
|
|
ca0f93bb22 | ||
|
|
0bb1a29c92 | ||
|
|
dcb1f43663 | ||
|
|
ce244d01dd | ||
|
|
75cebc4a49 | ||
|
|
1251f0b89a | ||
|
|
ed8d2ee136 | ||
|
|
df48cb1f98 | ||
|
|
f9287c2e14 | ||
|
|
db6a553341 | ||
|
|
b6674abb41 | ||
|
|
e71c1b51bf | ||
|
|
baeb45e8a1 | ||
|
|
04af1b40ba | ||
|
|
15bfd8df94 | ||
|
|
4cef605258 | ||
|
|
ccfe900992 | ||
|
|
e4986059f4 | ||
|
|
b719595802 | ||
|
|
247bb8ca0b | ||
|
|
6b98b916fd | ||
|
|
4d9491fa41 | ||
|
|
1eff7fea93 | ||
|
|
b4c93b7ff6 | ||
|
|
24d45ab5b5 | ||
|
|
954be16050 | ||
|
|
7429ec5615 | ||
|
|
31183a55fa | ||
|
|
d7a567af73 | ||
|
|
daee4aa495 | ||
|
|
e812765a1d | ||
|
|
dd38dbe795 | ||
|
|
e9a696726f | ||
|
|
0519d17f50 | ||
|
|
260fc1d44b | ||
|
|
9aaf724358 | ||
|
|
55bf6e03a7 | ||
|
|
1523e6c263 | ||
|
|
067fbf15f8 | ||
|
|
e956e47b12 | ||
|
|
d03b4ba9d7 | ||
|
|
7dbced5f95 | ||
|
|
f6db5efc7e | ||
|
|
bda6727e9f | ||
|
|
6ea9723a4d | ||
|
|
2ffcf5721d | ||
|
|
d6b726ff2c | ||
|
|
88fabbd7b6 | ||
|
|
576f5b791e | ||
|
|
4ed9f83a0f | ||
|
|
678de08b44 | ||
|
|
677fdda3e2 | ||
|
|
d5694b9908 | ||
|
|
dcb20d09e8 | ||
|
|
1489966833 | ||
|
|
29faa30182 | ||
|
|
a89a98f3db | ||
|
|
64a25dfe08 | ||
|
|
98c6edf994 | ||
|
|
12e05b601c | ||
|
|
99e4bae97e | ||
|
|
78774060fc | ||
|
|
4156af42b0 | ||
|
|
4d211b7160 | ||
|
|
376c870e7e | ||
|
|
5a519b6aca | ||
|
|
eb58aea9c7 | ||
|
|
4540208c9d | ||
|
|
9a5cc546c0 | ||
|
|
c41cc3d494 | ||
|
|
12aeb03da2 | ||
|
|
8fa101b6ef | ||
|
|
3f98d07e76 | ||
|
|
01e2945ab7 | ||
|
|
f3e6423e9d | ||
|
|
16d5419dce | ||
|
|
066d9086b6 | ||
|
|
14568121e2 | ||
|
|
6e95a8ecd6 | ||
|
|
78e047a398 | ||
|
|
da8f0fe394 | ||
|
|
a84d95926e | ||
|
|
6dde88e573 | ||
|
|
a6b46e4c58 | ||
|
|
b150a26030 | ||
|
|
149bfbf674 | ||
|
|
8c0db9485c | ||
|
|
0707589033 | ||
|
|
d055ed96c4 | ||
|
|
c9e7ac7f97 | ||
|
|
f131c2e5fb | ||
|
|
c208f8eb8f | ||
|
|
91462b4409 | ||
|
|
2ea0f405aa | ||
|
|
1c4178eedc | ||
|
|
245838ffae | ||
|
|
b8aa42cc3d | ||
|
|
5e3e8b3004 | ||
|
|
f9bc70234f | ||
|
|
eb126cba55 | ||
|
|
18413f26e8 | ||
|
|
fe76800fc8 | ||
|
|
6df49a9c6b | ||
|
|
93690985f4 | ||
|
|
97e81f2cba | ||
|
|
b19a0b7f51 | ||
|
|
5e777a5ed9 | ||
|
|
36ade0d24e | ||
|
|
d03fb91b0a | ||
|
|
47ba0a015b | ||
|
|
814dda724e | ||
|
|
e0640badc0 | ||
|
|
81c1a80a71 | ||
|
|
d2ccc0473c | ||
|
|
701d8f093a | ||
|
|
eee969efba | ||
|
|
79cf79d512 | ||
|
|
2aaaadea13 | ||
|
|
bc16c50a81 | ||
|
|
67ddfebac3 | ||
|
|
993733cb1f | ||
|
|
8e428cd3b3 | ||
|
|
b255cde117 | ||
|
|
f694d5d9f6 | ||
|
|
cdc31bd97e | ||
|
|
4f758f460f | ||
|
|
aa6237a834 | ||
|
|
7714de5bff | ||
|
|
70cf22f50c | ||
|
|
2112c75ad1 | ||
|
|
38d9637fbc | ||
|
|
eba2fc88f0 | ||
|
|
7c8b4f72c8 | ||
|
|
2bd032b538 | ||
|
|
9a37cd4032 | ||
|
|
831173634e | ||
|
|
d4359bdbd9 | ||
|
|
0d72cc5528 | ||
|
|
f26e412967 | ||
|
|
c5a78fdaec | ||
|
|
962ac3ad8e | ||
|
|
58a4f727cd | ||
|
|
1e01225c97 | ||
|
|
f315063b94 | ||
|
|
3d7fb21c63 | ||
|
|
808e182e55 | ||
|
|
bf7f7dee60 | ||
|
|
c19cb4672d | ||
|
|
4639c860a4 | ||
|
|
9586e5805c | ||
|
|
37e37d3a63 | ||
|
|
3050fa219a | ||
|
|
9d05adad14 | ||
|
|
8709873fb1 | ||
|
|
d87ce78a64 | ||
|
|
61e8eb5ada | ||
|
|
2787a90f47 | ||
|
|
569975d780 | ||
|
|
a88b15d640 | ||
|
|
e23d3c431b | ||
|
|
c0fec3db63 | ||
|
|
66ab9900fc | ||
|
|
8253b1c4f3 | ||
|
|
b3c867a8ce | ||
|
|
45ab3b4e26 | ||
|
|
8c5184e8d2 | ||
|
|
a51ba9d9a5 | ||
|
|
3765f26c08 | ||
|
|
820fee4531 | ||
|
|
e4be1db8c9 | ||
|
|
3e6c1a92c8 | ||
|
|
e6f199e4f4 | ||
|
|
b68132f884 | ||
|
|
01b7084ea4 | ||
|
|
4bc8afa427 | ||
|
|
c5476c3bf2 | ||
|
|
9499d03bf1 | ||
|
|
ca70cd4d75 | ||
|
|
d9b8b54bfb | ||
|
|
8bc932bd5b | ||
|
|
a7746af684 | ||
|
|
e7e844dfad | ||
|
|
922449118f | ||
|
|
128f44c21a | ||
|
|
d69c697005 | ||
|
|
571103d2ce | ||
|
|
49775ee7c2 | ||
|
|
9e4da80852 | ||
|
|
556c01d75c | ||
|
|
d4537f443e | ||
|
|
0e3914e26d | ||
|
|
3b8c1bdae2 | ||
|
|
24d43c013f | ||
|
|
d12cf28ebf | ||
|
|
fb832d2650 | ||
|
|
a20d3361b1 | ||
|
|
848c77eb3b | ||
|
|
7ef9bb85d4 | ||
|
|
cefeb871c0 | ||
|
|
c4a42a1e56 | ||
|
|
fc2614ef81 | ||
|
|
8ffc9f3ff2 | ||
|
|
f917cea32d | ||
|
|
f462571dfd | ||
|
|
ca7951c90f | ||
|
|
53451615e6 | ||
|
|
5e956d494d | ||
|
|
25bbfb782c | ||
|
|
3ed462210e | ||
|
|
a69f587d4c | ||
|
|
a27ce3a804 | ||
|
|
7a6a07c6b6 | ||
|
|
a8376bb512 | ||
|
|
5c0e89241f | ||
|
|
506c5b4356 | ||
|
|
ebf7f67b72 | ||
|
|
41c8408014 | ||
|
|
8dd283a9f0 | ||
|
|
c600d5da44 | ||
|
|
f49e566a9c | ||
|
|
378292e84e | ||
|
|
25f35b7e77 | ||
|
|
58de9772f3 | ||
|
|
cbcfab0144 | ||
|
|
4d65433904 | ||
|
|
d117c3b797 | ||
|
|
12c18a838d | ||
|
|
dcbfe53869 | ||
|
|
d48fd4c7ba | ||
|
|
8d76e05614 | ||
|
|
464fb8d39a | ||
|
|
5ae25845fa | ||
|
|
adfafc5308 | ||
|
|
3f8024c19e | ||
|
|
43f09e915e | ||
|
|
e845a402aa | ||
|
|
3bed5d9416 | ||
|
|
17a650007d | ||
|
|
6dd9718983 | ||
|
|
e29dc5f877 | ||
|
|
da6e059e68 | ||
|
|
c998be4235 | ||
|
|
b4037cdb2c | ||
|
|
4414287132 | ||
|
|
cb22009ee5 | ||
|
|
e600d22cc6 | ||
|
|
21d32645bf | ||
|
|
a6630e8aed | ||
|
|
5131cc3ef5 | ||
|
|
7ed58b2c20 | ||
|
|
3800d9f172 | ||
|
|
fe414fb2ca | ||
|
|
0e590be894 | ||
|
|
5b5f97d31f | ||
|
|
35a611030a | ||
|
|
189eda6467 | ||
|
|
3ca70e2276 | ||
|
|
a78c014511 | ||
|
|
1832f47d6f | ||
|
|
495d447cab | ||
|
|
58d20254eb | ||
|
|
d6967693a1 | ||
|
|
6893e35021 | ||
|
|
d3af3e3bb2 | ||
|
|
e4cbd36d22 | ||
|
|
c9907eb617 | ||
|
|
4cb8bc4dde | ||
|
|
4fafee2e93 | ||
|
|
af96ca4f46 | ||
|
|
893aef7c42 | ||
|
|
faecf408d6 | ||
|
|
e314fa8ec9 | ||
|
|
ffa10e0c0d | ||
|
|
eec8f8ce4c | ||
|
|
d6f96aad76 | ||
|
|
6d4996bbba | ||
|
|
8a50184a65 | ||
|
|
e886fb03aa | ||
|
|
2ea911063d | ||
|
|
95e5c24a03 | ||
|
|
4ff190e08e | ||
|
|
881ddc7d26 | ||
|
|
a47dc9b486 | ||
|
|
3faf122855 | ||
|
|
fb004deef3 | ||
|
|
fa5cc9c4e6 | ||
|
|
40bf930d8c | ||
|
|
46517bc906 | ||
|
|
021cf75b10 | ||
|
|
f74696cd38 | ||
|
|
95faab9bd8 | ||
|
|
91bd1cf8ce | ||
|
|
87eb62b4eb | ||
|
|
1a819c6189 | ||
|
|
541ecc4e4b | ||
|
|
a671cdcadf | ||
|
|
139d30dd4a | ||
|
|
cff4757a96 | ||
|
|
a8bc3c7dc7 | ||
|
|
377047e96e | ||
|
|
99ccceb4a7 | ||
|
|
f5dc226717 | ||
|
|
143bd192a2 | ||
|
|
d9d720eed2 | ||
|
|
bd56b8892c | ||
|
|
feeb226507 | ||
|
|
67ed81f1ec | ||
|
|
9b796b4b8a | ||
|
|
9e231e322b | ||
|
|
850ca88c48 | ||
|
|
4d730a7a21 | ||
|
|
bbe085f6a4 | ||
|
|
0f880db56f | ||
|
|
faa0532237 | ||
|
|
b2a2c1cacd | ||
|
|
a783282739 | ||
|
|
2979b2c872 | ||
|
|
c33802280e | ||
|
|
846eca9743 | ||
|
|
f340ea69f2 | ||
|
|
0bc9d775c6 | ||
|
|
30a4f53c8f | ||
|
|
98f95584a0 | ||
|
|
32984383a3 | ||
|
|
2dd5fe5e48 | ||
|
|
2ceb9c8749 | ||
|
|
684feb38fd | ||
|
|
d6a56a2e0a | ||
|
|
3b77fc1dbd | ||
|
|
9951bd756d | ||
|
|
a8d399e450 | ||
|
|
5f73919be1 | ||
|
|
c8425e9950 | ||
|
|
4c256f9ab7 | ||
|
|
70ce04b44c |
208
.github/workflows/deploy.yml
vendored
Normal file
208
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
name: Create release and build artifacts
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_win:
|
||||||
|
name: Build Windows artifacts
|
||||||
|
runs-on: windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Checkout deps
|
||||||
|
run: git clone https://github.com/xmrig/xmrig-deps.git
|
||||||
|
- name: Build project on Windows
|
||||||
|
run: |
|
||||||
|
cmake . -G "MinGW Makefiles" -DXMRIG_DEPS=xmrig-deps\gcc\x64
|
||||||
|
make -j2
|
||||||
|
copy src\config.json .
|
||||||
|
copy bin\WinRing0\WinRing0x64.sys .
|
||||||
|
7z a -tzip -mx windows_build.zip xmrig.exe config.json WinRing0x64.sys
|
||||||
|
- name: Upload Windows build artifacts
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: windows_build
|
||||||
|
path: windows_build.zip
|
||||||
|
|
||||||
|
build_lin:
|
||||||
|
name: Build Ubuntu artifacts
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Prepare Ubuntu tools
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Build project on Ubuntu
|
||||||
|
run: |
|
||||||
|
cmake .
|
||||||
|
make -j$(nproc)
|
||||||
|
cp src/config.json .
|
||||||
|
tar cfz ubuntu_build.tar.gz xmrig config.json
|
||||||
|
- name: Upload Ubuntu build artifacts
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: ubuntu_build
|
||||||
|
path: ubuntu_build.tar.gz
|
||||||
|
|
||||||
|
build_macos:
|
||||||
|
name: Build MacOS artifacts
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Prepare MacOS tools
|
||||||
|
run: |
|
||||||
|
brew install cmake libuv openssl hwloc
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Build hwloc on MacOS
|
||||||
|
run: |
|
||||||
|
curl -O https://download.open-mpi.org/release/hwloc/v2.1/hwloc-2.1.0.tar.bz2
|
||||||
|
tar xjf hwloc-2.1.0.tar.bz2
|
||||||
|
cd hwloc-2.1.0
|
||||||
|
./configure --disable-shared --enable-static --disable-io --disable-libxml2
|
||||||
|
make -j$(sysctl -n hw.logicalcpu)
|
||||||
|
cd ..
|
||||||
|
- name: Build project on MacOS
|
||||||
|
run: |
|
||||||
|
cmake . -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DHWLOC_INCLUDE_DIR=hwloc-2.1.0/include -DHWLOC_LIBRARY=hwloc-2.1.0/hwloc/.libs/libhwloc.a
|
||||||
|
make -j$(sysctl -n hw.logicalcpu)
|
||||||
|
cp src/config.json .
|
||||||
|
tar cfz macos_build.tar.gz xmrig config.json
|
||||||
|
- name: Upload MacOS build artifacts
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: macos_build
|
||||||
|
path: macos_build.tar.gz
|
||||||
|
|
||||||
|
build_lin_rh7:
|
||||||
|
name: Build CentOS 7 artifacts
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: centos:7
|
||||||
|
steps:
|
||||||
|
- name: Prepare CentOS 7 tools
|
||||||
|
run: |
|
||||||
|
yum install -y centos-release-scl epel-release
|
||||||
|
yum install -y devtoolset-9
|
||||||
|
yum install -y wget git cmake3 automake libtool autoconf libstdc++-static glibc-static perl-IPC-Cmd
|
||||||
|
- name: Checkout code
|
||||||
|
run: |
|
||||||
|
git clone https://github.com/MoneroOcean/xmrig.git .
|
||||||
|
git checkout ${GITHUB_REF:10}
|
||||||
|
- name: Build project on CentOS 7
|
||||||
|
run: |
|
||||||
|
source /opt/rh/devtoolset-9/enable
|
||||||
|
cd scripts
|
||||||
|
./build_deps.sh
|
||||||
|
cd ..
|
||||||
|
cmake3 . -DXMRIG_DEPS=scripts/deps
|
||||||
|
make -j$(nproc)
|
||||||
|
cp src/config.json .
|
||||||
|
tar cfz centos7_build.tar.gz xmrig config.json
|
||||||
|
- name: Upload CentOS 7 build artifacts
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: centos7_build
|
||||||
|
path: centos7_build.tar.gz
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
needs: [build_win, build_lin, build_macos, build_lin_rh7]
|
||||||
|
name: Create release and upload artifacts
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1.0.0
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: Release ${{ github.ref }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
- name: Set version
|
||||||
|
id: version
|
||||||
|
run: echo ::set-output name=VERSION::${GITHUB_REF:10}
|
||||||
|
- name: Download Windows build artifacts
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: windows_build
|
||||||
|
- name: Download Ubuntu build artifacts
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: ubuntu_build
|
||||||
|
- name: Download MacOS build artifacts
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: macos_build
|
||||||
|
- name: Download CentOS 7 build artifacts
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: centos7_build
|
||||||
|
- name: Upload Windows build release asset
|
||||||
|
uses: actions/upload-release-asset@v1.0.1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: windows_build/windows_build.zip
|
||||||
|
asset_name: xmrig-${{steps.version.outputs.VERSION}}-win64.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
- name: Upload Ubuntu build release asset
|
||||||
|
uses: actions/upload-release-asset@v1.0.1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ubuntu_build/ubuntu_build.tar.gz
|
||||||
|
asset_name: xmrig-${{steps.version.outputs.VERSION}}-lin64.tar.gz
|
||||||
|
asset_content_type: application/zip
|
||||||
|
- name: Upload MacOS build release asset
|
||||||
|
uses: actions/upload-release-asset@v1.0.1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: macos_build/macos_build.tar.gz
|
||||||
|
asset_name: xmrig-${{steps.version.outputs.VERSION}}-mac64.tar.gz
|
||||||
|
asset_content_type: application/zip
|
||||||
|
- name: Upload CentOS 7 build release asset
|
||||||
|
uses: actions/upload-release-asset@v1.0.1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: centos7_build/centos7_build.tar.gz
|
||||||
|
asset_name: xmrig-${{steps.version.outputs.VERSION}}-lin64-compat.tar.gz
|
||||||
|
asset_content_type: application/zip
|
||||||
|
- name: Update xmrig_setup repo
|
||||||
|
run: |
|
||||||
|
git clone https://$GITHUB_ACTOR:${{secrets.xmrig_setup_key}}@github.com/MoneroOcean/xmrig_setup.git
|
||||||
|
cd xmrig_setup
|
||||||
|
git config user.name MoneroOcean
|
||||||
|
git config user.email support@moneroocean.stream
|
||||||
|
cp ../centos7_build/centos7_build.tar.gz xmrig.tar.gz
|
||||||
|
cp ../windows_build/windows_build.zip xmrig.zip
|
||||||
|
unzip xmrig.zip
|
||||||
|
zip -u offline_miner_setup.zip xmrig.exe config.json WinRing0x64.sys
|
||||||
|
git commit -m "xmrig "${GITHUB_REF:10}" based release" xmrig.tar.gz xmrig.zip offline_miner_setup.zip
|
||||||
|
git push
|
||||||
|
cd ..
|
||||||
|
- name: Update hiveos repo
|
||||||
|
run: |
|
||||||
|
git clone https://$GITHUB_ACTOR:${{secrets.xmrig_setup_key}}@github.com/MoneroOcean/hiveos.git
|
||||||
|
cd hiveos
|
||||||
|
git config user.name MoneroOcean
|
||||||
|
git config user.email support@moneroocean.stream
|
||||||
|
tar xf ../centos7_build/centos7_build.tar.gz
|
||||||
|
mv xmrig mo_xmrig/xmrig
|
||||||
|
mv config.json mo_xmrig/config_global.json
|
||||||
|
export VER=${GITHUB_REF:10}
|
||||||
|
export VER=${VER//-/_}
|
||||||
|
tar -zcvf mo_xmrig-$VER.tar.gz mo_xmrig
|
||||||
|
git add mo_xmrig-$VER.tar.gz mo_xmrig/xmrig mo_xmrig/config_global.json
|
||||||
|
git commit -m "xmrig "${GITHUB_REF:10}" based release" mo_xmrig-$VER.tar.gz
|
||||||
|
git push
|
||||||
32
.github/workflows/test.yml
vendored
Normal file
32
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
on: push
|
||||||
|
|
||||||
|
name: Test builds
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_win:
|
||||||
|
name: Windows build
|
||||||
|
runs-on: windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Checkout deps
|
||||||
|
run: git clone https://github.com/xmrig/xmrig-deps.git
|
||||||
|
- name: Build project on Windows
|
||||||
|
run: |
|
||||||
|
cmake . -G "MinGW Makefiles" -DXMRIG_DEPS=xmrig-deps\gcc\x64
|
||||||
|
make -j2
|
||||||
|
|
||||||
|
build_lin:
|
||||||
|
name: Ubuntu build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Prepare Ubuntu tools
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Build project on Ubuntu
|
||||||
|
run: |
|
||||||
|
cmake .
|
||||||
|
make -j$(nproc)
|
||||||
@@ -6,6 +6,7 @@ option(WITH_CN_LITE "Enable CryptoNight-Lite algorithms family" ON)
|
|||||||
option(WITH_CN_HEAVY "Enable CryptoNight-Heavy algorithms family" ON)
|
option(WITH_CN_HEAVY "Enable CryptoNight-Heavy algorithms family" ON)
|
||||||
option(WITH_CN_PICO "Enable CryptoNight-Pico algorithm" ON)
|
option(WITH_CN_PICO "Enable CryptoNight-Pico algorithm" ON)
|
||||||
option(WITH_CN_FEMTO "Enable CryptoNight-UPX2 algorithm" ON)
|
option(WITH_CN_FEMTO "Enable CryptoNight-UPX2 algorithm" ON)
|
||||||
|
option(WITH_CN_GPU "Enable CryptoNight-GPU algorithm" ON)
|
||||||
option(WITH_RANDOMX "Enable RandomX algorithms family" ON)
|
option(WITH_RANDOMX "Enable RandomX algorithms family" ON)
|
||||||
option(WITH_ARGON2 "Enable Argon2 algorithms family" ON)
|
option(WITH_ARGON2 "Enable Argon2 algorithms family" ON)
|
||||||
option(WITH_KAWPOW "Enable KawPow algorithms family" ON)
|
option(WITH_KAWPOW "Enable KawPow algorithms family" ON)
|
||||||
@@ -25,6 +26,7 @@ option(WITH_NVML "Enable NVML (NVIDIA Management Library) support (on
|
|||||||
option(WITH_ADL "Enable ADL (AMD Display Library) or sysfs support (only if OpenCL backend enabled)" ON)
|
option(WITH_ADL "Enable ADL (AMD Display Library) or sysfs support (only if OpenCL backend enabled)" ON)
|
||||||
option(WITH_STRICT_CACHE "Enable strict checks for OpenCL cache" ON)
|
option(WITH_STRICT_CACHE "Enable strict checks for OpenCL cache" ON)
|
||||||
option(WITH_INTERLEAVE_DEBUG_LOG "Enable debug log for threads interleave" OFF)
|
option(WITH_INTERLEAVE_DEBUG_LOG "Enable debug log for threads interleave" OFF)
|
||||||
|
option(WITH_MO_BENCHMARK "Enable Benchmark module and algo-perf feature (for MoneroOcean)" ON)
|
||||||
option(WITH_PROFILING "Enable profiling for developers" OFF)
|
option(WITH_PROFILING "Enable profiling for developers" OFF)
|
||||||
option(WITH_SSE4_1 "Enable SSE 4.1 for Blake2" ON)
|
option(WITH_SSE4_1 "Enable SSE 4.1 for Blake2" ON)
|
||||||
option(WITH_AVX2 "Enable AVX2 for Blake2" ON)
|
option(WITH_AVX2 "Enable AVX2 for Blake2" ON)
|
||||||
@@ -129,8 +131,26 @@ set(SOURCES_CRYPTO
|
|||||||
src/crypto/common/MemoryPool.cpp
|
src/crypto/common/MemoryPool.cpp
|
||||||
src/crypto/common/Nonce.cpp
|
src/crypto/common/Nonce.cpp
|
||||||
src/crypto/common/VirtualMemory.cpp
|
src/crypto/common/VirtualMemory.cpp
|
||||||
|
src/crypto/flex/flex.cpp
|
||||||
|
src/crypto/flex/cryptonote/cryptonight_dark.c
|
||||||
|
src/crypto/flex/cryptonote/cryptonight_dark_lite.c
|
||||||
|
src/crypto/flex/cryptonote/cryptonight_fast.c
|
||||||
|
src/crypto/flex/cryptonote/cryptonight_lite.c
|
||||||
|
src/crypto/flex/cryptonote/cryptonight_turtle.c
|
||||||
|
src/crypto/flex/cryptonote/cryptonight_turtle_lite.c
|
||||||
|
src/crypto/flex/cryptonote/crypto/oaes_lib.c
|
||||||
|
src/crypto/flex/cryptonote/crypto/aesb.c
|
||||||
|
src/crypto/flex/cryptonote/crypto/hash.c
|
||||||
|
src/crypto/flex/cryptonote/crypto/c_keccak.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (WITH_MO_BENCHMARK)
|
||||||
|
list(APPEND SOURCES
|
||||||
|
src/core/MoBenchmark.cpp
|
||||||
|
)
|
||||||
|
add_definitions(/DXMRIG_FEATURE_MO_BENCHMARK)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID MATCHES GNU)
|
if (CMAKE_C_COMPILER_ID MATCHES GNU)
|
||||||
set_source_files_properties(src/crypto/cn/CnHash.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize")
|
set_source_files_properties(src/crypto/cn/CnHash.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize")
|
||||||
endif()
|
endif()
|
||||||
@@ -198,6 +218,7 @@ add_definitions(-D__STDC_FORMAT_MACROS -DUNICODE -D_FILE_OFFSET_BITS=64)
|
|||||||
find_package(UV REQUIRED)
|
find_package(UV REQUIRED)
|
||||||
|
|
||||||
include(cmake/flags.cmake)
|
include(cmake/flags.cmake)
|
||||||
|
include(cmake/cn-gpu.cmake)
|
||||||
include(cmake/randomx.cmake)
|
include(cmake/randomx.cmake)
|
||||||
include(cmake/argon2.cmake)
|
include(cmake/argon2.cmake)
|
||||||
include(cmake/kawpow.cmake)
|
include(cmake/kawpow.cmake)
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -1,21 +1,21 @@
|
|||||||
# XMRig
|
# XMRig
|
||||||
|
|
||||||
[](https://github.com/xmrig/xmrig/releases)
|
[](https://github.com/MoneroOcean/xmrig/releases)
|
||||||
[](https://github.com/xmrig/xmrig/releases)
|
[](https://github.com/MoneroOcean/xmrig/releases)
|
||||||
[](https://github.com/xmrig/xmrig/releases)
|
[](https://github.com/MoneroOcean/xmrig/releases)
|
||||||
[](https://github.com/xmrig/xmrig/blob/master/LICENSE)
|
[](https://github.com/MoneroOcean/xmrig/blob/master/LICENSE)
|
||||||
[](https://github.com/xmrig/xmrig/stargazers)
|
[](https://github.com/MoneroOcean/xmrig/stargazers)
|
||||||
[](https://github.com/xmrig/xmrig/network)
|
[](https://github.com/MoneroOcean/xmrig/network)
|
||||||
|
|
||||||
XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight and [GhostRider](https://github.com/xmrig/xmrig/tree/master/src/crypto/ghostrider#readme) unified CPU/GPU miner and [RandomX benchmark](https://xmrig.com/benchmark). Official binaries are available for Windows, Linux, macOS and FreeBSD.
|
XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight and [GhostRider](https://github.com/xmrig/xmrig/tree/master/src/crypto/ghostrider#readme) unified CPU/GPU miner and [RandomX benchmark](https://xmrig.com/benchmark). Official binaries are available for Windows, Linux, macOS and FreeBSD.
|
||||||
|
|
||||||
## Mining backends
|
## Mining backends
|
||||||
- **CPU** (x86/x64/ARMv7/ARMv8)
|
- **CPU** (x86/x64/ARMv7/ARMv8)
|
||||||
- **OpenCL** for AMD GPUs.
|
- **OpenCL** for AMD GPUs.
|
||||||
- **CUDA** for NVIDIA GPUs via external [CUDA plugin](https://github.com/xmrig/xmrig-cuda).
|
- **CUDA** for NVIDIA GPUs via external [CUDA plugin](https://github.com/MoneroOcean/xmrig-cuda).
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
* **[Binary releases](https://github.com/xmrig/xmrig/releases)**
|
* **[Binary releases](https://github.com/MoneroOcean/xmrig/releases)**
|
||||||
* **[Build from source](https://xmrig.com/docs/miner/build)**
|
* **[Build from source](https://xmrig.com/docs/miner/build)**
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|||||||
31
cmake/cn-gpu.cmake
Normal file
31
cmake/cn-gpu.cmake
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
if (WITH_CN_GPU AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
add_definitions(/DXMRIG_ALGO_CN_GPU)
|
||||||
|
|
||||||
|
if (XMRIG_ARM)
|
||||||
|
list(APPEND SOURCES_CRYPTO
|
||||||
|
src/crypto/cn/gpu/cn_gpu_arm.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||||
|
set_source_files_properties(src/crypto/cn/gpu/cn_gpu_arm.cpp PROPERTIES COMPILE_FLAGS "-O3")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
list(APPEND SOURCES_CRYPTO
|
||||||
|
src/crypto/cn/gpu/cn_gpu_avx.cpp
|
||||||
|
src/crypto/cn/gpu/cn_gpu_ssse3.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||||
|
set_source_files_properties(src/crypto/cn/gpu/cn_gpu_avx.cpp PROPERTIES COMPILE_FLAGS "-O3 -mavx2")
|
||||||
|
set_source_files_properties(src/crypto/cn/gpu/cn_gpu_ssse3.cpp PROPERTIES COMPILE_FLAGS "-O3")
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES Intel)
|
||||||
|
set_source_files_properties(src/crypto/cn/gpu/cn_gpu_avx.cpp PROPERTIES COMPILE_FLAGS "-O3 -mavx2")
|
||||||
|
set_source_files_properties(src/crypto/cn/gpu/cn_gpu_ssse3.cpp PROPERTIES COMPILE_FLAGS "-O1")
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||||
|
set_source_files_properties(src/crypto/cn/gpu/cn_gpu_avx.cpp PROPERTIES COMPILE_FLAGS "/arch:AVX")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
else()
|
||||||
|
remove_definitions(/DXMRIG_ALGO_CN_GPU)
|
||||||
|
endif()
|
||||||
@@ -40,6 +40,13 @@ if (WITH_RANDOMX)
|
|||||||
src/crypto/rx/RxDataset.cpp
|
src/crypto/rx/RxDataset.cpp
|
||||||
src/crypto/rx/RxQueue.cpp
|
src/crypto/rx/RxQueue.cpp
|
||||||
src/crypto/rx/RxVm.cpp
|
src/crypto/rx/RxVm.cpp
|
||||||
|
|
||||||
|
### Removed useless includes
|
||||||
|
src/crypto/randomx/panthera/sha256.c
|
||||||
|
src/crypto/randomx/panthera/KangarooTwelve.c
|
||||||
|
src/crypto/randomx/panthera/KeccakP-1600-reference.c
|
||||||
|
src/crypto/randomx/panthera/KeccakSpongeWidth1600.c
|
||||||
|
src/crypto/randomx/panthera/yespower-opt.c
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WITH_ASM AND CMAKE_C_COMPILER_ID MATCHES MSVC)
|
if (WITH_ASM AND CMAKE_C_COMPILER_ID MATCHES MSVC)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ Option `coin` useful for pools without [algorithm negotiation](https://xmrig.com
|
|||||||
| `cn/zls` | 2 MB | 2.14.0+ | CryptoNight variant 2 with 3/4 iterations. | |
|
| `cn/zls` | 2 MB | 2.14.0+ | CryptoNight variant 2 with 3/4 iterations. | |
|
||||||
| `cn/double` | 2 MB | 2.14.0+ | CryptoNight variant 2 with double iterations. | |
|
| `cn/double` | 2 MB | 2.14.0+ | CryptoNight variant 2 with double iterations. | |
|
||||||
| `cn/r` | 2 MB | 2.13.0+ | CryptoNightR (Monero's variant 4). | |
|
| `cn/r` | 2 MB | 2.13.0+ | CryptoNightR (Monero's variant 4). | |
|
||||||
|
| `cn/gpu` | 2 MB | 2.11.0+ | CryptoNight-GPU. | |
|
||||||
| `cn-pico` | 256 KB | 2.10.0+ | CryptoNight-Pico. | |
|
| `cn-pico` | 256 KB | 2.10.0+ | CryptoNight-Pico. | |
|
||||||
| `cn/half` | 2 MB | 2.9.0+ | CryptoNight variant 2 with half iterations. | |
|
| `cn/half` | 2 MB | 2.9.0+ | CryptoNight variant 2 with half iterations. | |
|
||||||
| `cn/2` | 2 MB | 2.8.0+ | CryptoNight variant 2. | |
|
| `cn/2` | 2 MB | 2.8.0+ | CryptoNight variant 2. | |
|
||||||
|
|||||||
1
doc/build/CMAKE_OPTIONS.md
vendored
1
doc/build/CMAKE_OPTIONS.md
vendored
@@ -6,6 +6,7 @@
|
|||||||
* **`-DWITH_CN_LITE=OFF`** disable all CryptoNight-Lite algorithms (`cn-lite/0`, `cn-lite/1`).
|
* **`-DWITH_CN_LITE=OFF`** disable all CryptoNight-Lite algorithms (`cn-lite/0`, `cn-lite/1`).
|
||||||
* **`-DWITH_CN_HEAVY=OFF`** disable all CryptoNight-Heavy algorithms (`cn-heavy/0`, `cn-heavy/xhv`, `cn-heavy/tube`).
|
* **`-DWITH_CN_HEAVY=OFF`** disable all CryptoNight-Heavy algorithms (`cn-heavy/0`, `cn-heavy/xhv`, `cn-heavy/tube`).
|
||||||
* **`-DWITH_CN_PICO=OFF`** disable CryptoNight-Pico algorithm (`cn-pico`).
|
* **`-DWITH_CN_PICO=OFF`** disable CryptoNight-Pico algorithm (`cn-pico`).
|
||||||
|
* **`-DWITH_CN_GPU=OFF`** disable CryptoNight-GPU algorithm (`cn/gpu`).
|
||||||
* **`-DWITH_RANDOMX=OFF`** disable RandomX algorithms (`rx/loki`, `rx/wow`).
|
* **`-DWITH_RANDOMX=OFF`** disable RandomX algorithms (`rx/loki`, `rx/wow`).
|
||||||
* **`-DWITH_ARGON2=OFF`** disable Argon2 algorithms (`argon2/chukwa`, `argon2/wrkz`).
|
* **`-DWITH_ARGON2=OFF`** disable Argon2 algorithms (`argon2/chukwa`, `argon2/wrkz`).
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ mkdir -p deps/lib
|
|||||||
|
|
||||||
mkdir -p build && cd build
|
mkdir -p build && cd build
|
||||||
|
|
||||||
wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -O openssl-${OPENSSL_VERSION}.tar.gz
|
wget --no-check-certificate https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -O openssl-${OPENSSL_VERSION}.tar.gz
|
||||||
tar -xzf openssl-${OPENSSL_VERSION}.tar.gz
|
tar -xzf openssl-${OPENSSL_VERSION}.tar.gz
|
||||||
|
|
||||||
cd openssl-${OPENSSL_VERSION}
|
cd openssl-${OPENSSL_VERSION}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ function rx()
|
|||||||
'randomx_constants_monero.h',
|
'randomx_constants_monero.h',
|
||||||
'randomx_constants_wow.h',
|
'randomx_constants_wow.h',
|
||||||
'randomx_constants_arqma.h',
|
'randomx_constants_arqma.h',
|
||||||
|
'randomx_constants_equilibria.h',
|
||||||
'randomx_constants_keva.h',
|
'randomx_constants_keva.h',
|
||||||
'randomx_constants_graft.h',
|
'randomx_constants_graft.h',
|
||||||
'aes.cl',
|
'aes.cl',
|
||||||
@@ -78,10 +79,20 @@ function kawpow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function cn_gpu()
|
||||||
|
{
|
||||||
|
const cn_gpu = opencl_minify(addIncludes('cryptonight_gpu.cl', [ 'wolf-aes.cl', 'keccak.cl' ]));
|
||||||
|
|
||||||
|
// fs.writeFileSync('cryptonight_gpu_gen.cl', cn_gpu);
|
||||||
|
fs.writeFileSync('cryptonight_gpu_cl.h', text2h(cn_gpu, 'xmrig', 'cryptonight_gpu_cl'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
process.chdir(path.resolve('src/backend/opencl/cl/cn'));
|
process.chdir(path.resolve('src/backend/opencl/cl/cn'));
|
||||||
|
|
||||||
cn();
|
cn();
|
||||||
cn_r();
|
cn_r();
|
||||||
|
cn_gpu();
|
||||||
|
|
||||||
process.chdir(cwd);
|
process.chdir(cwd);
|
||||||
process.chdir(path.resolve('src/backend/opencl/cl/rx'));
|
process.chdir(path.resolve('src/backend/opencl/cl/rx'));
|
||||||
|
|||||||
19
src/App.cpp
19
src/App.cpp
@@ -85,6 +85,25 @@ int xmrig::App::exec()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
const std::vector<Pool>& pools = m_controller->config()->pools().data();
|
||||||
|
if (pools.size() != 1 || pools[0].mode() != Pool::MODE_BENCHMARK) {
|
||||||
|
m_controller->pre_start();
|
||||||
|
m_controller->config()->benchmark().set_controller(m_controller);
|
||||||
|
|
||||||
|
if (m_controller->config()->benchmark().isNewBenchRun() || m_controller->config()->isRebenchAlgo()) {
|
||||||
|
if (m_controller->config()->isShouldSave()) {
|
||||||
|
m_controller->config()->save();
|
||||||
|
}
|
||||||
|
if (m_controller->config()->isRebenchAlgo()) {
|
||||||
|
m_controller->config()->benchmark().flush_perf();
|
||||||
|
}
|
||||||
|
m_controller->config()->benchmark().start_perf();
|
||||||
|
} else {
|
||||||
|
m_controller->start();
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
# endif
|
||||||
m_controller->start();
|
m_controller->start();
|
||||||
|
|
||||||
rc = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
rc = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ const char *ocl_tag();
|
|||||||
const char *cuda_tag();
|
const char *cuda_tag();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
const char *bm_tag();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
} // namespace xmrig
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|||||||
@@ -128,6 +128,8 @@ xmrig::String xmrig::Threads<T>::profileName(const Algorithm &algorithm, bool st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (std::is_same<T, CpuThreads>::value && (name == "defyx" || name == "panthera") && has("rx")) return "rx";
|
||||||
|
|
||||||
if (has(kAsterisk)) {
|
if (has(kAsterisk)) {
|
||||||
return kAsterisk;
|
return kAsterisk;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ bool xmrig::CpuBackend::isEnabled() const
|
|||||||
|
|
||||||
bool xmrig::CpuBackend::isEnabled(const Algorithm &algorithm) const
|
bool xmrig::CpuBackend::isEnabled(const Algorithm &algorithm) const
|
||||||
{
|
{
|
||||||
return !d_ptr->controller->config()->cpu().threads().get(algorithm).isEmpty();
|
return algorithm.isValid() && !d_ptr->controller->config()->cpu().threads().get(algorithm).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ size_t inline generate<Algorithm::CN>(Threads<CpuThreads> &threads, uint32_t lim
|
|||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
|
||||||
count += generate(Algorithm::kCN, threads, Algorithm::CN_1, limit);
|
count += generate(Algorithm::kCN, threads, Algorithm::CN_1, limit);
|
||||||
|
count += generate(Algorithm::kCN_2, threads, Algorithm::CN_2, limit);
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
count += generate(Algorithm::kCN_GPU, threads, Algorithm::CN_GPU, limit);
|
||||||
|
# endif
|
||||||
|
|
||||||
if (!threads.isExist(Algorithm::CN_0)) {
|
if (!threads.isExist(Algorithm::CN_0)) {
|
||||||
threads.disable(Algorithm::CN_0);
|
threads.disable(Algorithm::CN_0);
|
||||||
@@ -122,6 +126,17 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<CpuThreads> &threads, uint32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!threads.isExist(Algorithm::RX_XEQ)) {
|
||||||
|
auto xeq = cpuInfo->threads(Algorithm::RX_XEQ, limit);
|
||||||
|
if (xeq == wow) {
|
||||||
|
threads.setAlias(Algorithm::RX_XEQ, Algorithm::kRX_WOW);
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
count += threads.move(Algorithm::kRX_XEQ, std::move(xeq));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!threads.isExist(Algorithm::RX_KEVA)) {
|
if (!threads.isExist(Algorithm::RX_KEVA)) {
|
||||||
auto keva = cpuInfo->threads(Algorithm::RX_KEVA, limit);
|
auto keva = cpuInfo->threads(Algorithm::RX_KEVA, limit);
|
||||||
if (keva == wow) {
|
if (keva == wow) {
|
||||||
@@ -137,6 +152,10 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<CpuThreads> &threads, uint32
|
|||||||
count += threads.move(Algorithm::kRX_WOW, std::move(wow));
|
count += threads.move(Algorithm::kRX_WOW, std::move(wow));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!threads.isExist(Algorithm::RX_XLA)) {
|
||||||
|
count += generate(Algorithm::kRX_XLA, threads, Algorithm::RX_XLA, limit);
|
||||||
|
}
|
||||||
|
|
||||||
count += generate(Algorithm::kRX, threads, Algorithm::RX_0, limit);
|
count += generate(Algorithm::kRX, threads, Algorithm::RX_0, limit);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
@@ -157,7 +176,10 @@ size_t inline generate<Algorithm::ARGON2>(Threads<CpuThreads> &threads, uint32_t
|
|||||||
template<>
|
template<>
|
||||||
size_t inline generate<Algorithm::GHOSTRIDER>(Threads<CpuThreads>& threads, uint32_t limit)
|
size_t inline generate<Algorithm::GHOSTRIDER>(Threads<CpuThreads>& threads, uint32_t limit)
|
||||||
{
|
{
|
||||||
return generate(Algorithm::kGHOSTRIDER, threads, Algorithm::GHOSTRIDER_RTM, limit);
|
size_t count = 0;
|
||||||
|
count += generate(Algorithm::kGHOSTRIDER, threads, Algorithm::GHOSTRIDER_RTM, limit);
|
||||||
|
count += generate(Algorithm::kFLEX, threads, Algorithm::FLEX_KCN, limit);
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "crypto/rx/RxDataset.h"
|
#include "crypto/rx/RxDataset.h"
|
||||||
#include "crypto/rx/RxVm.h"
|
#include "crypto/rx/RxVm.h"
|
||||||
#include "crypto/ghostrider/ghostrider.h"
|
#include "crypto/ghostrider/ghostrider.h"
|
||||||
|
#include "crypto/flex/flex.h"
|
||||||
#include "net/JobResults.h"
|
#include "net/JobResults.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -168,7 +169,13 @@ bool xmrig::CpuWorker<N>::selfTest()
|
|||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
if (m_algorithm.family() == Algorithm::GHOSTRIDER) {
|
if (m_algorithm.family() == Algorithm::GHOSTRIDER) {
|
||||||
return (N == 8) && verify(Algorithm::GHOSTRIDER_RTM, test_output_gr);
|
switch (m_algorithm.id()) {
|
||||||
|
case Algorithm::GHOSTRIDER_RTM:
|
||||||
|
return (N == 8) && verify(Algorithm::GHOSTRIDER_RTM, test_output_gr);
|
||||||
|
case Algorithm::FLEX_KCN:
|
||||||
|
return verify(Algorithm::FLEX_KCN, test_output_flex);
|
||||||
|
default:;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -184,8 +191,18 @@ bool xmrig::CpuWorker<N>::selfTest()
|
|||||||
verify(Algorithm::CN_RWZ, test_output_rwz) &&
|
verify(Algorithm::CN_RWZ, test_output_rwz) &&
|
||||||
verify(Algorithm::CN_ZLS, test_output_zls) &&
|
verify(Algorithm::CN_ZLS, test_output_zls) &&
|
||||||
verify(Algorithm::CN_CCX, test_output_ccx) &&
|
verify(Algorithm::CN_CCX, test_output_ccx) &&
|
||||||
verify(Algorithm::CN_DOUBLE, test_output_double);
|
verify(Algorithm::CN_DOUBLE, test_output_double)
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
&&
|
||||||
|
verify(Algorithm::CN_GPU, test_output_gpu)
|
||||||
|
# endif
|
||||||
|
;
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
if (! (!rc || N > 1)) {
|
||||||
|
return verify(Algorithm::CN_GPU, test_output_gpu);
|
||||||
|
} else
|
||||||
|
# endif
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,12 +308,13 @@ void xmrig::CpuWorker<N>::start()
|
|||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
uint8_t* miner_signature_ptr = m_job.blob() + m_job.nonceOffset() + m_job.nonceSize();
|
uint8_t* miner_signature_ptr = m_job.blob() + m_job.nonceOffset() + m_job.nonceSize();
|
||||||
if (job.algorithm().family() == Algorithm::RANDOM_X) {
|
if (job.algorithm().family() == Algorithm::RANDOM_X) {
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
if (job.hasMinerSignature()) {
|
if (job.hasMinerSignature()) {
|
||||||
job.generateMinerSignature(m_job.blob(), job.size(), miner_signature_ptr);
|
job.generateMinerSignature(m_job.blob(), job.size(), miner_signature_ptr);
|
||||||
}
|
}
|
||||||
randomx_calculate_hash_first(m_vm, tempHash, m_job.blob(), job.size());
|
randomx_calculate_hash_first(m_vm, tempHash, m_job.blob(), job.size(), job.algorithm());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nextRound()) {
|
if (!nextRound()) {
|
||||||
@@ -307,7 +325,7 @@ void xmrig::CpuWorker<N>::start()
|
|||||||
memcpy(miner_signature_saved, miner_signature_ptr, sizeof(miner_signature_saved));
|
memcpy(miner_signature_saved, miner_signature_ptr, sizeof(miner_signature_saved));
|
||||||
job.generateMinerSignature(m_job.blob(), job.size(), miner_signature_ptr);
|
job.generateMinerSignature(m_job.blob(), job.size(), miner_signature_ptr);
|
||||||
}
|
}
|
||||||
randomx_calculate_hash_next(m_vm, tempHash, m_job.blob(), job.size(), m_hash);
|
randomx_calculate_hash_next(m_vm, tempHash, m_job.blob(), job.size(), m_hash, job.algorithm());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
@@ -316,11 +334,20 @@ void xmrig::CpuWorker<N>::start()
|
|||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
case Algorithm::GHOSTRIDER:
|
case Algorithm::GHOSTRIDER:
|
||||||
if (N == 8) {
|
switch (job.algorithm()) {
|
||||||
ghostrider::hash_octa(m_job.blob(), job.size(), m_hash, m_ctx, m_ghHelper);
|
case Algorithm::GHOSTRIDER_RTM:
|
||||||
}
|
if (N == 8) {
|
||||||
else {
|
ghostrider::hash_octa(m_job.blob(), job.size(), m_hash, m_ctx, m_ghHelper);
|
||||||
valid = false;
|
}
|
||||||
|
else {
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Algorithm::FLEX_KCN:
|
||||||
|
flex_hash(reinterpret_cast<const char*>(m_job.blob()), reinterpret_cast<char*>(m_hash), m_ctx);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
valid = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
@@ -387,7 +414,8 @@ template<size_t N>
|
|||||||
bool xmrig::CpuWorker<N>::verify(const Algorithm &algorithm, const uint8_t *referenceValue)
|
bool xmrig::CpuWorker<N>::verify(const Algorithm &algorithm, const uint8_t *referenceValue)
|
||||||
{
|
{
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
if (algorithm == Algorithm::GHOSTRIDER_RTM) {
|
switch (algorithm) {
|
||||||
|
case Algorithm::GHOSTRIDER_RTM: {
|
||||||
uint8_t blob[N * 80] = {};
|
uint8_t blob[N * 80] = {};
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
blob[i * 80 + 0] = static_cast<uint8_t>(i);
|
blob[i * 80 + 0] = static_cast<uint8_t>(i);
|
||||||
@@ -414,6 +442,19 @@ bool xmrig::CpuWorker<N>::verify(const Algorithm &algorithm, const uint8_t *refe
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
case Algorithm::FLEX_KCN: {
|
||||||
|
const uint8_t header[80] = {
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xcc, 0xa6, 0x6a,
|
||||||
|
0x44, 0xf8, 0xbd, 0x55, 0x45, 0xc3, 0x16, 0x4a, 0x3a, 0x76, 0xda, 0x50, 0x39, 0x53, 0x28, 0xc9, 0x07, 0x56, 0x33, 0x77,
|
||||||
|
0x5b, 0xc4, 0xc8, 0x79, 0x8f, 0xd6, 0x77, 0x2b, 0x70, 0x0d, 0x21, 0x5c, 0xf0, 0xff, 0x0f, 0x1e, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
char hash[32] = {};
|
||||||
|
flex_hash(reinterpret_cast<const char*>(header), hash, m_ctx);
|
||||||
|
return memcmp(referenceValue, hash, sizeof hash) == 0;
|
||||||
|
}
|
||||||
|
default:;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|||||||
@@ -318,9 +318,12 @@ const char *xmrig::BasicCpuInfo::backend() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint32_t) const
|
xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint32_t limit) const
|
||||||
{
|
{
|
||||||
const size_t count = std::thread::hardware_concurrency();
|
const uint32_t count = std::thread::hardware_concurrency();
|
||||||
|
const uint32_t count_limit = std::max(static_cast<uint32_t>(count * (limit / 100.0f)), 1U);
|
||||||
|
const uint32_t count_limit2 = std::max(static_cast<uint32_t>(count / 2), count_limit);
|
||||||
|
const uint32_t count_limit4 = std::max(static_cast<uint32_t>(count / 4), count_limit);
|
||||||
|
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -330,13 +333,13 @@ xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint3
|
|||||||
|
|
||||||
# ifdef XMRIG_ALGO_CN_LITE
|
# ifdef XMRIG_ALGO_CN_LITE
|
||||||
if (f == Algorithm::CN_LITE) {
|
if (f == Algorithm::CN_LITE) {
|
||||||
return CpuThreads(count, 1);
|
return CpuThreads(count_limit, 1);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_CN_PICO
|
# ifdef XMRIG_ALGO_CN_PICO
|
||||||
if (f == Algorithm::CN_PICO) {
|
if (f == Algorithm::CN_PICO) {
|
||||||
return CpuThreads(count, 2);
|
return CpuThreads(count_limit, 2);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -348,23 +351,37 @@ xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint3
|
|||||||
|
|
||||||
# ifdef XMRIG_ALGO_CN_HEAVY
|
# ifdef XMRIG_ALGO_CN_HEAVY
|
||||||
if (f == Algorithm::CN_HEAVY) {
|
if (f == Algorithm::CN_HEAVY) {
|
||||||
return CpuThreads(std::max<size_t>(count / 4, 1), 1);
|
return CpuThreads(count_limit4, 1);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
if (algorithm == Algorithm::CN_GPU) {
|
||||||
|
return count_limit;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
if (f == Algorithm::RANDOM_X) {
|
if (f == Algorithm::RANDOM_X) {
|
||||||
if (algorithm == Algorithm::RX_WOW) {
|
if (algorithm == Algorithm::RX_WOW) {
|
||||||
return count;
|
return count_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::max<size_t>(count / 2, 1);
|
if (algorithm == Algorithm::RX_XLA) {
|
||||||
|
CpuThreads threads;
|
||||||
|
for (size_t i = 0; i < count_limit2; ++i) {
|
||||||
|
threads.add(i, 0);
|
||||||
|
}
|
||||||
|
return threads;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count_limit2;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_ARGON2
|
# ifdef XMRIG_ALGO_ARGON2
|
||||||
if (f == Algorithm::ARGON2) {
|
if (f == Algorithm::ARGON2) {
|
||||||
return count;
|
return count_limit;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -374,7 +391,7 @@ xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint3
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
return CpuThreads(std::max<size_t>(count / 2, 1), 1);
|
return CpuThreads(count_limit2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -340,6 +340,12 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
|
|||||||
intensity = 2;
|
intensity = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
if (algorithm == Algorithm::CN_GPU) {
|
||||||
|
cacheHashes = PUs;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
if ((algorithm.family() == Algorithm::RANDOM_X) && L3_exclusive && (PUs > cores.size()) && (PUs < cores.size() * 2)) {
|
if ((algorithm.family() == Algorithm::RANDOM_X) && L3_exclusive && (PUs > cores.size()) && (PUs < cores.size() * 2)) {
|
||||||
// Use all L3+L2 on latest Intel CPUs with P-cores, E-cores and exclusive L3 cache
|
// Use all L3+L2 on latest Intel CPUs with P-cores, E-cores and exclusive L3 cache
|
||||||
@@ -348,6 +354,8 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
|
|||||||
if (extra == 0 && algorithm.l2() > 0) {
|
if (extra == 0 && algorithm.l2() > 0) {
|
||||||
cacheHashes = std::min<size_t>(std::max<size_t>(L2 / algorithm.l2(), cores.size()), cacheHashes);
|
cacheHashes = std::min<size_t>(std::max<size_t>(L2 / algorithm.l2(), cores.size()), cacheHashes);
|
||||||
}
|
}
|
||||||
|
if (algorithm == Algorithm::RX_XLA) cacheHashes = cores.size();
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (limit > 0) {
|
if (limit > 0) {
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ size_t inline generate<Algorithm::CN>(Threads<CudaThreads> &threads, const std::
|
|||||||
|
|
||||||
count += generate(Algorithm::kCN, threads, Algorithm::CN_1, devices);
|
count += generate(Algorithm::kCN, threads, Algorithm::CN_1, devices);
|
||||||
count += generate(Algorithm::kCN_2, threads, Algorithm::CN_2, devices);
|
count += generate(Algorithm::kCN_2, threads, Algorithm::CN_2, devices);
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
count += generate(Algorithm::kCN_GPU, threads, Algorithm::CN_GPU, devices);
|
||||||
|
# endif
|
||||||
|
|
||||||
if (!threads.isExist(Algorithm::CN_0)) {
|
if (!threads.isExist(Algorithm::CN_0)) {
|
||||||
threads.disable(Algorithm::CN_0);
|
threads.disable(Algorithm::CN_0);
|
||||||
@@ -114,6 +117,7 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<CudaThreads> &threads, const
|
|||||||
auto rx = CudaThreads(devices, Algorithm::RX_0);
|
auto rx = CudaThreads(devices, Algorithm::RX_0);
|
||||||
auto wow = CudaThreads(devices, Algorithm::RX_WOW);
|
auto wow = CudaThreads(devices, Algorithm::RX_WOW);
|
||||||
auto arq = CudaThreads(devices, Algorithm::RX_ARQ);
|
auto arq = CudaThreads(devices, Algorithm::RX_ARQ);
|
||||||
|
auto xeq = CudaThreads(devices, Algorithm::RX_XEQ);
|
||||||
auto kva = CudaThreads(devices, Algorithm::RX_KEVA);
|
auto kva = CudaThreads(devices, Algorithm::RX_KEVA);
|
||||||
|
|
||||||
if (!threads.isExist(Algorithm::RX_WOW) && wow != rx) {
|
if (!threads.isExist(Algorithm::RX_WOW) && wow != rx) {
|
||||||
@@ -124,6 +128,10 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<CudaThreads> &threads, const
|
|||||||
count += threads.move(Algorithm::kRX_ARQ, std::move(arq));
|
count += threads.move(Algorithm::kRX_ARQ, std::move(arq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!threads.isExist(Algorithm::RX_XEQ) && xeq != rx) {
|
||||||
|
count += threads.move(Algorithm::kRX_XEQ, std::move(xeq));
|
||||||
|
}
|
||||||
|
|
||||||
if (!threads.isExist(Algorithm::RX_KEVA) && kva != rx) {
|
if (!threads.isExist(Algorithm::RX_KEVA) && kva != rx) {
|
||||||
count += threads.move(Algorithm::kRX_KEVA, std::move(kva));
|
count += threads.move(Algorithm::kRX_KEVA, std::move(kva));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ size_t inline generate<Algorithm::CN>(Threads<OclThreads> &threads, const std::v
|
|||||||
|
|
||||||
count += generate(Algorithm::kCN, threads, Algorithm::CN_1, devices);
|
count += generate(Algorithm::kCN, threads, Algorithm::CN_1, devices);
|
||||||
count += generate(Algorithm::kCN_2, threads, Algorithm::CN_2, devices);
|
count += generate(Algorithm::kCN_2, threads, Algorithm::CN_2, devices);
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
count += generate(Algorithm::kCN_GPU, threads, Algorithm::CN_GPU, devices);
|
||||||
|
# endif
|
||||||
|
|
||||||
if (!threads.isExist(Algorithm::CN_0)) {
|
if (!threads.isExist(Algorithm::CN_0)) {
|
||||||
threads.disable(Algorithm::CN_0);
|
threads.disable(Algorithm::CN_0);
|
||||||
@@ -113,6 +116,7 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<OclThreads> &threads, const
|
|||||||
auto rx = OclThreads(devices, Algorithm::RX_0);
|
auto rx = OclThreads(devices, Algorithm::RX_0);
|
||||||
auto wow = OclThreads(devices, Algorithm::RX_WOW);
|
auto wow = OclThreads(devices, Algorithm::RX_WOW);
|
||||||
auto arq = OclThreads(devices, Algorithm::RX_ARQ);
|
auto arq = OclThreads(devices, Algorithm::RX_ARQ);
|
||||||
|
auto xeq = OclThreads(devices, Algorithm::RX_XEQ);
|
||||||
|
|
||||||
if (!threads.isExist(Algorithm::RX_WOW) && wow != rx) {
|
if (!threads.isExist(Algorithm::RX_WOW) && wow != rx) {
|
||||||
count += threads.move(Algorithm::kRX_WOW, std::move(wow));
|
count += threads.move(Algorithm::kRX_WOW, std::move(wow));
|
||||||
@@ -122,6 +126,10 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<OclThreads> &threads, const
|
|||||||
count += threads.move(Algorithm::kRX_ARQ, std::move(arq));
|
count += threads.move(Algorithm::kRX_ARQ, std::move(arq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!threads.isExist(Algorithm::RX_XEQ) && xeq != rx) {
|
||||||
|
count += threads.move(Algorithm::kRX_XEQ, std::move(xeq));
|
||||||
|
}
|
||||||
|
|
||||||
count += threads.move(Algorithm::kRX, std::move(rx));
|
count += threads.move(Algorithm::kRX, std::move(rx));
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|||||||
@@ -45,6 +45,20 @@ public:
|
|||||||
setIntensity(intensity);
|
setIntensity(intensity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
OclThread(uint32_t index, uint32_t intensity, uint32_t worksize, uint32_t threads, uint32_t unrollFactor) :
|
||||||
|
m_fields(0),
|
||||||
|
m_threads(threads, -1),
|
||||||
|
m_index(index),
|
||||||
|
m_memChunk(0),
|
||||||
|
m_stridedIndex(0),
|
||||||
|
m_unrollFactor(unrollFactor),
|
||||||
|
m_worksize(worksize)
|
||||||
|
{
|
||||||
|
setIntensity(intensity);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
OclThread(uint32_t index, uint32_t intensity, uint32_t worksize, uint32_t threads, bool gcnAsm, bool datasetHost, uint32_t bfactor) :
|
OclThread(uint32_t index, uint32_t intensity, uint32_t worksize, uint32_t threads, bool gcnAsm, bool datasetHost, uint32_t bfactor) :
|
||||||
m_datasetHost(datasetHost),
|
m_datasetHost(datasetHost),
|
||||||
|
|||||||
@@ -30,6 +30,10 @@
|
|||||||
#include "net/JobResults.h"
|
#include "net/JobResults.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
# include "backend/opencl/runners/OclRyoRunner.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef XMRIG_ALGO_RANDOMX
|
#ifdef XMRIG_ALGO_RANDOMX
|
||||||
# include "backend/opencl/runners/OclRxJitRunner.h"
|
# include "backend/opencl/runners/OclRxJitRunner.h"
|
||||||
# include "backend/opencl/runners/OclRxVmRunner.h"
|
# include "backend/opencl/runners/OclRxVmRunner.h"
|
||||||
@@ -93,6 +97,12 @@ xmrig::OclWorker::OclWorker(size_t id, const OclLaunchData &data) :
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
if (m_algorithm == Algorithm::CN_GPU) {
|
||||||
|
m_runner = new OclRyoRunner(id, data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# endif
|
||||||
m_runner = new OclCnRunner(id, data);
|
m_runner = new OclCnRunner(id, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,10 @@
|
|||||||
#include "base/crypto/Algorithm.h"
|
#include "base/crypto/Algorithm.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
# include "backend/opencl/cl/cn/cryptonight_gpu_cl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef XMRIG_ALGO_RANDOMX
|
#ifdef XMRIG_ALGO_RANDOMX
|
||||||
# include "backend/opencl/cl/rx/randomx_cl.h"
|
# include "backend/opencl/cl/rx/randomx_cl.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -40,6 +44,12 @@
|
|||||||
|
|
||||||
const char *xmrig::OclSource::get(const Algorithm &algorithm)
|
const char *xmrig::OclSource::get(const Algorithm &algorithm)
|
||||||
{
|
{
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
if (algorithm == Algorithm::CN_GPU) {
|
||||||
|
return cryptonight_gpu_cl;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
if (algorithm.family() == Algorithm::RANDOM_X) {
|
if (algorithm.family() == Algorithm::RANDOM_X) {
|
||||||
return randomx_cl;
|
return randomx_cl;
|
||||||
|
|||||||
@@ -18,9 +18,11 @@
|
|||||||
#define ALGO_CN_PICO_0 0x63120200
|
#define ALGO_CN_PICO_0 0x63120200
|
||||||
#define ALGO_CN_PICO_TLO 0x63120274
|
#define ALGO_CN_PICO_TLO 0x63120274
|
||||||
#define ALGO_CN_UPX2 0x63110200
|
#define ALGO_CN_UPX2 0x63110200
|
||||||
|
#define ALGO_CN_GPU 0x63150300
|
||||||
#define ALGO_RX_0 0x72151200
|
#define ALGO_RX_0 0x72151200
|
||||||
#define ALGO_RX_WOW 0x72141177
|
#define ALGO_RX_WOW 0x72141177
|
||||||
#define ALGO_RX_ARQMA 0x72121061
|
#define ALGO_RX_ARQ 0x72121061
|
||||||
|
#define ALGO_RX_XEQ 0x72121000
|
||||||
#define ALGO_RX_SFX 0x72151273
|
#define ALGO_RX_SFX 0x72151273
|
||||||
#define ALGO_RX_KEVA 0x7214116b
|
#define ALGO_RX_KEVA 0x7214116b
|
||||||
#define ALGO_RX_GRAFT 0x72151267
|
#define ALGO_RX_GRAFT 0x72151267
|
||||||
@@ -29,6 +31,8 @@
|
|||||||
#define ALGO_AR2_WRKZ 0x61120000
|
#define ALGO_AR2_WRKZ 0x61120000
|
||||||
#define ALGO_KAWPOW_RVN 0x6b0f0000
|
#define ALGO_KAWPOW_RVN 0x6b0f0000
|
||||||
|
|
||||||
|
#define ALGO_RX_XLA 0x721211ff
|
||||||
|
|
||||||
#define FAMILY_UNKNOWN 0
|
#define FAMILY_UNKNOWN 0
|
||||||
#define FAMILY_CN 0x63150000
|
#define FAMILY_CN 0x63150000
|
||||||
#define FAMILY_CN_LITE 0x63140000
|
#define FAMILY_CN_LITE 0x63140000
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
520
src/backend/opencl/cl/cn/cryptonight_gpu.cl
Normal file
520
src/backend/opencl/cl/cn/cryptonight_gpu.cl
Normal file
@@ -0,0 +1,520 @@
|
|||||||
|
#include "wolf-aes.cl"
|
||||||
|
#include "keccak.cl"
|
||||||
|
|
||||||
|
|
||||||
|
inline uint getIdx()
|
||||||
|
{
|
||||||
|
return get_global_id(0) - get_global_offset(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define IDX(x) (x)
|
||||||
|
|
||||||
|
|
||||||
|
inline float4 _mm_add_ps(float4 a, float4 b)
|
||||||
|
{
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline float4 _mm_sub_ps(float4 a, float4 b)
|
||||||
|
{
|
||||||
|
return a - b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline float4 _mm_mul_ps(float4 a, float4 b)
|
||||||
|
{
|
||||||
|
return a * b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline float4 _mm_div_ps(float4 a, float4 b)
|
||||||
|
{
|
||||||
|
return a / b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline float4 _mm_and_ps(float4 a, int b)
|
||||||
|
{
|
||||||
|
return as_float4(as_int4(a) & (int4)(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline float4 _mm_or_ps(float4 a, int b)
|
||||||
|
{
|
||||||
|
return as_float4(as_int4(a) | (int4)(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline float4 _mm_fmod_ps(float4 v, float dc)
|
||||||
|
{
|
||||||
|
float4 d = (float4)(dc);
|
||||||
|
float4 c = _mm_div_ps(v, d);
|
||||||
|
c = trunc(c);
|
||||||
|
c = _mm_mul_ps(c, d);
|
||||||
|
return _mm_sub_ps(v, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int4 _mm_xor_si128(int4 a, int4 b)
|
||||||
|
{
|
||||||
|
return a ^ b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline float4 _mm_xor_ps(float4 a, int b)
|
||||||
|
{
|
||||||
|
return as_float4(as_int4(a) ^ (int4)(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int4 _mm_alignr_epi8(int4 a, const uint rot)
|
||||||
|
{
|
||||||
|
const uint right = 8 * rot;
|
||||||
|
const uint left = (32 - 8 * rot);
|
||||||
|
return (int4)(
|
||||||
|
((uint)a.x >> right) | ( a.y << left ),
|
||||||
|
((uint)a.y >> right) | ( a.z << left ),
|
||||||
|
((uint)a.z >> right) | ( a.w << left ),
|
||||||
|
((uint)a.w >> right) | ( a.x << left )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline global int4* scratchpad_ptr(uint idx, uint n, __global int *lpad) { return (__global int4*)((__global char*)lpad + (idx & MASK) + n * 16); }
|
||||||
|
|
||||||
|
|
||||||
|
inline float4 fma_break(float4 x)
|
||||||
|
{
|
||||||
|
// Break the dependency chain by setting the exp to ?????01
|
||||||
|
x = _mm_and_ps(x, 0xFEFFFFFF);
|
||||||
|
return _mm_or_ps(x, 0x00800000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void sub_round(float4 n0, float4 n1, float4 n2, float4 n3, float4 rnd_c, float4* n, float4* d, float4* c)
|
||||||
|
{
|
||||||
|
n1 = _mm_add_ps(n1, *c);
|
||||||
|
float4 nn = _mm_mul_ps(n0, *c);
|
||||||
|
nn = _mm_mul_ps(n1, _mm_mul_ps(nn,nn));
|
||||||
|
nn = fma_break(nn);
|
||||||
|
*n = _mm_add_ps(*n, nn);
|
||||||
|
|
||||||
|
n3 = _mm_sub_ps(n3, *c);
|
||||||
|
float4 dd = _mm_mul_ps(n2, *c);
|
||||||
|
dd = _mm_mul_ps(n3, _mm_mul_ps(dd,dd));
|
||||||
|
dd = fma_break(dd);
|
||||||
|
*d = _mm_add_ps(*d, dd);
|
||||||
|
|
||||||
|
//Constant feedback
|
||||||
|
*c = _mm_add_ps(*c, rnd_c);
|
||||||
|
*c = _mm_add_ps(*c, (float4)(0.734375f));
|
||||||
|
float4 r = _mm_add_ps(nn, dd);
|
||||||
|
r = _mm_and_ps(r, 0x807FFFFF);
|
||||||
|
r = _mm_or_ps(r, 0x40000000);
|
||||||
|
*c = _mm_add_ps(*c, r);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 9*8 + 2 = 74
|
||||||
|
inline void round_compute(float4 n0, float4 n1, float4 n2, float4 n3, float4 rnd_c, float4* c, float4* r)
|
||||||
|
{
|
||||||
|
float4 n = (float4)(0.0f);
|
||||||
|
float4 d = (float4)(0.0f);
|
||||||
|
|
||||||
|
sub_round(n0, n1, n2, n3, rnd_c, &n, &d, c);
|
||||||
|
sub_round(n1, n2, n3, n0, rnd_c, &n, &d, c);
|
||||||
|
sub_round(n2, n3, n0, n1, rnd_c, &n, &d, c);
|
||||||
|
sub_round(n3, n0, n1, n2, rnd_c, &n, &d, c);
|
||||||
|
sub_round(n3, n2, n1, n0, rnd_c, &n, &d, c);
|
||||||
|
sub_round(n2, n1, n0, n3, rnd_c, &n, &d, c);
|
||||||
|
sub_round(n1, n0, n3, n2, rnd_c, &n, &d, c);
|
||||||
|
sub_round(n0, n3, n2, n1, rnd_c, &n, &d, c);
|
||||||
|
|
||||||
|
// Make sure abs(d) > 2.0 - this prevents division by zero and accidental overflows by division by < 1.0
|
||||||
|
d = _mm_and_ps(d, 0xFF7FFFFF);
|
||||||
|
d = _mm_or_ps(d, 0x40000000);
|
||||||
|
*r =_mm_add_ps(*r, _mm_div_ps(n,d));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int4 single_compute(float4 n0, float4 n1, float4 n2, float4 n3, float cnt, float4 rnd_c, __local float4* sum)
|
||||||
|
{
|
||||||
|
float4 c= (float4)(cnt);
|
||||||
|
// 35 maths calls follow (140 FLOPS)
|
||||||
|
float4 r = (float4)(0.0f);
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, &c, &r);
|
||||||
|
}
|
||||||
|
|
||||||
|
// do a quick fmod by setting exp to 2
|
||||||
|
r = _mm_and_ps(r, 0x807FFFFF);
|
||||||
|
r = _mm_or_ps(r, 0x40000000);
|
||||||
|
*sum = r; // 34
|
||||||
|
float4 x = (float4)(536870880.0f);
|
||||||
|
r = _mm_mul_ps(r, x); // 35
|
||||||
|
return convert_int4_rte(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void single_compute_wrap(const uint rot, int4 v0, int4 v1, int4 v2, int4 v3, float cnt, float4 rnd_c, __local float4* sum, __local int4* out)
|
||||||
|
{
|
||||||
|
float4 n0 = convert_float4_rte(v0);
|
||||||
|
float4 n1 = convert_float4_rte(v1);
|
||||||
|
float4 n2 = convert_float4_rte(v2);
|
||||||
|
float4 n3 = convert_float4_rte(v3);
|
||||||
|
|
||||||
|
int4 r = single_compute(n0, n1, n2, n3, cnt, rnd_c, sum);
|
||||||
|
*out = rot == 0 ? r : _mm_alignr_epi8(r, rot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const __constant uint look[16][4] = {
|
||||||
|
{0, 1, 2, 3},
|
||||||
|
{0, 2, 3, 1},
|
||||||
|
{0, 3, 1, 2},
|
||||||
|
{0, 3, 2, 1},
|
||||||
|
|
||||||
|
{1, 0, 2, 3},
|
||||||
|
{1, 2, 3, 0},
|
||||||
|
{1, 3, 0, 2},
|
||||||
|
{1, 3, 2, 0},
|
||||||
|
|
||||||
|
{2, 1, 0, 3},
|
||||||
|
{2, 0, 3, 1},
|
||||||
|
{2, 3, 1, 0},
|
||||||
|
{2, 3, 0, 1},
|
||||||
|
|
||||||
|
{3, 1, 2, 0},
|
||||||
|
{3, 2, 0, 1},
|
||||||
|
{3, 0, 1, 2},
|
||||||
|
{3, 0, 2, 1}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const __constant float ccnt[16] = {
|
||||||
|
1.34375f,
|
||||||
|
1.28125f,
|
||||||
|
1.359375f,
|
||||||
|
1.3671875f,
|
||||||
|
|
||||||
|
1.4296875f,
|
||||||
|
1.3984375f,
|
||||||
|
1.3828125f,
|
||||||
|
1.3046875f,
|
||||||
|
|
||||||
|
1.4140625f,
|
||||||
|
1.2734375f,
|
||||||
|
1.2578125f,
|
||||||
|
1.2890625f,
|
||||||
|
|
||||||
|
1.3203125f,
|
||||||
|
1.3515625f,
|
||||||
|
1.3359375f,
|
||||||
|
1.4609375f
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct SharedMemChunk
|
||||||
|
{
|
||||||
|
int4 out[16];
|
||||||
|
float4 va[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
__attribute__((reqd_work_group_size(WORKSIZE * 16, 1, 1)))
|
||||||
|
__kernel void cn1(__global int *lpad_in, __global int *spad, uint numThreads)
|
||||||
|
{
|
||||||
|
const uint gIdx = getIdx();
|
||||||
|
uint chunk = get_local_id(0) / 16;
|
||||||
|
|
||||||
|
__global int* lpad = (__global int*)((__global char*)lpad_in + MEMORY * (gIdx/16));
|
||||||
|
|
||||||
|
__local struct SharedMemChunk smem_in[WORKSIZE];
|
||||||
|
__local struct SharedMemChunk* smem = smem_in + chunk;
|
||||||
|
|
||||||
|
uint tid = get_local_id(0) % 16;
|
||||||
|
|
||||||
|
uint idxHash = gIdx/16;
|
||||||
|
uint s = ((__global uint*)spad)[idxHash * 50] >> 8;
|
||||||
|
float4 vs = (float4)(0);
|
||||||
|
|
||||||
|
// tid divided
|
||||||
|
const uint tidd = tid / 4;
|
||||||
|
// tid modulo
|
||||||
|
const uint tidm = tid % 4;
|
||||||
|
const uint block = tidd * 16 + tidm;
|
||||||
|
|
||||||
|
#pragma unroll CN_UNROLL
|
||||||
|
for (uint i = 0; i < ITERATIONS; i++) {
|
||||||
|
mem_fence(CLK_LOCAL_MEM_FENCE);
|
||||||
|
int tmp = ((__global int*)scratchpad_ptr(s, tidd, lpad))[tidm];
|
||||||
|
((__local int*)(smem->out))[tid] = tmp;
|
||||||
|
mem_fence(CLK_LOCAL_MEM_FENCE);
|
||||||
|
|
||||||
|
{
|
||||||
|
single_compute_wrap(
|
||||||
|
tidm,
|
||||||
|
*(smem->out + look[tid][0]),
|
||||||
|
*(smem->out + look[tid][1]),
|
||||||
|
*(smem->out + look[tid][2]),
|
||||||
|
*(smem->out + look[tid][3]),
|
||||||
|
ccnt[tid], vs, smem->va + tid,
|
||||||
|
smem->out + tid
|
||||||
|
);
|
||||||
|
}
|
||||||
|
mem_fence(CLK_LOCAL_MEM_FENCE);
|
||||||
|
|
||||||
|
int outXor = ((__local int*)smem->out)[block];
|
||||||
|
for (uint dd = block + 4; dd < (tidd + 1) * 16; dd += 4) {
|
||||||
|
outXor ^= ((__local int*)smem->out)[dd];
|
||||||
|
}
|
||||||
|
|
||||||
|
((__global int*)scratchpad_ptr(s, tidd, lpad))[tidm] = outXor ^ tmp;
|
||||||
|
((__local int*)smem->out)[tid] = outXor;
|
||||||
|
|
||||||
|
float va_tmp1 = ((__local float*)smem->va)[block] + ((__local float*)smem->va)[block + 4];
|
||||||
|
float va_tmp2 = ((__local float*)smem->va)[block+ 8] + ((__local float*)smem->va)[block + 12];
|
||||||
|
((__local float*)smem->va)[tid] = va_tmp1 + va_tmp2;
|
||||||
|
|
||||||
|
mem_fence(CLK_LOCAL_MEM_FENCE);
|
||||||
|
|
||||||
|
int out2 = ((__local int*)smem->out)[tid] ^ ((__local int*)smem->out)[tid + 4 ] ^ ((__local int*)smem->out)[tid + 8] ^ ((__local int*)smem->out)[tid + 12];
|
||||||
|
va_tmp1 = ((__local float*)smem->va)[block] + ((__local float*)smem->va)[block + 4];
|
||||||
|
va_tmp2 = ((__local float*)smem->va)[block + 8] + ((__local float*)smem->va)[block + 12];
|
||||||
|
va_tmp1 = va_tmp1 + va_tmp2;
|
||||||
|
va_tmp1 = fabs(va_tmp1);
|
||||||
|
|
||||||
|
float xx = va_tmp1 * 16777216.0f;
|
||||||
|
int xx_int = (int)xx;
|
||||||
|
((__local int*)smem->out)[tid] = out2 ^ xx_int;
|
||||||
|
((__local float*)smem->va)[tid] = va_tmp1 / 64.0f;
|
||||||
|
|
||||||
|
mem_fence(CLK_LOCAL_MEM_FENCE);
|
||||||
|
|
||||||
|
vs = smem->va[0];
|
||||||
|
s = smem->out[0].x ^ smem->out[0].y ^ smem->out[0].z ^ smem->out[0].w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const __constant uint skip[3] = {
|
||||||
|
20,22,22
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline void generate_512(uint idx, __local ulong* in, __global ulong* out)
|
||||||
|
{
|
||||||
|
ulong hash[25];
|
||||||
|
|
||||||
|
hash[0] = in[0] ^ idx;
|
||||||
|
for (int i = 1; i < 25; ++i) {
|
||||||
|
hash[i] = in[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int a = 0; a < 3; ++a) {
|
||||||
|
keccakf1600_1(hash);
|
||||||
|
for (int i = 0; i < skip[a]; ++i) {
|
||||||
|
out[i] = hash[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
out += skip[a];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__attribute__((reqd_work_group_size(8, 8, 1)))
|
||||||
|
__kernel void cn0(__global ulong *input, int inlen, __global int *Scratchpad, __global ulong *states, uint Threads)
|
||||||
|
{
|
||||||
|
const uint gIdx = getIdx();
|
||||||
|
__local ulong State_buf[8 * 25];
|
||||||
|
__local ulong* State = State_buf + get_local_id(0) * 25;
|
||||||
|
|
||||||
|
{
|
||||||
|
states += 25 * gIdx;
|
||||||
|
|
||||||
|
Scratchpad = (__global int*)((__global char*)Scratchpad + MEMORY * gIdx);
|
||||||
|
|
||||||
|
if (get_local_id(1) == 0) {
|
||||||
|
|
||||||
|
# ifdef __NV_CL_C_VERSION
|
||||||
|
for(uint i = 0; i < 8; ++i)
|
||||||
|
State[i] = input[i];
|
||||||
|
# else
|
||||||
|
((__local ulong8 *)State)[0] = vload8(0, input);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
State[8] = input[8];
|
||||||
|
State[9] = input[9];
|
||||||
|
State[10] = input[10];
|
||||||
|
|
||||||
|
((__local uint *)State)[9] &= 0x00FFFFFFU;
|
||||||
|
((__local uint *)State)[9] |= (((uint)get_global_id(0)) & 0xFF) << 24;
|
||||||
|
((__local uint *)State)[10] &= 0xFF000000U;
|
||||||
|
/* explicit cast to `uint` is required because some OpenCL implementations (e.g. NVIDIA)
|
||||||
|
* handle get_global_id and get_global_offset as signed long long int and add
|
||||||
|
* 0xFFFFFFFF... to `get_global_id` if we set on host side a 32bit offset where the first bit is `1`
|
||||||
|
* (even if it is correct casted to unsigned on the host)
|
||||||
|
*/
|
||||||
|
((__local uint *)State)[10] |= (((uint)get_global_id(0) >> 8));
|
||||||
|
|
||||||
|
for (int i = 11; i < 25; ++i) {
|
||||||
|
State[i] = 0x00UL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Last bit of padding
|
||||||
|
State[16] = 0x8000000000000000UL;
|
||||||
|
|
||||||
|
keccakf1600_2(State);
|
||||||
|
|
||||||
|
#pragma unroll
|
||||||
|
for (int i = 0; i < 25; ++i) {
|
||||||
|
states[i] = State[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__attribute__((reqd_work_group_size(64, 1, 1)))
|
||||||
|
__kernel void cn00(__global int *Scratchpad, __global ulong *states)
|
||||||
|
{
|
||||||
|
const uint gIdx = getIdx() / 64;
|
||||||
|
__local ulong State[25];
|
||||||
|
|
||||||
|
states += 25 * gIdx;
|
||||||
|
|
||||||
|
Scratchpad = (__global int*)((__global char*)Scratchpad + MEMORY * gIdx);
|
||||||
|
|
||||||
|
for (int i = get_local_id(0); i < 25; i += get_local_size(0)) {
|
||||||
|
State[i] = states[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
barrier(CLK_LOCAL_MEM_FENCE);
|
||||||
|
|
||||||
|
for (uint i = get_local_id(0); i < MEMORY / 512; i += get_local_size(0)) {
|
||||||
|
generate_512(i, State, (__global ulong*)((__global uchar*)Scratchpad + i * 512));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__attribute__((reqd_work_group_size(8, 8, 1)))
|
||||||
|
__kernel void cn2(__global uint4 *Scratchpad, __global ulong *states, __global uint *output, ulong Target, uint Threads)
|
||||||
|
{
|
||||||
|
__local uint AES0[256], AES1[256], AES2[256], AES3[256];
|
||||||
|
uint ExpandedKey2[40];
|
||||||
|
uint4 text;
|
||||||
|
|
||||||
|
const uint gIdx = getIdx();
|
||||||
|
|
||||||
|
for (int i = get_local_id(1) * 8 + get_local_id(0); i < 256; i += 8 * 8) {
|
||||||
|
const uint tmp = AES0_C[i];
|
||||||
|
AES0[i] = tmp;
|
||||||
|
AES1[i] = rotate(tmp, 8U);
|
||||||
|
AES2[i] = rotate(tmp, 16U);
|
||||||
|
AES3[i] = rotate(tmp, 24U);
|
||||||
|
}
|
||||||
|
|
||||||
|
barrier(CLK_LOCAL_MEM_FENCE);
|
||||||
|
|
||||||
|
__local uint4 xin1[8][8];
|
||||||
|
__local uint4 xin2[8][8];
|
||||||
|
|
||||||
|
{
|
||||||
|
states += 25 * gIdx;
|
||||||
|
Scratchpad += gIdx * (MEMORY >> 4);
|
||||||
|
|
||||||
|
#if defined(__Tahiti__) || defined(__Pitcairn__)
|
||||||
|
for(int i = 0; i < 4; ++i) ((ulong *)ExpandedKey2)[i] = states[i + 4];
|
||||||
|
text = vload4(get_local_id(1) + 4, (__global uint *)states);
|
||||||
|
#else
|
||||||
|
text = vload4(get_local_id(1) + 4, (__global uint *)states);
|
||||||
|
((uint8 *)ExpandedKey2)[0] = vload8(1, (__global uint *)states);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
AESExpandKey256(ExpandedKey2);
|
||||||
|
}
|
||||||
|
|
||||||
|
barrier(CLK_LOCAL_MEM_FENCE);
|
||||||
|
|
||||||
|
__local uint4* xin1_store = &xin1[get_local_id(1)][get_local_id(0)];
|
||||||
|
__local uint4* xin1_load = &xin1[(get_local_id(1) + 1) % 8][get_local_id(0)];
|
||||||
|
__local uint4* xin2_store = &xin2[get_local_id(1)][get_local_id(0)];
|
||||||
|
__local uint4* xin2_load = &xin2[(get_local_id(1) + 1) % 8][get_local_id(0)];
|
||||||
|
*xin2_store = (uint4)(0, 0, 0, 0);
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
#pragma unroll 2
|
||||||
|
for (int i = 0, i1 = get_local_id(1); i < (MEMORY >> 7); ++i, i1 = (i1 + 16) % (MEMORY >> 4)) {
|
||||||
|
text ^= Scratchpad[(uint)i1];
|
||||||
|
barrier(CLK_LOCAL_MEM_FENCE);
|
||||||
|
text ^= *xin2_load;
|
||||||
|
|
||||||
|
#pragma unroll 10
|
||||||
|
for(int j = 0; j < 10; ++j)
|
||||||
|
text = AES_Round(AES0, AES1, AES2, AES3, text, ((uint4 *)ExpandedKey2)[j]);
|
||||||
|
|
||||||
|
*xin1_store = text;
|
||||||
|
|
||||||
|
text ^= Scratchpad[(uint)i1 + 8u];
|
||||||
|
barrier(CLK_LOCAL_MEM_FENCE);
|
||||||
|
text ^= *xin1_load;
|
||||||
|
|
||||||
|
#pragma unroll 10
|
||||||
|
for(int j = 0; j < 10; ++j)
|
||||||
|
text = AES_Round(AES0, AES1, AES2, AES3, text, ((uint4 *)ExpandedKey2)[j]);
|
||||||
|
|
||||||
|
*xin2_store = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
barrier(CLK_LOCAL_MEM_FENCE);
|
||||||
|
text ^= *xin2_load;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Also left over threads performe this loop.
|
||||||
|
* The left over thread results will be ignored
|
||||||
|
*/
|
||||||
|
#pragma unroll 16
|
||||||
|
for(size_t i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
#pragma unroll 10
|
||||||
|
for (int j = 0; j < 10; ++j) {
|
||||||
|
text = AES_Round(AES0, AES1, AES2, AES3, text, ((uint4 *)ExpandedKey2)[j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
barrier(CLK_LOCAL_MEM_FENCE);
|
||||||
|
*xin1_store = text;
|
||||||
|
barrier(CLK_LOCAL_MEM_FENCE);
|
||||||
|
text ^= *xin1_load;
|
||||||
|
}
|
||||||
|
|
||||||
|
__local ulong State_buf[8 * 25];
|
||||||
|
{
|
||||||
|
vstore2(as_ulong2(text), get_local_id(1) + 4, states);
|
||||||
|
}
|
||||||
|
|
||||||
|
barrier(CLK_GLOBAL_MEM_FENCE);
|
||||||
|
|
||||||
|
{
|
||||||
|
if(!get_local_id(1))
|
||||||
|
{
|
||||||
|
__local ulong* State = State_buf + get_local_id(0) * 25;
|
||||||
|
|
||||||
|
for(int i = 0; i < 25; ++i) State[i] = states[i];
|
||||||
|
|
||||||
|
keccakf1600_2(State);
|
||||||
|
|
||||||
|
if(State[3] <= Target)
|
||||||
|
{
|
||||||
|
ulong outIdx = atomic_inc(output + 0xFF);
|
||||||
|
if(outIdx < 0xFF)
|
||||||
|
output[outIdx] = get_global_id(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mem_fence(CLK_GLOBAL_MEM_FENCE);
|
||||||
|
}
|
||||||
639
src/backend/opencl/cl/cn/cryptonight_gpu_cl.h
Normal file
639
src/backend/opencl/cl/cn/cryptonight_gpu_cl.h
Normal file
@@ -0,0 +1,639 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
static const char cryptonight_gpu_cl[20170] = {
|
||||||
|
0x23,0x69,0x66,0x6e,0x64,0x65,0x66,0x20,0x57,0x4f,0x4c,0x46,0x5f,0x41,0x45,0x53,0x5f,0x43,0x4c,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x57,0x4f,0x4c,0x46,
|
||||||
|
0x5f,0x41,0x45,0x53,0x5f,0x43,0x4c,0x0a,0x23,0x69,0x66,0x64,0x65,0x66,0x20,0x53,0x54,0x41,0x54,0x49,0x43,0x0a,0x23,0x75,0x6e,0x64,0x65,0x66,0x20,0x53,0x54,0x41,
|
||||||
|
0x54,0x49,0x43,0x0a,0x23,0x65,0x6e,0x64,0x69,0x66,0x0a,0x23,0x69,0x66,0x64,0x65,0x66,0x20,0x63,0x6c,0x5f,0x61,0x6d,0x64,0x5f,0x6d,0x65,0x64,0x69,0x61,0x5f,0x6f,
|
||||||
|
0x70,0x73,0x32,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x53,0x54,0x41,0x54,0x49,0x43,0x20,0x73,0x74,0x61,0x74,0x69,0x63,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,
|
||||||
|
0x61,0x20,0x4f,0x50,0x45,0x4e,0x43,0x4c,0x20,0x45,0x58,0x54,0x45,0x4e,0x53,0x49,0x4f,0x4e,0x20,0x63,0x6c,0x5f,0x61,0x6d,0x64,0x5f,0x6d,0x65,0x64,0x69,0x61,0x5f,
|
||||||
|
0x6f,0x70,0x73,0x32,0x20,0x3a,0x20,0x65,0x6e,0x61,0x62,0x6c,0x65,0x0a,0x23,0x65,0x6c,0x73,0x65,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x53,0x54,0x41,0x54,
|
||||||
|
0x49,0x43,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x69,0x6e,0x74,0x20,0x61,0x6d,0x64,0x5f,0x62,0x66,0x65,0x28,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,
|
||||||
|
0x20,0x73,0x72,0x63,0x30,0x2c,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x2c,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,
|
||||||
|
0x6e,0x74,0x20,0x77,0x69,0x64,0x74,0x68,0x29,0x0a,0x7b,0x0a,0x69,0x66,0x28,0x28,0x6f,0x66,0x66,0x73,0x65,0x74,0x2b,0x77,0x69,0x64,0x74,0x68,0x29,0x3c,0x33,0x32,
|
||||||
|
0x75,0x29,0x20,0x7b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x73,0x72,0x63,0x30,0x3c,0x3c,0x28,0x33,0x32,0x75,0x2d,0x6f,0x66,0x66,0x73,0x65,0x74,0x2d,0x77,
|
||||||
|
0x69,0x64,0x74,0x68,0x29,0x29,0x3e,0x3e,0x28,0x33,0x32,0x75,0x2d,0x77,0x69,0x64,0x74,0x68,0x29,0x3b,0x0a,0x7d,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x72,
|
||||||
|
0x63,0x30,0x3e,0x3e,0x6f,0x66,0x66,0x73,0x65,0x74,0x3b,0x0a,0x7d,0x0a,0x23,0x65,0x6e,0x64,0x69,0x66,0x0a,0x53,0x54,0x41,0x54,0x49,0x43,0x20,0x63,0x6f,0x6e,0x73,
|
||||||
|
0x74,0x20,0x5f,0x5f,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x41,0x45,0x53,0x30,0x5f,0x43,0x5b,0x32,0x35,0x36,0x5d,0x20,0x3d,0x0a,
|
||||||
|
0x7b,0x0a,0x30,0x78,0x41,0x35,0x36,0x33,0x36,0x33,0x43,0x36,0x55,0x2c,0x30,0x78,0x38,0x34,0x37,0x43,0x37,0x43,0x46,0x38,0x55,0x2c,0x30,0x78,0x39,0x39,0x37,0x37,
|
||||||
|
0x37,0x37,0x45,0x45,0x55,0x2c,0x30,0x78,0x38,0x44,0x37,0x42,0x37,0x42,0x46,0x36,0x55,0x2c,0x0a,0x30,0x78,0x30,0x44,0x46,0x32,0x46,0x32,0x46,0x46,0x55,0x2c,0x30,
|
||||||
|
0x78,0x42,0x44,0x36,0x42,0x36,0x42,0x44,0x36,0x55,0x2c,0x30,0x78,0x42,0x31,0x36,0x46,0x36,0x46,0x44,0x45,0x55,0x2c,0x30,0x78,0x35,0x34,0x43,0x35,0x43,0x35,0x39,
|
||||||
|
0x31,0x55,0x2c,0x0a,0x30,0x78,0x35,0x30,0x33,0x30,0x33,0x30,0x36,0x30,0x55,0x2c,0x30,0x78,0x30,0x33,0x30,0x31,0x30,0x31,0x30,0x32,0x55,0x2c,0x30,0x78,0x41,0x39,
|
||||||
|
0x36,0x37,0x36,0x37,0x43,0x45,0x55,0x2c,0x30,0x78,0x37,0x44,0x32,0x42,0x32,0x42,0x35,0x36,0x55,0x2c,0x0a,0x30,0x78,0x31,0x39,0x46,0x45,0x46,0x45,0x45,0x37,0x55,
|
||||||
|
0x2c,0x30,0x78,0x36,0x32,0x44,0x37,0x44,0x37,0x42,0x35,0x55,0x2c,0x30,0x78,0x45,0x36,0x41,0x42,0x41,0x42,0x34,0x44,0x55,0x2c,0x30,0x78,0x39,0x41,0x37,0x36,0x37,
|
||||||
|
0x36,0x45,0x43,0x55,0x2c,0x0a,0x30,0x78,0x34,0x35,0x43,0x41,0x43,0x41,0x38,0x46,0x55,0x2c,0x30,0x78,0x39,0x44,0x38,0x32,0x38,0x32,0x31,0x46,0x55,0x2c,0x30,0x78,
|
||||||
|
0x34,0x30,0x43,0x39,0x43,0x39,0x38,0x39,0x55,0x2c,0x30,0x78,0x38,0x37,0x37,0x44,0x37,0x44,0x46,0x41,0x55,0x2c,0x0a,0x30,0x78,0x31,0x35,0x46,0x41,0x46,0x41,0x45,
|
||||||
|
0x46,0x55,0x2c,0x30,0x78,0x45,0x42,0x35,0x39,0x35,0x39,0x42,0x32,0x55,0x2c,0x30,0x78,0x43,0x39,0x34,0x37,0x34,0x37,0x38,0x45,0x55,0x2c,0x30,0x78,0x30,0x42,0x46,
|
||||||
|
0x30,0x46,0x30,0x46,0x42,0x55,0x2c,0x0a,0x30,0x78,0x45,0x43,0x41,0x44,0x41,0x44,0x34,0x31,0x55,0x2c,0x30,0x78,0x36,0x37,0x44,0x34,0x44,0x34,0x42,0x33,0x55,0x2c,
|
||||||
|
0x30,0x78,0x46,0x44,0x41,0x32,0x41,0x32,0x35,0x46,0x55,0x2c,0x30,0x78,0x45,0x41,0x41,0x46,0x41,0x46,0x34,0x35,0x55,0x2c,0x0a,0x30,0x78,0x42,0x46,0x39,0x43,0x39,
|
||||||
|
0x43,0x32,0x33,0x55,0x2c,0x30,0x78,0x46,0x37,0x41,0x34,0x41,0x34,0x35,0x33,0x55,0x2c,0x30,0x78,0x39,0x36,0x37,0x32,0x37,0x32,0x45,0x34,0x55,0x2c,0x30,0x78,0x35,
|
||||||
|
0x42,0x43,0x30,0x43,0x30,0x39,0x42,0x55,0x2c,0x0a,0x30,0x78,0x43,0x32,0x42,0x37,0x42,0x37,0x37,0x35,0x55,0x2c,0x30,0x78,0x31,0x43,0x46,0x44,0x46,0x44,0x45,0x31,
|
||||||
|
0x55,0x2c,0x30,0x78,0x41,0x45,0x39,0x33,0x39,0x33,0x33,0x44,0x55,0x2c,0x30,0x78,0x36,0x41,0x32,0x36,0x32,0x36,0x34,0x43,0x55,0x2c,0x0a,0x30,0x78,0x35,0x41,0x33,
|
||||||
|
0x36,0x33,0x36,0x36,0x43,0x55,0x2c,0x30,0x78,0x34,0x31,0x33,0x46,0x33,0x46,0x37,0x45,0x55,0x2c,0x30,0x78,0x30,0x32,0x46,0x37,0x46,0x37,0x46,0x35,0x55,0x2c,0x30,
|
||||||
|
0x78,0x34,0x46,0x43,0x43,0x43,0x43,0x38,0x33,0x55,0x2c,0x0a,0x30,0x78,0x35,0x43,0x33,0x34,0x33,0x34,0x36,0x38,0x55,0x2c,0x30,0x78,0x46,0x34,0x41,0x35,0x41,0x35,
|
||||||
|
0x35,0x31,0x55,0x2c,0x30,0x78,0x33,0x34,0x45,0x35,0x45,0x35,0x44,0x31,0x55,0x2c,0x30,0x78,0x30,0x38,0x46,0x31,0x46,0x31,0x46,0x39,0x55,0x2c,0x0a,0x30,0x78,0x39,
|
||||||
|
0x33,0x37,0x31,0x37,0x31,0x45,0x32,0x55,0x2c,0x30,0x78,0x37,0x33,0x44,0x38,0x44,0x38,0x41,0x42,0x55,0x2c,0x30,0x78,0x35,0x33,0x33,0x31,0x33,0x31,0x36,0x32,0x55,
|
||||||
|
0x2c,0x30,0x78,0x33,0x46,0x31,0x35,0x31,0x35,0x32,0x41,0x55,0x2c,0x0a,0x30,0x78,0x30,0x43,0x30,0x34,0x30,0x34,0x30,0x38,0x55,0x2c,0x30,0x78,0x35,0x32,0x43,0x37,
|
||||||
|
0x43,0x37,0x39,0x35,0x55,0x2c,0x30,0x78,0x36,0x35,0x32,0x33,0x32,0x33,0x34,0x36,0x55,0x2c,0x30,0x78,0x35,0x45,0x43,0x33,0x43,0x33,0x39,0x44,0x55,0x2c,0x0a,0x30,
|
||||||
|
0x78,0x32,0x38,0x31,0x38,0x31,0x38,0x33,0x30,0x55,0x2c,0x30,0x78,0x41,0x31,0x39,0x36,0x39,0x36,0x33,0x37,0x55,0x2c,0x30,0x78,0x30,0x46,0x30,0x35,0x30,0x35,0x30,
|
||||||
|
0x41,0x55,0x2c,0x30,0x78,0x42,0x35,0x39,0x41,0x39,0x41,0x32,0x46,0x55,0x2c,0x0a,0x30,0x78,0x30,0x39,0x30,0x37,0x30,0x37,0x30,0x45,0x55,0x2c,0x30,0x78,0x33,0x36,
|
||||||
|
0x31,0x32,0x31,0x32,0x32,0x34,0x55,0x2c,0x30,0x78,0x39,0x42,0x38,0x30,0x38,0x30,0x31,0x42,0x55,0x2c,0x30,0x78,0x33,0x44,0x45,0x32,0x45,0x32,0x44,0x46,0x55,0x2c,
|
||||||
|
0x0a,0x30,0x78,0x32,0x36,0x45,0x42,0x45,0x42,0x43,0x44,0x55,0x2c,0x30,0x78,0x36,0x39,0x32,0x37,0x32,0x37,0x34,0x45,0x55,0x2c,0x30,0x78,0x43,0x44,0x42,0x32,0x42,
|
||||||
|
0x32,0x37,0x46,0x55,0x2c,0x30,0x78,0x39,0x46,0x37,0x35,0x37,0x35,0x45,0x41,0x55,0x2c,0x0a,0x30,0x78,0x31,0x42,0x30,0x39,0x30,0x39,0x31,0x32,0x55,0x2c,0x30,0x78,
|
||||||
|
0x39,0x45,0x38,0x33,0x38,0x33,0x31,0x44,0x55,0x2c,0x30,0x78,0x37,0x34,0x32,0x43,0x32,0x43,0x35,0x38,0x55,0x2c,0x30,0x78,0x32,0x45,0x31,0x41,0x31,0x41,0x33,0x34,
|
||||||
|
0x55,0x2c,0x0a,0x30,0x78,0x32,0x44,0x31,0x42,0x31,0x42,0x33,0x36,0x55,0x2c,0x30,0x78,0x42,0x32,0x36,0x45,0x36,0x45,0x44,0x43,0x55,0x2c,0x30,0x78,0x45,0x45,0x35,
|
||||||
|
0x41,0x35,0x41,0x42,0x34,0x55,0x2c,0x30,0x78,0x46,0x42,0x41,0x30,0x41,0x30,0x35,0x42,0x55,0x2c,0x0a,0x30,0x78,0x46,0x36,0x35,0x32,0x35,0x32,0x41,0x34,0x55,0x2c,
|
||||||
|
0x30,0x78,0x34,0x44,0x33,0x42,0x33,0x42,0x37,0x36,0x55,0x2c,0x30,0x78,0x36,0x31,0x44,0x36,0x44,0x36,0x42,0x37,0x55,0x2c,0x30,0x78,0x43,0x45,0x42,0x33,0x42,0x33,
|
||||||
|
0x37,0x44,0x55,0x2c,0x0a,0x30,0x78,0x37,0x42,0x32,0x39,0x32,0x39,0x35,0x32,0x55,0x2c,0x30,0x78,0x33,0x45,0x45,0x33,0x45,0x33,0x44,0x44,0x55,0x2c,0x30,0x78,0x37,
|
||||||
|
0x31,0x32,0x46,0x32,0x46,0x35,0x45,0x55,0x2c,0x30,0x78,0x39,0x37,0x38,0x34,0x38,0x34,0x31,0x33,0x55,0x2c,0x0a,0x30,0x78,0x46,0x35,0x35,0x33,0x35,0x33,0x41,0x36,
|
||||||
|
0x55,0x2c,0x30,0x78,0x36,0x38,0x44,0x31,0x44,0x31,0x42,0x39,0x55,0x2c,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x55,0x2c,0x30,0x78,0x32,0x43,0x45,0x44,
|
||||||
|
0x45,0x44,0x43,0x31,0x55,0x2c,0x0a,0x30,0x78,0x36,0x30,0x32,0x30,0x32,0x30,0x34,0x30,0x55,0x2c,0x30,0x78,0x31,0x46,0x46,0x43,0x46,0x43,0x45,0x33,0x55,0x2c,0x30,
|
||||||
|
0x78,0x43,0x38,0x42,0x31,0x42,0x31,0x37,0x39,0x55,0x2c,0x30,0x78,0x45,0x44,0x35,0x42,0x35,0x42,0x42,0x36,0x55,0x2c,0x0a,0x30,0x78,0x42,0x45,0x36,0x41,0x36,0x41,
|
||||||
|
0x44,0x34,0x55,0x2c,0x30,0x78,0x34,0x36,0x43,0x42,0x43,0x42,0x38,0x44,0x55,0x2c,0x30,0x78,0x44,0x39,0x42,0x45,0x42,0x45,0x36,0x37,0x55,0x2c,0x30,0x78,0x34,0x42,
|
||||||
|
0x33,0x39,0x33,0x39,0x37,0x32,0x55,0x2c,0x0a,0x30,0x78,0x44,0x45,0x34,0x41,0x34,0x41,0x39,0x34,0x55,0x2c,0x30,0x78,0x44,0x34,0x34,0x43,0x34,0x43,0x39,0x38,0x55,
|
||||||
|
0x2c,0x30,0x78,0x45,0x38,0x35,0x38,0x35,0x38,0x42,0x30,0x55,0x2c,0x30,0x78,0x34,0x41,0x43,0x46,0x43,0x46,0x38,0x35,0x55,0x2c,0x0a,0x30,0x78,0x36,0x42,0x44,0x30,
|
||||||
|
0x44,0x30,0x42,0x42,0x55,0x2c,0x30,0x78,0x32,0x41,0x45,0x46,0x45,0x46,0x43,0x35,0x55,0x2c,0x30,0x78,0x45,0x35,0x41,0x41,0x41,0x41,0x34,0x46,0x55,0x2c,0x30,0x78,
|
||||||
|
0x31,0x36,0x46,0x42,0x46,0x42,0x45,0x44,0x55,0x2c,0x0a,0x30,0x78,0x43,0x35,0x34,0x33,0x34,0x33,0x38,0x36,0x55,0x2c,0x30,0x78,0x44,0x37,0x34,0x44,0x34,0x44,0x39,
|
||||||
|
0x41,0x55,0x2c,0x30,0x78,0x35,0x35,0x33,0x33,0x33,0x33,0x36,0x36,0x55,0x2c,0x30,0x78,0x39,0x34,0x38,0x35,0x38,0x35,0x31,0x31,0x55,0x2c,0x0a,0x30,0x78,0x43,0x46,
|
||||||
|
0x34,0x35,0x34,0x35,0x38,0x41,0x55,0x2c,0x30,0x78,0x31,0x30,0x46,0x39,0x46,0x39,0x45,0x39,0x55,0x2c,0x30,0x78,0x30,0x36,0x30,0x32,0x30,0x32,0x30,0x34,0x55,0x2c,
|
||||||
|
0x30,0x78,0x38,0x31,0x37,0x46,0x37,0x46,0x46,0x45,0x55,0x2c,0x0a,0x30,0x78,0x46,0x30,0x35,0x30,0x35,0x30,0x41,0x30,0x55,0x2c,0x30,0x78,0x34,0x34,0x33,0x43,0x33,
|
||||||
|
0x43,0x37,0x38,0x55,0x2c,0x30,0x78,0x42,0x41,0x39,0x46,0x39,0x46,0x32,0x35,0x55,0x2c,0x30,0x78,0x45,0x33,0x41,0x38,0x41,0x38,0x34,0x42,0x55,0x2c,0x0a,0x30,0x78,
|
||||||
|
0x46,0x33,0x35,0x31,0x35,0x31,0x41,0x32,0x55,0x2c,0x30,0x78,0x46,0x45,0x41,0x33,0x41,0x33,0x35,0x44,0x55,0x2c,0x30,0x78,0x43,0x30,0x34,0x30,0x34,0x30,0x38,0x30,
|
||||||
|
0x55,0x2c,0x30,0x78,0x38,0x41,0x38,0x46,0x38,0x46,0x30,0x35,0x55,0x2c,0x0a,0x30,0x78,0x41,0x44,0x39,0x32,0x39,0x32,0x33,0x46,0x55,0x2c,0x30,0x78,0x42,0x43,0x39,
|
||||||
|
0x44,0x39,0x44,0x32,0x31,0x55,0x2c,0x30,0x78,0x34,0x38,0x33,0x38,0x33,0x38,0x37,0x30,0x55,0x2c,0x30,0x78,0x30,0x34,0x46,0x35,0x46,0x35,0x46,0x31,0x55,0x2c,0x0a,
|
||||||
|
0x30,0x78,0x44,0x46,0x42,0x43,0x42,0x43,0x36,0x33,0x55,0x2c,0x30,0x78,0x43,0x31,0x42,0x36,0x42,0x36,0x37,0x37,0x55,0x2c,0x30,0x78,0x37,0x35,0x44,0x41,0x44,0x41,
|
||||||
|
0x41,0x46,0x55,0x2c,0x30,0x78,0x36,0x33,0x32,0x31,0x32,0x31,0x34,0x32,0x55,0x2c,0x0a,0x30,0x78,0x33,0x30,0x31,0x30,0x31,0x30,0x32,0x30,0x55,0x2c,0x30,0x78,0x31,
|
||||||
|
0x41,0x46,0x46,0x46,0x46,0x45,0x35,0x55,0x2c,0x30,0x78,0x30,0x45,0x46,0x33,0x46,0x33,0x46,0x44,0x55,0x2c,0x30,0x78,0x36,0x44,0x44,0x32,0x44,0x32,0x42,0x46,0x55,
|
||||||
|
0x2c,0x0a,0x30,0x78,0x34,0x43,0x43,0x44,0x43,0x44,0x38,0x31,0x55,0x2c,0x30,0x78,0x31,0x34,0x30,0x43,0x30,0x43,0x31,0x38,0x55,0x2c,0x30,0x78,0x33,0x35,0x31,0x33,
|
||||||
|
0x31,0x33,0x32,0x36,0x55,0x2c,0x30,0x78,0x32,0x46,0x45,0x43,0x45,0x43,0x43,0x33,0x55,0x2c,0x0a,0x30,0x78,0x45,0x31,0x35,0x46,0x35,0x46,0x42,0x45,0x55,0x2c,0x30,
|
||||||
|
0x78,0x41,0x32,0x39,0x37,0x39,0x37,0x33,0x35,0x55,0x2c,0x30,0x78,0x43,0x43,0x34,0x34,0x34,0x34,0x38,0x38,0x55,0x2c,0x30,0x78,0x33,0x39,0x31,0x37,0x31,0x37,0x32,
|
||||||
|
0x45,0x55,0x2c,0x0a,0x30,0x78,0x35,0x37,0x43,0x34,0x43,0x34,0x39,0x33,0x55,0x2c,0x30,0x78,0x46,0x32,0x41,0x37,0x41,0x37,0x35,0x35,0x55,0x2c,0x30,0x78,0x38,0x32,
|
||||||
|
0x37,0x45,0x37,0x45,0x46,0x43,0x55,0x2c,0x30,0x78,0x34,0x37,0x33,0x44,0x33,0x44,0x37,0x41,0x55,0x2c,0x0a,0x30,0x78,0x41,0x43,0x36,0x34,0x36,0x34,0x43,0x38,0x55,
|
||||||
|
0x2c,0x30,0x78,0x45,0x37,0x35,0x44,0x35,0x44,0x42,0x41,0x55,0x2c,0x30,0x78,0x32,0x42,0x31,0x39,0x31,0x39,0x33,0x32,0x55,0x2c,0x30,0x78,0x39,0x35,0x37,0x33,0x37,
|
||||||
|
0x33,0x45,0x36,0x55,0x2c,0x0a,0x30,0x78,0x41,0x30,0x36,0x30,0x36,0x30,0x43,0x30,0x55,0x2c,0x30,0x78,0x39,0x38,0x38,0x31,0x38,0x31,0x31,0x39,0x55,0x2c,0x30,0x78,
|
||||||
|
0x44,0x31,0x34,0x46,0x34,0x46,0x39,0x45,0x55,0x2c,0x30,0x78,0x37,0x46,0x44,0x43,0x44,0x43,0x41,0x33,0x55,0x2c,0x0a,0x30,0x78,0x36,0x36,0x32,0x32,0x32,0x32,0x34,
|
||||||
|
0x34,0x55,0x2c,0x30,0x78,0x37,0x45,0x32,0x41,0x32,0x41,0x35,0x34,0x55,0x2c,0x30,0x78,0x41,0x42,0x39,0x30,0x39,0x30,0x33,0x42,0x55,0x2c,0x30,0x78,0x38,0x33,0x38,
|
||||||
|
0x38,0x38,0x38,0x30,0x42,0x55,0x2c,0x0a,0x30,0x78,0x43,0x41,0x34,0x36,0x34,0x36,0x38,0x43,0x55,0x2c,0x30,0x78,0x32,0x39,0x45,0x45,0x45,0x45,0x43,0x37,0x55,0x2c,
|
||||||
|
0x30,0x78,0x44,0x33,0x42,0x38,0x42,0x38,0x36,0x42,0x55,0x2c,0x30,0x78,0x33,0x43,0x31,0x34,0x31,0x34,0x32,0x38,0x55,0x2c,0x0a,0x30,0x78,0x37,0x39,0x44,0x45,0x44,
|
||||||
|
0x45,0x41,0x37,0x55,0x2c,0x30,0x78,0x45,0x32,0x35,0x45,0x35,0x45,0x42,0x43,0x55,0x2c,0x30,0x78,0x31,0x44,0x30,0x42,0x30,0x42,0x31,0x36,0x55,0x2c,0x30,0x78,0x37,
|
||||||
|
0x36,0x44,0x42,0x44,0x42,0x41,0x44,0x55,0x2c,0x0a,0x30,0x78,0x33,0x42,0x45,0x30,0x45,0x30,0x44,0x42,0x55,0x2c,0x30,0x78,0x35,0x36,0x33,0x32,0x33,0x32,0x36,0x34,
|
||||||
|
0x55,0x2c,0x30,0x78,0x34,0x45,0x33,0x41,0x33,0x41,0x37,0x34,0x55,0x2c,0x30,0x78,0x31,0x45,0x30,0x41,0x30,0x41,0x31,0x34,0x55,0x2c,0x0a,0x30,0x78,0x44,0x42,0x34,
|
||||||
|
0x39,0x34,0x39,0x39,0x32,0x55,0x2c,0x30,0x78,0x30,0x41,0x30,0x36,0x30,0x36,0x30,0x43,0x55,0x2c,0x30,0x78,0x36,0x43,0x32,0x34,0x32,0x34,0x34,0x38,0x55,0x2c,0x30,
|
||||||
|
0x78,0x45,0x34,0x35,0x43,0x35,0x43,0x42,0x38,0x55,0x2c,0x0a,0x30,0x78,0x35,0x44,0x43,0x32,0x43,0x32,0x39,0x46,0x55,0x2c,0x30,0x78,0x36,0x45,0x44,0x33,0x44,0x33,
|
||||||
|
0x42,0x44,0x55,0x2c,0x30,0x78,0x45,0x46,0x41,0x43,0x41,0x43,0x34,0x33,0x55,0x2c,0x30,0x78,0x41,0x36,0x36,0x32,0x36,0x32,0x43,0x34,0x55,0x2c,0x0a,0x30,0x78,0x41,
|
||||||
|
0x38,0x39,0x31,0x39,0x31,0x33,0x39,0x55,0x2c,0x30,0x78,0x41,0x34,0x39,0x35,0x39,0x35,0x33,0x31,0x55,0x2c,0x30,0x78,0x33,0x37,0x45,0x34,0x45,0x34,0x44,0x33,0x55,
|
||||||
|
0x2c,0x30,0x78,0x38,0x42,0x37,0x39,0x37,0x39,0x46,0x32,0x55,0x2c,0x0a,0x30,0x78,0x33,0x32,0x45,0x37,0x45,0x37,0x44,0x35,0x55,0x2c,0x30,0x78,0x34,0x33,0x43,0x38,
|
||||||
|
0x43,0x38,0x38,0x42,0x55,0x2c,0x30,0x78,0x35,0x39,0x33,0x37,0x33,0x37,0x36,0x45,0x55,0x2c,0x30,0x78,0x42,0x37,0x36,0x44,0x36,0x44,0x44,0x41,0x55,0x2c,0x0a,0x30,
|
||||||
|
0x78,0x38,0x43,0x38,0x44,0x38,0x44,0x30,0x31,0x55,0x2c,0x30,0x78,0x36,0x34,0x44,0x35,0x44,0x35,0x42,0x31,0x55,0x2c,0x30,0x78,0x44,0x32,0x34,0x45,0x34,0x45,0x39,
|
||||||
|
0x43,0x55,0x2c,0x30,0x78,0x45,0x30,0x41,0x39,0x41,0x39,0x34,0x39,0x55,0x2c,0x0a,0x30,0x78,0x42,0x34,0x36,0x43,0x36,0x43,0x44,0x38,0x55,0x2c,0x30,0x78,0x46,0x41,
|
||||||
|
0x35,0x36,0x35,0x36,0x41,0x43,0x55,0x2c,0x30,0x78,0x30,0x37,0x46,0x34,0x46,0x34,0x46,0x33,0x55,0x2c,0x30,0x78,0x32,0x35,0x45,0x41,0x45,0x41,0x43,0x46,0x55,0x2c,
|
||||||
|
0x0a,0x30,0x78,0x41,0x46,0x36,0x35,0x36,0x35,0x43,0x41,0x55,0x2c,0x30,0x78,0x38,0x45,0x37,0x41,0x37,0x41,0x46,0x34,0x55,0x2c,0x30,0x78,0x45,0x39,0x41,0x45,0x41,
|
||||||
|
0x45,0x34,0x37,0x55,0x2c,0x30,0x78,0x31,0x38,0x30,0x38,0x30,0x38,0x31,0x30,0x55,0x2c,0x0a,0x30,0x78,0x44,0x35,0x42,0x41,0x42,0x41,0x36,0x46,0x55,0x2c,0x30,0x78,
|
||||||
|
0x38,0x38,0x37,0x38,0x37,0x38,0x46,0x30,0x55,0x2c,0x30,0x78,0x36,0x46,0x32,0x35,0x32,0x35,0x34,0x41,0x55,0x2c,0x30,0x78,0x37,0x32,0x32,0x45,0x32,0x45,0x35,0x43,
|
||||||
|
0x55,0x2c,0x0a,0x30,0x78,0x32,0x34,0x31,0x43,0x31,0x43,0x33,0x38,0x55,0x2c,0x30,0x78,0x46,0x31,0x41,0x36,0x41,0x36,0x35,0x37,0x55,0x2c,0x30,0x78,0x43,0x37,0x42,
|
||||||
|
0x34,0x42,0x34,0x37,0x33,0x55,0x2c,0x30,0x78,0x35,0x31,0x43,0x36,0x43,0x36,0x39,0x37,0x55,0x2c,0x0a,0x30,0x78,0x32,0x33,0x45,0x38,0x45,0x38,0x43,0x42,0x55,0x2c,
|
||||||
|
0x30,0x78,0x37,0x43,0x44,0x44,0x44,0x44,0x41,0x31,0x55,0x2c,0x30,0x78,0x39,0x43,0x37,0x34,0x37,0x34,0x45,0x38,0x55,0x2c,0x30,0x78,0x32,0x31,0x31,0x46,0x31,0x46,
|
||||||
|
0x33,0x45,0x55,0x2c,0x0a,0x30,0x78,0x44,0x44,0x34,0x42,0x34,0x42,0x39,0x36,0x55,0x2c,0x30,0x78,0x44,0x43,0x42,0x44,0x42,0x44,0x36,0x31,0x55,0x2c,0x30,0x78,0x38,
|
||||||
|
0x36,0x38,0x42,0x38,0x42,0x30,0x44,0x55,0x2c,0x30,0x78,0x38,0x35,0x38,0x41,0x38,0x41,0x30,0x46,0x55,0x2c,0x0a,0x30,0x78,0x39,0x30,0x37,0x30,0x37,0x30,0x45,0x30,
|
||||||
|
0x55,0x2c,0x30,0x78,0x34,0x32,0x33,0x45,0x33,0x45,0x37,0x43,0x55,0x2c,0x30,0x78,0x43,0x34,0x42,0x35,0x42,0x35,0x37,0x31,0x55,0x2c,0x30,0x78,0x41,0x41,0x36,0x36,
|
||||||
|
0x36,0x36,0x43,0x43,0x55,0x2c,0x0a,0x30,0x78,0x44,0x38,0x34,0x38,0x34,0x38,0x39,0x30,0x55,0x2c,0x30,0x78,0x30,0x35,0x30,0x33,0x30,0x33,0x30,0x36,0x55,0x2c,0x30,
|
||||||
|
0x78,0x30,0x31,0x46,0x36,0x46,0x36,0x46,0x37,0x55,0x2c,0x30,0x78,0x31,0x32,0x30,0x45,0x30,0x45,0x31,0x43,0x55,0x2c,0x0a,0x30,0x78,0x41,0x33,0x36,0x31,0x36,0x31,
|
||||||
|
0x43,0x32,0x55,0x2c,0x30,0x78,0x35,0x46,0x33,0x35,0x33,0x35,0x36,0x41,0x55,0x2c,0x30,0x78,0x46,0x39,0x35,0x37,0x35,0x37,0x41,0x45,0x55,0x2c,0x30,0x78,0x44,0x30,
|
||||||
|
0x42,0x39,0x42,0x39,0x36,0x39,0x55,0x2c,0x0a,0x30,0x78,0x39,0x31,0x38,0x36,0x38,0x36,0x31,0x37,0x55,0x2c,0x30,0x78,0x35,0x38,0x43,0x31,0x43,0x31,0x39,0x39,0x55,
|
||||||
|
0x2c,0x30,0x78,0x32,0x37,0x31,0x44,0x31,0x44,0x33,0x41,0x55,0x2c,0x30,0x78,0x42,0x39,0x39,0x45,0x39,0x45,0x32,0x37,0x55,0x2c,0x0a,0x30,0x78,0x33,0x38,0x45,0x31,
|
||||||
|
0x45,0x31,0x44,0x39,0x55,0x2c,0x30,0x78,0x31,0x33,0x46,0x38,0x46,0x38,0x45,0x42,0x55,0x2c,0x30,0x78,0x42,0x33,0x39,0x38,0x39,0x38,0x32,0x42,0x55,0x2c,0x30,0x78,
|
||||||
|
0x33,0x33,0x31,0x31,0x31,0x31,0x32,0x32,0x55,0x2c,0x0a,0x30,0x78,0x42,0x42,0x36,0x39,0x36,0x39,0x44,0x32,0x55,0x2c,0x30,0x78,0x37,0x30,0x44,0x39,0x44,0x39,0x41,
|
||||||
|
0x39,0x55,0x2c,0x30,0x78,0x38,0x39,0x38,0x45,0x38,0x45,0x30,0x37,0x55,0x2c,0x30,0x78,0x41,0x37,0x39,0x34,0x39,0x34,0x33,0x33,0x55,0x2c,0x0a,0x30,0x78,0x42,0x36,
|
||||||
|
0x39,0x42,0x39,0x42,0x32,0x44,0x55,0x2c,0x30,0x78,0x32,0x32,0x31,0x45,0x31,0x45,0x33,0x43,0x55,0x2c,0x30,0x78,0x39,0x32,0x38,0x37,0x38,0x37,0x31,0x35,0x55,0x2c,
|
||||||
|
0x30,0x78,0x32,0x30,0x45,0x39,0x45,0x39,0x43,0x39,0x55,0x2c,0x0a,0x30,0x78,0x34,0x39,0x43,0x45,0x43,0x45,0x38,0x37,0x55,0x2c,0x30,0x78,0x46,0x46,0x35,0x35,0x35,
|
||||||
|
0x35,0x41,0x41,0x55,0x2c,0x30,0x78,0x37,0x38,0x32,0x38,0x32,0x38,0x35,0x30,0x55,0x2c,0x30,0x78,0x37,0x41,0x44,0x46,0x44,0x46,0x41,0x35,0x55,0x2c,0x0a,0x30,0x78,
|
||||||
|
0x38,0x46,0x38,0x43,0x38,0x43,0x30,0x33,0x55,0x2c,0x30,0x78,0x46,0x38,0x41,0x31,0x41,0x31,0x35,0x39,0x55,0x2c,0x30,0x78,0x38,0x30,0x38,0x39,0x38,0x39,0x30,0x39,
|
||||||
|
0x55,0x2c,0x30,0x78,0x31,0x37,0x30,0x44,0x30,0x44,0x31,0x41,0x55,0x2c,0x0a,0x30,0x78,0x44,0x41,0x42,0x46,0x42,0x46,0x36,0x35,0x55,0x2c,0x30,0x78,0x33,0x31,0x45,
|
||||||
|
0x36,0x45,0x36,0x44,0x37,0x55,0x2c,0x30,0x78,0x43,0x36,0x34,0x32,0x34,0x32,0x38,0x34,0x55,0x2c,0x30,0x78,0x42,0x38,0x36,0x38,0x36,0x38,0x44,0x30,0x55,0x2c,0x0a,
|
||||||
|
0x30,0x78,0x43,0x33,0x34,0x31,0x34,0x31,0x38,0x32,0x55,0x2c,0x30,0x78,0x42,0x30,0x39,0x39,0x39,0x39,0x32,0x39,0x55,0x2c,0x30,0x78,0x37,0x37,0x32,0x44,0x32,0x44,
|
||||||
|
0x35,0x41,0x55,0x2c,0x30,0x78,0x31,0x31,0x30,0x46,0x30,0x46,0x31,0x45,0x55,0x2c,0x0a,0x30,0x78,0x43,0x42,0x42,0x30,0x42,0x30,0x37,0x42,0x55,0x2c,0x30,0x78,0x46,
|
||||||
|
0x43,0x35,0x34,0x35,0x34,0x41,0x38,0x55,0x2c,0x30,0x78,0x44,0x36,0x42,0x42,0x42,0x42,0x36,0x44,0x55,0x2c,0x30,0x78,0x33,0x41,0x31,0x36,0x31,0x36,0x32,0x43,0x55,
|
||||||
|
0x0a,0x7d,0x3b,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x42,0x59,0x54,0x45,0x28,0x78,0x2c,0x20,0x79,0x29,0x20,0x28,0x61,0x6d,0x64,0x5f,0x62,0x66,0x65,0x28,
|
||||||
|
0x28,0x78,0x29,0x2c,0x20,0x28,0x79,0x29,0x20,0x3c,0x3c,0x20,0x33,0x55,0x2c,0x20,0x38,0x55,0x29,0x29,0x0a,0x23,0x69,0x66,0x20,0x28,0x41,0x4c,0x47,0x4f,0x20,0x3d,
|
||||||
|
0x3d,0x20,0x41,0x4c,0x47,0x4f,0x5f,0x43,0x4e,0x5f,0x48,0x45,0x41,0x56,0x59,0x5f,0x54,0x55,0x42,0x45,0x29,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x75,0x69,0x6e,
|
||||||
|
0x74,0x34,0x20,0x41,0x45,0x53,0x5f,0x52,0x6f,0x75,0x6e,0x64,0x5f,0x62,0x69,0x74,0x74,0x75,0x62,0x65,0x32,0x28,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x6c,0x6f,
|
||||||
|
0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x20,0x2a,0x41,0x45,0x53,0x30,0x2c,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,
|
||||||
|
0x74,0x20,0x2a,0x41,0x45,0x53,0x31,0x2c,0x75,0x69,0x6e,0x74,0x34,0x20,0x78,0x2c,0x75,0x69,0x6e,0x74,0x34,0x20,0x6b,0x29,0x0a,0x7b,0x0a,0x78,0x3d,0x7e,0x78,0x3b,
|
||||||
|
0x0a,0x6b,0x2e,0x73,0x30,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x78,0x2e,0x73,0x30,0x2c,0x30,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,
|
||||||
|
0x5b,0x42,0x59,0x54,0x45,0x28,0x78,0x2e,0x73,0x31,0x2c,0x31,0x29,0x5d,0x5e,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,
|
||||||
|
0x78,0x2e,0x73,0x32,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x78,0x2e,0x73,0x33,0x2c,0x33,0x29,0x5d,0x2c,0x31,0x36,0x55,0x29,
|
||||||
|
0x3b,0x0a,0x78,0x2e,0x73,0x30,0x20,0x5e,0x3d,0x20,0x6b,0x2e,0x73,0x30,0x3b,0x0a,0x6b,0x2e,0x73,0x31,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,
|
||||||
|
0x45,0x28,0x78,0x2e,0x73,0x31,0x2c,0x30,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x78,0x2e,0x73,0x32,0x2c,0x31,0x29,0x5d,0x5e,0x72,0x6f,
|
||||||
|
0x74,0x61,0x74,0x65,0x28,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x78,0x2e,0x73,0x33,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,
|
||||||
|
0x45,0x28,0x78,0x2e,0x73,0x30,0x2c,0x33,0x29,0x5d,0x2c,0x31,0x36,0x55,0x29,0x3b,0x0a,0x78,0x2e,0x73,0x31,0x20,0x5e,0x3d,0x20,0x6b,0x2e,0x73,0x31,0x3b,0x0a,0x6b,
|
||||||
|
0x2e,0x73,0x32,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x78,0x2e,0x73,0x32,0x2c,0x30,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,
|
||||||
|
0x59,0x54,0x45,0x28,0x78,0x2e,0x73,0x33,0x2c,0x31,0x29,0x5d,0x5e,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x78,0x2e,
|
||||||
|
0x73,0x30,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x78,0x2e,0x73,0x31,0x2c,0x33,0x29,0x5d,0x2c,0x31,0x36,0x55,0x29,0x3b,0x0a,
|
||||||
|
0x78,0x2e,0x73,0x32,0x20,0x5e,0x3d,0x20,0x6b,0x2e,0x73,0x32,0x3b,0x0a,0x6b,0x2e,0x73,0x33,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,
|
||||||
|
0x78,0x2e,0x73,0x33,0x2c,0x30,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x78,0x2e,0x73,0x30,0x2c,0x31,0x29,0x5d,0x5e,0x72,0x6f,0x74,0x61,
|
||||||
|
0x74,0x65,0x28,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x78,0x2e,0x73,0x31,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,
|
||||||
|
0x78,0x2e,0x73,0x32,0x2c,0x33,0x29,0x5d,0x2c,0x31,0x36,0x55,0x29,0x3b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6b,0x3b,0x0a,0x7d,0x0a,0x23,0x65,0x6e,0x64,0x69,
|
||||||
|
0x66,0x0a,0x75,0x69,0x6e,0x74,0x34,0x20,0x41,0x45,0x53,0x5f,0x52,0x6f,0x75,0x6e,0x64,0x28,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,
|
||||||
|
0x75,0x69,0x6e,0x74,0x20,0x2a,0x41,0x45,0x53,0x30,0x2c,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x20,0x2a,0x41,
|
||||||
|
0x45,0x53,0x31,0x2c,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x20,0x2a,0x41,0x45,0x53,0x32,0x2c,0x63,0x6f,0x6e,
|
||||||
|
0x73,0x74,0x20,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x20,0x2a,0x41,0x45,0x53,0x33,0x2c,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,
|
||||||
|
0x34,0x20,0x58,0x2c,0x75,0x69,0x6e,0x74,0x34,0x20,0x6b,0x65,0x79,0x29,0x0a,0x7b,0x0a,0x6b,0x65,0x79,0x2e,0x73,0x30,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,
|
||||||
|
0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x30,0x2c,0x30,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x31,0x2c,0x31,0x29,0x5d,
|
||||||
|
0x5e,0x41,0x45,0x53,0x32,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x32,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x33,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,
|
||||||
|
0x73,0x33,0x2c,0x33,0x29,0x5d,0x3b,0x0a,0x6b,0x65,0x79,0x2e,0x73,0x31,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x31,
|
||||||
|
0x2c,0x30,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x32,0x2c,0x31,0x29,0x5d,0x5e,0x41,0x45,0x53,0x32,0x5b,0x42,0x59,0x54,
|
||||||
|
0x45,0x28,0x58,0x2e,0x73,0x33,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x33,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x30,0x2c,0x33,0x29,0x5d,0x3b,0x0a,0x6b,
|
||||||
|
0x65,0x79,0x2e,0x73,0x32,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x32,0x2c,0x30,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,
|
||||||
|
0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x33,0x2c,0x31,0x29,0x5d,0x5e,0x41,0x45,0x53,0x32,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x30,0x2c,0x32,0x29,
|
||||||
|
0x5d,0x5e,0x41,0x45,0x53,0x33,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x31,0x2c,0x33,0x29,0x5d,0x3b,0x0a,0x6b,0x65,0x79,0x2e,0x73,0x33,0x20,0x5e,0x3d,0x20,
|
||||||
|
0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x33,0x2c,0x30,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,
|
||||||
|
0x30,0x2c,0x31,0x29,0x5d,0x5e,0x41,0x45,0x53,0x32,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x31,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x33,0x5b,0x42,0x59,
|
||||||
|
0x54,0x45,0x28,0x58,0x2e,0x73,0x32,0x2c,0x33,0x29,0x5d,0x3b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6b,0x65,0x79,0x3b,0x0a,0x7d,0x0a,0x75,0x69,0x6e,0x74,0x34,
|
||||||
|
0x20,0x41,0x45,0x53,0x5f,0x52,0x6f,0x75,0x6e,0x64,0x5f,0x54,0x77,0x6f,0x5f,0x54,0x61,0x62,0x6c,0x65,0x73,0x28,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x6c,0x6f,
|
||||||
|
0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x20,0x2a,0x41,0x45,0x53,0x30,0x2c,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,
|
||||||
|
0x74,0x20,0x2a,0x41,0x45,0x53,0x31,0x2c,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x34,0x20,0x58,0x2c,0x75,0x69,0x6e,0x74,0x34,0x20,0x6b,0x65,0x79,0x29,
|
||||||
|
0x0a,0x7b,0x0a,0x6b,0x65,0x79,0x2e,0x73,0x30,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x30,0x2c,0x30,0x29,0x5d,0x5e,
|
||||||
|
0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x31,0x2c,0x31,0x29,0x5d,0x5e,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x41,0x45,0x53,0x30,0x5b,0x42,
|
||||||
|
0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x32,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x33,0x2c,0x33,0x29,0x5d,0x2c,
|
||||||
|
0x31,0x36,0x55,0x29,0x3b,0x0a,0x6b,0x65,0x79,0x2e,0x73,0x31,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x31,0x2c,0x30,
|
||||||
|
0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x32,0x2c,0x31,0x29,0x5d,0x5e,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x41,0x45,0x53,
|
||||||
|
0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x33,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x30,0x2c,0x33,
|
||||||
|
0x29,0x5d,0x2c,0x31,0x36,0x55,0x29,0x3b,0x0a,0x6b,0x65,0x79,0x2e,0x73,0x32,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,
|
||||||
|
0x32,0x2c,0x30,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x33,0x2c,0x31,0x29,0x5d,0x5e,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,
|
||||||
|
0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x30,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,
|
||||||
|
0x31,0x2c,0x33,0x29,0x5d,0x2c,0x31,0x36,0x55,0x29,0x3b,0x0a,0x6b,0x65,0x79,0x2e,0x73,0x33,0x20,0x5e,0x3d,0x20,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,
|
||||||
|
0x58,0x2e,0x73,0x33,0x2c,0x30,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x30,0x2c,0x31,0x29,0x5d,0x5e,0x72,0x6f,0x74,0x61,
|
||||||
|
0x74,0x65,0x28,0x41,0x45,0x53,0x30,0x5b,0x42,0x59,0x54,0x45,0x28,0x58,0x2e,0x73,0x31,0x2c,0x32,0x29,0x5d,0x5e,0x41,0x45,0x53,0x31,0x5b,0x42,0x59,0x54,0x45,0x28,
|
||||||
|
0x58,0x2e,0x73,0x32,0x2c,0x33,0x29,0x5d,0x2c,0x31,0x36,0x55,0x29,0x3b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6b,0x65,0x79,0x3b,0x0a,0x7d,0x0a,0x53,0x54,0x41,
|
||||||
|
0x54,0x49,0x43,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x75,0x63,0x68,0x61,0x72,0x20,0x72,0x63,0x6f,0x6e,0x5b,
|
||||||
|
0x38,0x5d,0x3d,0x7b,0x20,0x30,0x78,0x38,0x64,0x2c,0x30,0x78,0x30,0x31,0x2c,0x30,0x78,0x30,0x32,0x2c,0x30,0x78,0x30,0x34,0x2c,0x30,0x78,0x30,0x38,0x2c,0x30,0x78,
|
||||||
|
0x31,0x30,0x2c,0x30,0x78,0x32,0x30,0x2c,0x30,0x78,0x34,0x30,0x20,0x7d,0x3b,0x0a,0x53,0x54,0x41,0x54,0x49,0x43,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x63,
|
||||||
|
0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x75,0x63,0x68,0x61,0x72,0x20,0x73,0x62,0x6f,0x78,0x5b,0x32,0x35,0x36,0x5d,0x20,0x3d,0x0a,0x7b,0x0a,0x30,0x78,0x36,0x33,
|
||||||
|
0x2c,0x30,0x78,0x37,0x43,0x2c,0x30,0x78,0x37,0x37,0x2c,0x30,0x78,0x37,0x42,0x2c,0x30,0x78,0x46,0x32,0x2c,0x30,0x78,0x36,0x42,0x2c,0x30,0x78,0x36,0x46,0x2c,0x30,
|
||||||
|
0x78,0x43,0x35,0x2c,0x30,0x78,0x33,0x30,0x2c,0x30,0x78,0x30,0x31,0x2c,0x30,0x78,0x36,0x37,0x2c,0x30,0x78,0x32,0x42,0x2c,0x30,0x78,0x46,0x45,0x2c,0x30,0x78,0x44,
|
||||||
|
0x37,0x2c,0x30,0x78,0x41,0x42,0x2c,0x30,0x78,0x37,0x36,0x2c,0x0a,0x30,0x78,0x43,0x41,0x2c,0x30,0x78,0x38,0x32,0x2c,0x30,0x78,0x43,0x39,0x2c,0x30,0x78,0x37,0x44,
|
||||||
|
0x2c,0x30,0x78,0x46,0x41,0x2c,0x30,0x78,0x35,0x39,0x2c,0x30,0x78,0x34,0x37,0x2c,0x30,0x78,0x46,0x30,0x2c,0x30,0x78,0x41,0x44,0x2c,0x30,0x78,0x44,0x34,0x2c,0x30,
|
||||||
|
0x78,0x41,0x32,0x2c,0x30,0x78,0x41,0x46,0x2c,0x30,0x78,0x39,0x43,0x2c,0x30,0x78,0x41,0x34,0x2c,0x30,0x78,0x37,0x32,0x2c,0x30,0x78,0x43,0x30,0x2c,0x0a,0x30,0x78,
|
||||||
|
0x42,0x37,0x2c,0x30,0x78,0x46,0x44,0x2c,0x30,0x78,0x39,0x33,0x2c,0x30,0x78,0x32,0x36,0x2c,0x30,0x78,0x33,0x36,0x2c,0x30,0x78,0x33,0x46,0x2c,0x30,0x78,0x46,0x37,
|
||||||
|
0x2c,0x30,0x78,0x43,0x43,0x2c,0x30,0x78,0x33,0x34,0x2c,0x30,0x78,0x41,0x35,0x2c,0x30,0x78,0x45,0x35,0x2c,0x30,0x78,0x46,0x31,0x2c,0x30,0x78,0x37,0x31,0x2c,0x30,
|
||||||
|
0x78,0x44,0x38,0x2c,0x30,0x78,0x33,0x31,0x2c,0x30,0x78,0x31,0x35,0x2c,0x0a,0x30,0x78,0x30,0x34,0x2c,0x30,0x78,0x43,0x37,0x2c,0x30,0x78,0x32,0x33,0x2c,0x30,0x78,
|
||||||
|
0x43,0x33,0x2c,0x30,0x78,0x31,0x38,0x2c,0x30,0x78,0x39,0x36,0x2c,0x30,0x78,0x30,0x35,0x2c,0x30,0x78,0x39,0x41,0x2c,0x30,0x78,0x30,0x37,0x2c,0x30,0x78,0x31,0x32,
|
||||||
|
0x2c,0x30,0x78,0x38,0x30,0x2c,0x30,0x78,0x45,0x32,0x2c,0x30,0x78,0x45,0x42,0x2c,0x30,0x78,0x32,0x37,0x2c,0x30,0x78,0x42,0x32,0x2c,0x30,0x78,0x37,0x35,0x2c,0x0a,
|
||||||
|
0x30,0x78,0x30,0x39,0x2c,0x30,0x78,0x38,0x33,0x2c,0x30,0x78,0x32,0x43,0x2c,0x30,0x78,0x31,0x41,0x2c,0x30,0x78,0x31,0x42,0x2c,0x30,0x78,0x36,0x45,0x2c,0x30,0x78,
|
||||||
|
0x35,0x41,0x2c,0x30,0x78,0x41,0x30,0x2c,0x30,0x78,0x35,0x32,0x2c,0x30,0x78,0x33,0x42,0x2c,0x30,0x78,0x44,0x36,0x2c,0x30,0x78,0x42,0x33,0x2c,0x30,0x78,0x32,0x39,
|
||||||
|
0x2c,0x30,0x78,0x45,0x33,0x2c,0x30,0x78,0x32,0x46,0x2c,0x30,0x78,0x38,0x34,0x2c,0x0a,0x30,0x78,0x35,0x33,0x2c,0x30,0x78,0x44,0x31,0x2c,0x30,0x78,0x30,0x30,0x2c,
|
||||||
|
0x30,0x78,0x45,0x44,0x2c,0x30,0x78,0x32,0x30,0x2c,0x30,0x78,0x46,0x43,0x2c,0x30,0x78,0x42,0x31,0x2c,0x30,0x78,0x35,0x42,0x2c,0x30,0x78,0x36,0x41,0x2c,0x30,0x78,
|
||||||
|
0x43,0x42,0x2c,0x30,0x78,0x42,0x45,0x2c,0x30,0x78,0x33,0x39,0x2c,0x30,0x78,0x34,0x41,0x2c,0x30,0x78,0x34,0x43,0x2c,0x30,0x78,0x35,0x38,0x2c,0x30,0x78,0x43,0x46,
|
||||||
|
0x2c,0x0a,0x30,0x78,0x44,0x30,0x2c,0x30,0x78,0x45,0x46,0x2c,0x30,0x78,0x41,0x41,0x2c,0x30,0x78,0x46,0x42,0x2c,0x30,0x78,0x34,0x33,0x2c,0x30,0x78,0x34,0x44,0x2c,
|
||||||
|
0x30,0x78,0x33,0x33,0x2c,0x30,0x78,0x38,0x35,0x2c,0x30,0x78,0x34,0x35,0x2c,0x30,0x78,0x46,0x39,0x2c,0x30,0x78,0x30,0x32,0x2c,0x30,0x78,0x37,0x46,0x2c,0x30,0x78,
|
||||||
|
0x35,0x30,0x2c,0x30,0x78,0x33,0x43,0x2c,0x30,0x78,0x39,0x46,0x2c,0x30,0x78,0x41,0x38,0x2c,0x0a,0x30,0x78,0x35,0x31,0x2c,0x30,0x78,0x41,0x33,0x2c,0x30,0x78,0x34,
|
||||||
|
0x30,0x2c,0x30,0x78,0x38,0x46,0x2c,0x30,0x78,0x39,0x32,0x2c,0x30,0x78,0x39,0x44,0x2c,0x30,0x78,0x33,0x38,0x2c,0x30,0x78,0x46,0x35,0x2c,0x30,0x78,0x42,0x43,0x2c,
|
||||||
|
0x30,0x78,0x42,0x36,0x2c,0x30,0x78,0x44,0x41,0x2c,0x30,0x78,0x32,0x31,0x2c,0x30,0x78,0x31,0x30,0x2c,0x30,0x78,0x46,0x46,0x2c,0x30,0x78,0x46,0x33,0x2c,0x30,0x78,
|
||||||
|
0x44,0x32,0x2c,0x0a,0x30,0x78,0x43,0x44,0x2c,0x30,0x78,0x30,0x43,0x2c,0x30,0x78,0x31,0x33,0x2c,0x30,0x78,0x45,0x43,0x2c,0x30,0x78,0x35,0x46,0x2c,0x30,0x78,0x39,
|
||||||
|
0x37,0x2c,0x30,0x78,0x34,0x34,0x2c,0x30,0x78,0x31,0x37,0x2c,0x30,0x78,0x43,0x34,0x2c,0x30,0x78,0x41,0x37,0x2c,0x30,0x78,0x37,0x45,0x2c,0x30,0x78,0x33,0x44,0x2c,
|
||||||
|
0x30,0x78,0x36,0x34,0x2c,0x30,0x78,0x35,0x44,0x2c,0x30,0x78,0x31,0x39,0x2c,0x30,0x78,0x37,0x33,0x2c,0x0a,0x30,0x78,0x36,0x30,0x2c,0x30,0x78,0x38,0x31,0x2c,0x30,
|
||||||
|
0x78,0x34,0x46,0x2c,0x30,0x78,0x44,0x43,0x2c,0x30,0x78,0x32,0x32,0x2c,0x30,0x78,0x32,0x41,0x2c,0x30,0x78,0x39,0x30,0x2c,0x30,0x78,0x38,0x38,0x2c,0x30,0x78,0x34,
|
||||||
|
0x36,0x2c,0x30,0x78,0x45,0x45,0x2c,0x30,0x78,0x42,0x38,0x2c,0x30,0x78,0x31,0x34,0x2c,0x30,0x78,0x44,0x45,0x2c,0x30,0x78,0x35,0x45,0x2c,0x30,0x78,0x30,0x42,0x2c,
|
||||||
|
0x30,0x78,0x44,0x42,0x2c,0x0a,0x30,0x78,0x45,0x30,0x2c,0x30,0x78,0x33,0x32,0x2c,0x30,0x78,0x33,0x41,0x2c,0x30,0x78,0x30,0x41,0x2c,0x30,0x78,0x34,0x39,0x2c,0x30,
|
||||||
|
0x78,0x30,0x36,0x2c,0x30,0x78,0x32,0x34,0x2c,0x30,0x78,0x35,0x43,0x2c,0x30,0x78,0x43,0x32,0x2c,0x30,0x78,0x44,0x33,0x2c,0x30,0x78,0x41,0x43,0x2c,0x30,0x78,0x36,
|
||||||
|
0x32,0x2c,0x30,0x78,0x39,0x31,0x2c,0x30,0x78,0x39,0x35,0x2c,0x30,0x78,0x45,0x34,0x2c,0x30,0x78,0x37,0x39,0x2c,0x0a,0x30,0x78,0x45,0x37,0x2c,0x30,0x78,0x43,0x38,
|
||||||
|
0x2c,0x30,0x78,0x33,0x37,0x2c,0x30,0x78,0x36,0x44,0x2c,0x30,0x78,0x38,0x44,0x2c,0x30,0x78,0x44,0x35,0x2c,0x30,0x78,0x34,0x45,0x2c,0x30,0x78,0x41,0x39,0x2c,0x30,
|
||||||
|
0x78,0x36,0x43,0x2c,0x30,0x78,0x35,0x36,0x2c,0x30,0x78,0x46,0x34,0x2c,0x30,0x78,0x45,0x41,0x2c,0x30,0x78,0x36,0x35,0x2c,0x30,0x78,0x37,0x41,0x2c,0x30,0x78,0x41,
|
||||||
|
0x45,0x2c,0x30,0x78,0x30,0x38,0x2c,0x0a,0x30,0x78,0x42,0x41,0x2c,0x30,0x78,0x37,0x38,0x2c,0x30,0x78,0x32,0x35,0x2c,0x30,0x78,0x32,0x45,0x2c,0x30,0x78,0x31,0x43,
|
||||||
|
0x2c,0x30,0x78,0x41,0x36,0x2c,0x30,0x78,0x42,0x34,0x2c,0x30,0x78,0x43,0x36,0x2c,0x30,0x78,0x45,0x38,0x2c,0x30,0x78,0x44,0x44,0x2c,0x30,0x78,0x37,0x34,0x2c,0x30,
|
||||||
|
0x78,0x31,0x46,0x2c,0x30,0x78,0x34,0x42,0x2c,0x30,0x78,0x42,0x44,0x2c,0x30,0x78,0x38,0x42,0x2c,0x30,0x78,0x38,0x41,0x2c,0x0a,0x30,0x78,0x37,0x30,0x2c,0x30,0x78,
|
||||||
|
0x33,0x45,0x2c,0x30,0x78,0x42,0x35,0x2c,0x30,0x78,0x36,0x36,0x2c,0x30,0x78,0x34,0x38,0x2c,0x30,0x78,0x30,0x33,0x2c,0x30,0x78,0x46,0x36,0x2c,0x30,0x78,0x30,0x45,
|
||||||
|
0x2c,0x30,0x78,0x36,0x31,0x2c,0x30,0x78,0x33,0x35,0x2c,0x30,0x78,0x35,0x37,0x2c,0x30,0x78,0x42,0x39,0x2c,0x30,0x78,0x38,0x36,0x2c,0x30,0x78,0x43,0x31,0x2c,0x30,
|
||||||
|
0x78,0x31,0x44,0x2c,0x30,0x78,0x39,0x45,0x2c,0x0a,0x30,0x78,0x45,0x31,0x2c,0x30,0x78,0x46,0x38,0x2c,0x30,0x78,0x39,0x38,0x2c,0x30,0x78,0x31,0x31,0x2c,0x30,0x78,
|
||||||
|
0x36,0x39,0x2c,0x30,0x78,0x44,0x39,0x2c,0x30,0x78,0x38,0x45,0x2c,0x30,0x78,0x39,0x34,0x2c,0x30,0x78,0x39,0x42,0x2c,0x30,0x78,0x31,0x45,0x2c,0x30,0x78,0x38,0x37,
|
||||||
|
0x2c,0x30,0x78,0x45,0x39,0x2c,0x30,0x78,0x43,0x45,0x2c,0x30,0x78,0x35,0x35,0x2c,0x30,0x78,0x32,0x38,0x2c,0x30,0x78,0x44,0x46,0x2c,0x0a,0x30,0x78,0x38,0x43,0x2c,
|
||||||
|
0x30,0x78,0x41,0x31,0x2c,0x30,0x78,0x38,0x39,0x2c,0x30,0x78,0x30,0x44,0x2c,0x30,0x78,0x42,0x46,0x2c,0x30,0x78,0x45,0x36,0x2c,0x30,0x78,0x34,0x32,0x2c,0x30,0x78,
|
||||||
|
0x36,0x38,0x2c,0x30,0x78,0x34,0x31,0x2c,0x30,0x78,0x39,0x39,0x2c,0x30,0x78,0x32,0x44,0x2c,0x30,0x78,0x30,0x46,0x2c,0x30,0x78,0x42,0x30,0x2c,0x30,0x78,0x35,0x34,
|
||||||
|
0x2c,0x30,0x78,0x42,0x42,0x2c,0x30,0x78,0x31,0x36,0x0a,0x7d,0x3b,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x53,0x75,0x62,0x57,0x6f,0x72,0x64,0x28,0x69,0x6e,
|
||||||
|
0x77,0x29,0x20,0x28,0x28,0x73,0x62,0x6f,0x78,0x5b,0x42,0x59,0x54,0x45,0x28,0x69,0x6e,0x77,0x2c,0x20,0x33,0x29,0x5d,0x20,0x3c,0x3c,0x20,0x32,0x34,0x29,0x20,0x7c,
|
||||||
|
0x20,0x28,0x73,0x62,0x6f,0x78,0x5b,0x42,0x59,0x54,0x45,0x28,0x69,0x6e,0x77,0x2c,0x20,0x32,0x29,0x5d,0x20,0x3c,0x3c,0x20,0x31,0x36,0x29,0x20,0x7c,0x20,0x28,0x73,
|
||||||
|
0x62,0x6f,0x78,0x5b,0x42,0x59,0x54,0x45,0x28,0x69,0x6e,0x77,0x2c,0x20,0x31,0x29,0x5d,0x20,0x3c,0x3c,0x20,0x38,0x29,0x20,0x7c,0x20,0x73,0x62,0x6f,0x78,0x5b,0x42,
|
||||||
|
0x59,0x54,0x45,0x28,0x69,0x6e,0x77,0x2c,0x20,0x30,0x29,0x5d,0x29,0x0a,0x76,0x6f,0x69,0x64,0x20,0x41,0x45,0x53,0x45,0x78,0x70,0x61,0x6e,0x64,0x4b,0x65,0x79,0x32,
|
||||||
|
0x35,0x36,0x28,0x75,0x69,0x6e,0x74,0x20,0x2a,0x6b,0x65,0x79,0x62,0x75,0x66,0x29,0x0a,0x7b,0x0a,0x66,0x6f,0x72,0x20,0x28,0x75,0x69,0x6e,0x74,0x20,0x63,0x3d,0x38,
|
||||||
|
0x2c,0x69,0x3d,0x31,0x3b,0x20,0x63,0x3c,0x34,0x30,0x3b,0x20,0x2b,0x2b,0x63,0x29,0x20,0x7b,0x0a,0x75,0x69,0x6e,0x74,0x20,0x74,0x3d,0x28,0x28,0x21,0x28,0x63,0x26,
|
||||||
|
0x37,0x29,0x29,0x7c,0x7c,0x28,0x28,0x63,0x26,0x37,0x29,0x3d,0x3d,0x34,0x29,0x29,0x3f,0x53,0x75,0x62,0x57,0x6f,0x72,0x64,0x28,0x6b,0x65,0x79,0x62,0x75,0x66,0x5b,
|
||||||
|
0x63,0x2d,0x31,0x5d,0x29,0x3a,0x6b,0x65,0x79,0x62,0x75,0x66,0x5b,0x63,0x2d,0x31,0x5d,0x3b,0x0a,0x6b,0x65,0x79,0x62,0x75,0x66,0x5b,0x63,0x5d,0x3d,0x6b,0x65,0x79,
|
||||||
|
0x62,0x75,0x66,0x5b,0x63,0x2d,0x38,0x5d,0x5e,0x28,0x28,0x21,0x28,0x63,0x26,0x37,0x29,0x29,0x3f,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x74,0x2c,0x32,0x34,0x55,0x29,
|
||||||
|
0x5e,0x61,0x73,0x5f,0x75,0x69,0x6e,0x74,0x28,0x28,0x75,0x63,0x68,0x61,0x72,0x34,0x29,0x28,0x72,0x63,0x6f,0x6e,0x5b,0x69,0x2b,0x2b,0x5d,0x2c,0x30,0x55,0x2c,0x30,
|
||||||
|
0x55,0x2c,0x30,0x55,0x29,0x29,0x3a,0x74,0x29,0x3b,0x0a,0x7d,0x0a,0x7d,0x0a,0x23,0x65,0x6e,0x64,0x69,0x66,0x0a,0x23,0x69,0x66,0x6e,0x64,0x65,0x66,0x20,0x58,0x4d,
|
||||||
|
0x52,0x49,0x47,0x5f,0x4b,0x45,0x43,0x43,0x41,0x4b,0x5f,0x43,0x4c,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x58,0x4d,0x52,0x49,0x47,0x5f,0x4b,0x45,0x43,0x43,
|
||||||
|
0x41,0x4b,0x5f,0x43,0x4c,0x0a,0x53,0x54,0x41,0x54,0x49,0x43,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x75,0x6c,
|
||||||
|
0x6f,0x6e,0x67,0x20,0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,0x5f,0x72,0x6e,0x64,0x63,0x5b,0x32,0x34,0x5d,0x20,0x3d,0x0a,0x7b,0x0a,0x30,0x78,0x30,0x30,0x30,0x30,0x30,
|
||||||
|
0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x2c,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x38,0x32,0x2c,0x30,
|
||||||
|
0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x38,0x61,0x2c,0x0a,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x30,
|
||||||
|
0x30,0x38,0x30,0x30,0x30,0x2c,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x38,0x62,0x2c,0x30,0x78,0x30,0x30,0x30,0x30,0x30,
|
||||||
|
0x30,0x30,0x30,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x2c,0x0a,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x30,0x30,0x38,0x30,0x38,0x31,0x2c,
|
||||||
|
0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x30,0x39,0x2c,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,
|
||||||
|
0x30,0x30,0x30,0x38,0x61,0x2c,0x0a,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x38,0x2c,0x30,0x78,0x30,0x30,0x30,0x30,
|
||||||
|
0x30,0x30,0x30,0x30,0x38,0x30,0x30,0x30,0x38,0x30,0x30,0x39,0x2c,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x61,0x2c,
|
||||||
|
0x0a,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x30,0x30,0x38,0x30,0x38,0x62,0x2c,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,
|
||||||
|
0x30,0x30,0x30,0x30,0x38,0x62,0x2c,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x38,0x39,0x2c,0x0a,0x30,0x78,0x38,0x30,0x30,
|
||||||
|
0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x30,0x33,0x2c,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x30,0x32,
|
||||||
|
0x2c,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x2c,0x0a,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,
|
||||||
|
0x30,0x30,0x30,0x38,0x30,0x30,0x61,0x2c,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x61,0x2c,0x30,0x78,0x38,0x30,0x30,
|
||||||
|
0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x30,0x30,0x38,0x30,0x38,0x31,0x2c,0x0a,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x38,
|
||||||
|
0x30,0x2c,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x2c,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x38,
|
||||||
|
0x30,0x30,0x30,0x38,0x30,0x30,0x38,0x0a,0x7d,0x3b,0x0a,0x53,0x54,0x41,0x54,0x49,0x43,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x63,0x6f,0x6e,0x73,0x74,0x61,
|
||||||
|
0x6e,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,0x5f,0x72,0x6f,0x74,0x63,0x5b,0x32,0x34,0x5d,0x20,0x3d,0x0a,0x7b,0x0a,0x31,0x2c,0x33,
|
||||||
|
0x2c,0x36,0x2c,0x31,0x30,0x2c,0x31,0x35,0x2c,0x32,0x31,0x2c,0x32,0x38,0x2c,0x33,0x36,0x2c,0x34,0x35,0x2c,0x35,0x35,0x2c,0x32,0x2c,0x31,0x34,0x2c,0x0a,0x32,0x37,
|
||||||
|
0x2c,0x34,0x31,0x2c,0x35,0x36,0x2c,0x38,0x2c,0x32,0x35,0x2c,0x34,0x33,0x2c,0x36,0x32,0x2c,0x31,0x38,0x2c,0x33,0x39,0x2c,0x36,0x31,0x2c,0x32,0x30,0x2c,0x34,0x34,
|
||||||
|
0x0a,0x7d,0x3b,0x0a,0x53,0x54,0x41,0x54,0x49,0x43,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x75,0x69,0x6e,0x74,
|
||||||
|
0x20,0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,0x5f,0x70,0x69,0x6c,0x6e,0x5b,0x32,0x34,0x5d,0x20,0x3d,0x0a,0x7b,0x0a,0x31,0x30,0x2c,0x37,0x2c,0x31,0x31,0x2c,0x31,0x37,
|
||||||
|
0x2c,0x31,0x38,0x2c,0x33,0x2c,0x35,0x2c,0x31,0x36,0x2c,0x38,0x2c,0x32,0x31,0x2c,0x32,0x34,0x2c,0x34,0x2c,0x0a,0x31,0x35,0x2c,0x32,0x33,0x2c,0x31,0x39,0x2c,0x31,
|
||||||
|
0x33,0x2c,0x31,0x32,0x2c,0x32,0x2c,0x32,0x30,0x2c,0x31,0x34,0x2c,0x32,0x32,0x2c,0x39,0x2c,0x36,0x2c,0x31,0x0a,0x7d,0x3b,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6b,0x65,
|
||||||
|
0x63,0x63,0x61,0x6b,0x66,0x31,0x36,0x30,0x30,0x5f,0x31,0x28,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x2a,0x73,0x74,0x29,0x0a,0x7b,0x0a,0x69,0x6e,0x74,0x20,0x69,0x2c,0x72,
|
||||||
|
0x6f,0x75,0x6e,0x64,0x3b,0x0a,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x74,0x2c,0x62,0x63,0x5b,0x35,0x5d,0x3b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,
|
||||||
|
0x6f,0x6c,0x6c,0x20,0x31,0x0a,0x66,0x6f,0x72,0x20,0x28,0x72,0x6f,0x75,0x6e,0x64,0x3d,0x30,0x3b,0x20,0x72,0x6f,0x75,0x6e,0x64,0x3c,0x32,0x34,0x3b,0x20,0x2b,0x2b,
|
||||||
|
0x72,0x6f,0x75,0x6e,0x64,0x29,0x20,0x7b,0x0a,0x62,0x63,0x5b,0x30,0x5d,0x3d,0x73,0x74,0x5b,0x30,0x5d,0x5e,0x73,0x74,0x5b,0x35,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x30,
|
||||||
|
0x5d,0x5e,0x73,0x74,0x5b,0x31,0x35,0x5d,0x5e,0x73,0x74,0x5b,0x32,0x30,0x5d,0x3b,0x0a,0x62,0x63,0x5b,0x31,0x5d,0x3d,0x73,0x74,0x5b,0x31,0x5d,0x5e,0x73,0x74,0x5b,
|
||||||
|
0x36,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x31,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x36,0x5d,0x5e,0x73,0x74,0x5b,0x32,0x31,0x5d,0x3b,0x0a,0x62,0x63,0x5b,0x32,0x5d,0x3d,0x73,
|
||||||
|
0x74,0x5b,0x32,0x5d,0x5e,0x73,0x74,0x5b,0x37,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x32,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x37,0x5d,0x5e,0x73,0x74,0x5b,0x32,0x32,0x5d,0x3b,
|
||||||
|
0x0a,0x62,0x63,0x5b,0x33,0x5d,0x3d,0x73,0x74,0x5b,0x33,0x5d,0x5e,0x73,0x74,0x5b,0x38,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x33,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x38,0x5d,
|
||||||
|
0x5e,0x73,0x74,0x5b,0x32,0x33,0x5d,0x3b,0x0a,0x62,0x63,0x5b,0x34,0x5d,0x3d,0x73,0x74,0x5b,0x34,0x5d,0x5e,0x73,0x74,0x5b,0x39,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x34,
|
||||||
|
0x5d,0x5e,0x73,0x74,0x5b,0x31,0x39,0x5d,0x5e,0x73,0x74,0x5b,0x32,0x34,0x5d,0x3b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,0x6f,0x6c,0x6c,0x20,
|
||||||
|
0x31,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x35,0x3b,0x20,0x2b,0x2b,0x69,0x29,0x20,0x7b,0x0a,0x74,0x3d,0x62,0x63,0x5b,0x28,0x69,0x2b,
|
||||||
|
0x34,0x29,0x20,0x25,0x20,0x35,0x5d,0x5e,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x62,0x63,0x5b,0x28,0x69,0x2b,0x31,0x29,0x20,0x25,0x20,0x35,0x5d,0x2c,0x31,0x55,0x4c,
|
||||||
|
0x29,0x3b,0x0a,0x73,0x74,0x5b,0x69,0x20,0x5d,0x20,0x5e,0x3d,0x20,0x74,0x3b,0x0a,0x73,0x74,0x5b,0x69,0x2b,0x35,0x5d,0x20,0x5e,0x3d,0x20,0x74,0x3b,0x0a,0x73,0x74,
|
||||||
|
0x5b,0x69,0x2b,0x31,0x30,0x5d,0x20,0x5e,0x3d,0x20,0x74,0x3b,0x0a,0x73,0x74,0x5b,0x69,0x2b,0x31,0x35,0x5d,0x20,0x5e,0x3d,0x20,0x74,0x3b,0x0a,0x73,0x74,0x5b,0x69,
|
||||||
|
0x2b,0x32,0x30,0x5d,0x20,0x5e,0x3d,0x20,0x74,0x3b,0x0a,0x7d,0x0a,0x74,0x3d,0x73,0x74,0x5b,0x31,0x5d,0x3b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,
|
||||||
|
0x72,0x6f,0x6c,0x6c,0x20,0x31,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x32,0x34,0x3b,0x20,0x2b,0x2b,0x69,0x29,0x20,0x7b,0x0a,0x62,0x63,
|
||||||
|
0x5b,0x30,0x5d,0x3d,0x73,0x74,0x5b,0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,0x5f,0x70,0x69,0x6c,0x6e,0x5b,0x69,0x5d,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x6b,0x65,0x63,0x63,
|
||||||
|
0x61,0x6b,0x66,0x5f,0x70,0x69,0x6c,0x6e,0x5b,0x69,0x5d,0x5d,0x3d,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x74,0x2c,0x28,0x75,0x6c,0x6f,0x6e,0x67,0x29,0x6b,0x65,0x63,
|
||||||
|
0x63,0x61,0x6b,0x66,0x5f,0x72,0x6f,0x74,0x63,0x5b,0x69,0x5d,0x29,0x3b,0x0a,0x74,0x3d,0x62,0x63,0x5b,0x30,0x5d,0x3b,0x0a,0x7d,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,
|
||||||
|
0x61,0x20,0x75,0x6e,0x72,0x6f,0x6c,0x6c,0x20,0x31,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x32,0x35,0x3b,0x20,0x69,
|
||||||
|
0x2b,0x3d,0x35,0x29,0x20,0x7b,0x0a,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x74,0x6d,0x70,0x5b,0x35,0x5d,0x3b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,
|
||||||
|
0x6f,0x6c,0x6c,0x20,0x31,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x78,0x3d,0x30,0x3b,0x20,0x78,0x3c,0x35,0x3b,0x20,0x2b,0x2b,0x78,0x29,0x20,0x7b,0x0a,
|
||||||
|
0x74,0x6d,0x70,0x5b,0x78,0x5d,0x3d,0x62,0x69,0x74,0x73,0x65,0x6c,0x65,0x63,0x74,0x28,0x73,0x74,0x5b,0x69,0x2b,0x78,0x5d,0x5e,0x73,0x74,0x5b,0x69,0x2b,0x28,0x28,
|
||||||
|
0x78,0x2b,0x32,0x29,0x20,0x25,0x20,0x35,0x29,0x5d,0x2c,0x73,0x74,0x5b,0x69,0x2b,0x78,0x5d,0x2c,0x73,0x74,0x5b,0x69,0x2b,0x28,0x28,0x78,0x2b,0x31,0x29,0x20,0x25,
|
||||||
|
0x20,0x35,0x29,0x5d,0x29,0x3b,0x0a,0x7d,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,0x6f,0x6c,0x6c,0x20,0x31,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,
|
||||||
|
0x6e,0x74,0x20,0x78,0x3d,0x30,0x3b,0x20,0x78,0x3c,0x35,0x3b,0x20,0x2b,0x2b,0x78,0x29,0x20,0x7b,0x0a,0x73,0x74,0x5b,0x69,0x2b,0x78,0x5d,0x3d,0x74,0x6d,0x70,0x5b,
|
||||||
|
0x78,0x5d,0x3b,0x0a,0x7d,0x0a,0x7d,0x0a,0x73,0x74,0x5b,0x30,0x5d,0x20,0x5e,0x3d,0x20,0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,0x5f,0x72,0x6e,0x64,0x63,0x5b,0x72,0x6f,
|
||||||
|
0x75,0x6e,0x64,0x5d,0x3b,0x0a,0x7d,0x0a,0x7d,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,0x31,0x36,0x30,0x30,0x5f,0x32,0x28,0x5f,0x5f,0x6c,
|
||||||
|
0x6f,0x63,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x2a,0x73,0x74,0x29,0x0a,0x7b,0x0a,0x69,0x6e,0x74,0x20,0x69,0x2c,0x72,0x6f,0x75,0x6e,0x64,0x3b,0x0a,0x75,
|
||||||
|
0x6c,0x6f,0x6e,0x67,0x20,0x74,0x2c,0x62,0x63,0x5b,0x35,0x5d,0x3b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,0x6f,0x6c,0x6c,0x20,0x31,0x0a,0x66,
|
||||||
|
0x6f,0x72,0x20,0x28,0x72,0x6f,0x75,0x6e,0x64,0x3d,0x30,0x3b,0x20,0x72,0x6f,0x75,0x6e,0x64,0x3c,0x32,0x34,0x3b,0x20,0x2b,0x2b,0x72,0x6f,0x75,0x6e,0x64,0x29,0x20,
|
||||||
|
0x7b,0x0a,0x62,0x63,0x5b,0x30,0x5d,0x3d,0x73,0x74,0x5b,0x30,0x5d,0x5e,0x73,0x74,0x5b,0x35,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x30,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x35,
|
||||||
|
0x5d,0x5e,0x73,0x74,0x5b,0x32,0x30,0x5d,0x5e,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x73,0x74,0x5b,0x32,0x5d,0x5e,0x73,0x74,0x5b,0x37,0x5d,0x5e,0x73,0x74,0x5b,0x31,
|
||||||
|
0x32,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x37,0x5d,0x5e,0x73,0x74,0x5b,0x32,0x32,0x5d,0x2c,0x31,0x55,0x4c,0x29,0x3b,0x0a,0x62,0x63,0x5b,0x31,0x5d,0x3d,0x73,0x74,0x5b,
|
||||||
|
0x31,0x5d,0x5e,0x73,0x74,0x5b,0x36,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x31,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x36,0x5d,0x5e,0x73,0x74,0x5b,0x32,0x31,0x5d,0x5e,0x72,0x6f,
|
||||||
|
0x74,0x61,0x74,0x65,0x28,0x73,0x74,0x5b,0x33,0x5d,0x5e,0x73,0x74,0x5b,0x38,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x33,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x38,0x5d,0x5e,0x73,
|
||||||
|
0x74,0x5b,0x32,0x33,0x5d,0x2c,0x31,0x55,0x4c,0x29,0x3b,0x0a,0x62,0x63,0x5b,0x32,0x5d,0x3d,0x73,0x74,0x5b,0x32,0x5d,0x5e,0x73,0x74,0x5b,0x37,0x5d,0x5e,0x73,0x74,
|
||||||
|
0x5b,0x31,0x32,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x37,0x5d,0x5e,0x73,0x74,0x5b,0x32,0x32,0x5d,0x5e,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x73,0x74,0x5b,0x34,0x5d,0x5e,
|
||||||
|
0x73,0x74,0x5b,0x39,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x34,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x39,0x5d,0x5e,0x73,0x74,0x5b,0x32,0x34,0x5d,0x2c,0x31,0x55,0x4c,0x29,0x3b,
|
||||||
|
0x0a,0x62,0x63,0x5b,0x33,0x5d,0x3d,0x73,0x74,0x5b,0x33,0x5d,0x5e,0x73,0x74,0x5b,0x38,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x33,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x38,0x5d,
|
||||||
|
0x5e,0x73,0x74,0x5b,0x32,0x33,0x5d,0x5e,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x73,0x74,0x5b,0x30,0x5d,0x5e,0x73,0x74,0x5b,0x35,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x30,
|
||||||
|
0x5d,0x5e,0x73,0x74,0x5b,0x31,0x35,0x5d,0x5e,0x73,0x74,0x5b,0x32,0x30,0x5d,0x2c,0x31,0x55,0x4c,0x29,0x3b,0x0a,0x62,0x63,0x5b,0x34,0x5d,0x3d,0x73,0x74,0x5b,0x34,
|
||||||
|
0x5d,0x5e,0x73,0x74,0x5b,0x39,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x34,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x39,0x5d,0x5e,0x73,0x74,0x5b,0x32,0x34,0x5d,0x5e,0x72,0x6f,0x74,
|
||||||
|
0x61,0x74,0x65,0x28,0x73,0x74,0x5b,0x31,0x5d,0x5e,0x73,0x74,0x5b,0x36,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x31,0x5d,0x5e,0x73,0x74,0x5b,0x31,0x36,0x5d,0x5e,0x73,0x74,
|
||||||
|
0x5b,0x32,0x31,0x5d,0x2c,0x31,0x55,0x4c,0x29,0x3b,0x0a,0x73,0x74,0x5b,0x30,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x34,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x35,0x5d,
|
||||||
|
0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x34,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x31,0x30,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x34,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x31,
|
||||||
|
0x35,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x34,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x32,0x30,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x34,0x5d,0x3b,0x0a,0x73,0x74,
|
||||||
|
0x5b,0x31,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x30,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x36,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x30,0x5d,0x3b,0x0a,0x73,0x74,
|
||||||
|
0x5b,0x31,0x31,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x30,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x31,0x36,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x30,0x5d,0x3b,0x0a,
|
||||||
|
0x73,0x74,0x5b,0x32,0x31,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x30,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x32,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x31,0x5d,0x3b,
|
||||||
|
0x0a,0x73,0x74,0x5b,0x37,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x31,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x31,0x32,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x31,0x5d,
|
||||||
|
0x3b,0x0a,0x73,0x74,0x5b,0x31,0x37,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x31,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x32,0x32,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,
|
||||||
|
0x31,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x33,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x32,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x38,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,
|
||||||
|
0x32,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x31,0x33,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x32,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x31,0x38,0x5d,0x20,0x5e,0x3d,0x20,0x62,
|
||||||
|
0x63,0x5b,0x32,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x32,0x33,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x32,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x34,0x5d,0x20,0x5e,0x3d,0x20,
|
||||||
|
0x62,0x63,0x5b,0x33,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x39,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x33,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x31,0x34,0x5d,0x20,0x5e,0x3d,
|
||||||
|
0x20,0x62,0x63,0x5b,0x33,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x31,0x39,0x5d,0x20,0x5e,0x3d,0x20,0x62,0x63,0x5b,0x33,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x32,0x34,0x5d,0x20,
|
||||||
|
0x5e,0x3d,0x20,0x62,0x63,0x5b,0x33,0x5d,0x3b,0x0a,0x74,0x3d,0x73,0x74,0x5b,0x31,0x5d,0x3b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,0x6f,0x6c,
|
||||||
|
0x6c,0x20,0x31,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x32,0x34,0x3b,0x20,0x2b,0x2b,0x69,0x29,0x20,0x7b,0x0a,0x62,0x63,0x5b,0x30,0x5d,
|
||||||
|
0x3d,0x73,0x74,0x5b,0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,0x5f,0x70,0x69,0x6c,0x6e,0x5b,0x69,0x5d,0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,
|
||||||
|
0x5f,0x70,0x69,0x6c,0x6e,0x5b,0x69,0x5d,0x5d,0x3d,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x74,0x2c,0x28,0x75,0x6c,0x6f,0x6e,0x67,0x29,0x6b,0x65,0x63,0x63,0x61,0x6b,
|
||||||
|
0x66,0x5f,0x72,0x6f,0x74,0x63,0x5b,0x69,0x5d,0x29,0x3b,0x0a,0x74,0x3d,0x62,0x63,0x5b,0x30,0x5d,0x3b,0x0a,0x7d,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,
|
||||||
|
0x6e,0x72,0x6f,0x6c,0x6c,0x20,0x31,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x32,0x35,0x3b,0x20,0x69,0x2b,0x3d,0x35,
|
||||||
|
0x29,0x20,0x7b,0x0a,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x74,0x6d,0x70,0x31,0x3d,0x73,0x74,0x5b,0x69,0x5d,0x2c,0x74,0x6d,0x70,0x32,0x3d,0x73,0x74,0x5b,0x69,0x2b,0x31,
|
||||||
|
0x5d,0x3b,0x0a,0x73,0x74,0x5b,0x69,0x5d,0x3d,0x62,0x69,0x74,0x73,0x65,0x6c,0x65,0x63,0x74,0x28,0x73,0x74,0x5b,0x69,0x5d,0x5e,0x73,0x74,0x5b,0x69,0x2b,0x32,0x5d,
|
||||||
|
0x2c,0x73,0x74,0x5b,0x69,0x5d,0x2c,0x73,0x74,0x5b,0x69,0x2b,0x31,0x5d,0x29,0x3b,0x0a,0x73,0x74,0x5b,0x69,0x2b,0x31,0x5d,0x3d,0x62,0x69,0x74,0x73,0x65,0x6c,0x65,
|
||||||
|
0x63,0x74,0x28,0x73,0x74,0x5b,0x69,0x2b,0x31,0x5d,0x5e,0x73,0x74,0x5b,0x69,0x2b,0x33,0x5d,0x2c,0x73,0x74,0x5b,0x69,0x2b,0x31,0x5d,0x2c,0x73,0x74,0x5b,0x69,0x2b,
|
||||||
|
0x32,0x5d,0x29,0x3b,0x0a,0x73,0x74,0x5b,0x69,0x2b,0x32,0x5d,0x3d,0x62,0x69,0x74,0x73,0x65,0x6c,0x65,0x63,0x74,0x28,0x73,0x74,0x5b,0x69,0x2b,0x32,0x5d,0x5e,0x73,
|
||||||
|
0x74,0x5b,0x69,0x2b,0x34,0x5d,0x2c,0x73,0x74,0x5b,0x69,0x2b,0x32,0x5d,0x2c,0x73,0x74,0x5b,0x69,0x2b,0x33,0x5d,0x29,0x3b,0x0a,0x73,0x74,0x5b,0x69,0x2b,0x33,0x5d,
|
||||||
|
0x3d,0x62,0x69,0x74,0x73,0x65,0x6c,0x65,0x63,0x74,0x28,0x73,0x74,0x5b,0x69,0x2b,0x33,0x5d,0x5e,0x74,0x6d,0x70,0x31,0x2c,0x73,0x74,0x5b,0x69,0x2b,0x33,0x5d,0x2c,
|
||||||
|
0x73,0x74,0x5b,0x69,0x2b,0x34,0x5d,0x29,0x3b,0x0a,0x73,0x74,0x5b,0x69,0x2b,0x34,0x5d,0x3d,0x62,0x69,0x74,0x73,0x65,0x6c,0x65,0x63,0x74,0x28,0x73,0x74,0x5b,0x69,
|
||||||
|
0x2b,0x34,0x5d,0x5e,0x74,0x6d,0x70,0x32,0x2c,0x73,0x74,0x5b,0x69,0x2b,0x34,0x5d,0x2c,0x74,0x6d,0x70,0x31,0x29,0x3b,0x0a,0x7d,0x0a,0x73,0x74,0x5b,0x30,0x5d,0x20,
|
||||||
|
0x5e,0x3d,0x20,0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,0x5f,0x72,0x6e,0x64,0x63,0x5b,0x72,0x6f,0x75,0x6e,0x64,0x5d,0x3b,0x0a,0x7d,0x0a,0x7d,0x0a,0x23,0x65,0x6e,0x64,
|
||||||
|
0x69,0x66,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x65,0x74,0x49,0x64,0x78,0x28,0x29,0x0a,0x7b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,
|
||||||
|
0x20,0x67,0x65,0x74,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x2d,0x67,0x65,0x74,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x5f,0x6f,0x66,0x66,
|
||||||
|
0x73,0x65,0x74,0x28,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x49,0x44,0x58,0x28,0x78,0x29,0x20,0x28,0x78,0x29,0x0a,0x69,0x6e,0x6c,
|
||||||
|
0x69,0x6e,0x65,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x6d,0x6d,0x5f,0x61,0x64,0x64,0x5f,0x70,0x73,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x61,0x2c,0x66,
|
||||||
|
0x6c,0x6f,0x61,0x74,0x34,0x20,0x62,0x29,0x0a,0x7b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x61,0x2b,0x62,0x3b,0x0a,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,
|
||||||
|
0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x6d,0x6d,0x5f,0x73,0x75,0x62,0x5f,0x70,0x73,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x61,0x2c,0x66,0x6c,0x6f,0x61,0x74,
|
||||||
|
0x34,0x20,0x62,0x29,0x0a,0x7b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x61,0x2d,0x62,0x3b,0x0a,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x66,0x6c,0x6f,0x61,
|
||||||
|
0x74,0x34,0x20,0x5f,0x6d,0x6d,0x5f,0x6d,0x75,0x6c,0x5f,0x70,0x73,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x61,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x62,0x29,
|
||||||
|
0x0a,0x7b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x61,0x2a,0x62,0x3b,0x0a,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,
|
||||||
|
0x6d,0x6d,0x5f,0x64,0x69,0x76,0x5f,0x70,0x73,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x61,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x62,0x29,0x0a,0x7b,0x0a,0x72,
|
||||||
|
0x65,0x74,0x75,0x72,0x6e,0x20,0x61,0x2f,0x62,0x3b,0x0a,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x6d,0x6d,0x5f,0x61,
|
||||||
|
0x6e,0x64,0x5f,0x70,0x73,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x61,0x2c,0x69,0x6e,0x74,0x20,0x62,0x29,0x0a,0x7b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x61,
|
||||||
|
0x73,0x5f,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x61,0x73,0x5f,0x69,0x6e,0x74,0x34,0x28,0x61,0x29,0x26,0x28,0x69,0x6e,0x74,0x34,0x29,0x28,0x62,0x29,0x29,0x3b,0x0a,
|
||||||
|
0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x6d,0x6d,0x5f,0x6f,0x72,0x5f,0x70,0x73,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,
|
||||||
|
0x20,0x61,0x2c,0x69,0x6e,0x74,0x20,0x62,0x29,0x0a,0x7b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x61,0x73,0x5f,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x61,0x73,0x5f,
|
||||||
|
0x69,0x6e,0x74,0x34,0x28,0x61,0x29,0x7c,0x28,0x69,0x6e,0x74,0x34,0x29,0x28,0x62,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x66,0x6c,0x6f,
|
||||||
|
0x61,0x74,0x34,0x20,0x5f,0x6d,0x6d,0x5f,0x66,0x6d,0x6f,0x64,0x5f,0x70,0x73,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,
|
||||||
|
0x63,0x29,0x0a,0x7b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x64,0x3d,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x29,0x28,0x64,0x63,0x29,0x3b,0x0a,0x66,0x6c,0x6f,0x61,
|
||||||
|
0x74,0x34,0x20,0x63,0x3d,0x5f,0x6d,0x6d,0x5f,0x64,0x69,0x76,0x5f,0x70,0x73,0x28,0x76,0x2c,0x64,0x29,0x3b,0x0a,0x63,0x3d,0x74,0x72,0x75,0x6e,0x63,0x28,0x63,0x29,
|
||||||
|
0x3b,0x0a,0x63,0x3d,0x5f,0x6d,0x6d,0x5f,0x6d,0x75,0x6c,0x5f,0x70,0x73,0x28,0x63,0x2c,0x64,0x29,0x3b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x5f,0x6d,0x6d,0x5f,
|
||||||
|
0x73,0x75,0x62,0x5f,0x70,0x73,0x28,0x76,0x2c,0x63,0x29,0x3b,0x0a,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x69,0x6e,0x74,0x34,0x20,0x5f,0x6d,0x6d,0x5f,0x78,
|
||||||
|
0x6f,0x72,0x5f,0x73,0x69,0x31,0x32,0x38,0x28,0x69,0x6e,0x74,0x34,0x20,0x61,0x2c,0x69,0x6e,0x74,0x34,0x20,0x62,0x29,0x0a,0x7b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,
|
||||||
|
0x20,0x61,0x5e,0x62,0x3b,0x0a,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x6d,0x6d,0x5f,0x78,0x6f,0x72,0x5f,0x70,0x73,
|
||||||
|
0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x61,0x2c,0x69,0x6e,0x74,0x20,0x62,0x29,0x0a,0x7b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x61,0x73,0x5f,0x66,0x6c,0x6f,
|
||||||
|
0x61,0x74,0x34,0x28,0x61,0x73,0x5f,0x69,0x6e,0x74,0x34,0x28,0x61,0x29,0x5e,0x28,0x69,0x6e,0x74,0x34,0x29,0x28,0x62,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x69,0x6e,0x6c,
|
||||||
|
0x69,0x6e,0x65,0x20,0x69,0x6e,0x74,0x34,0x20,0x5f,0x6d,0x6d,0x5f,0x61,0x6c,0x69,0x67,0x6e,0x72,0x5f,0x65,0x70,0x69,0x38,0x28,0x69,0x6e,0x74,0x34,0x20,0x61,0x2c,
|
||||||
|
0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x72,0x6f,0x74,0x29,0x0a,0x7b,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x72,0x69,0x67,
|
||||||
|
0x68,0x74,0x3d,0x38,0x2a,0x72,0x6f,0x74,0x3b,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x6c,0x65,0x66,0x74,0x3d,0x28,0x33,0x32,0x2d,0x38,0x2a,
|
||||||
|
0x72,0x6f,0x74,0x29,0x3b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x69,0x6e,0x74,0x34,0x29,0x28,0x0a,0x28,0x28,0x75,0x69,0x6e,0x74,0x29,0x61,0x2e,0x78,0x3e,
|
||||||
|
0x3e,0x72,0x69,0x67,0x68,0x74,0x29,0x7c,0x28,0x20,0x61,0x2e,0x79,0x3c,0x3c,0x6c,0x65,0x66,0x74,0x20,0x29,0x2c,0x0a,0x28,0x28,0x75,0x69,0x6e,0x74,0x29,0x61,0x2e,
|
||||||
|
0x79,0x3e,0x3e,0x72,0x69,0x67,0x68,0x74,0x29,0x7c,0x28,0x20,0x61,0x2e,0x7a,0x3c,0x3c,0x6c,0x65,0x66,0x74,0x20,0x29,0x2c,0x0a,0x28,0x28,0x75,0x69,0x6e,0x74,0x29,
|
||||||
|
0x61,0x2e,0x7a,0x3e,0x3e,0x72,0x69,0x67,0x68,0x74,0x29,0x7c,0x28,0x20,0x61,0x2e,0x77,0x3c,0x3c,0x6c,0x65,0x66,0x74,0x20,0x29,0x2c,0x0a,0x28,0x28,0x75,0x69,0x6e,
|
||||||
|
0x74,0x29,0x61,0x2e,0x77,0x3e,0x3e,0x72,0x69,0x67,0x68,0x74,0x29,0x7c,0x28,0x20,0x61,0x2e,0x78,0x3c,0x3c,0x6c,0x65,0x66,0x74,0x20,0x29,0x0a,0x29,0x3b,0x0a,0x7d,
|
||||||
|
0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x34,0x2a,0x20,0x73,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x5f,
|
||||||
|
0x70,0x74,0x72,0x28,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x2c,0x75,0x69,0x6e,0x74,0x20,0x6e,0x2c,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,
|
||||||
|
0x20,0x2a,0x6c,0x70,0x61,0x64,0x29,0x20,0x7b,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x34,0x2a,
|
||||||
|
0x29,0x28,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x63,0x68,0x61,0x72,0x2a,0x29,0x6c,0x70,0x61,0x64,0x2b,0x28,0x69,0x64,0x78,0x26,0x4d,0x41,0x53,0x4b,
|
||||||
|
0x29,0x2b,0x6e,0x2a,0x31,0x36,0x29,0x3b,0x20,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x6d,0x61,0x5f,0x62,0x72,0x65,
|
||||||
|
0x61,0x6b,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x78,0x3d,0x5f,0x6d,0x6d,0x5f,0x61,0x6e,0x64,0x5f,0x70,0x73,0x28,0x78,0x2c,0x30,0x78,
|
||||||
|
0x46,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x29,0x3b,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x5f,0x6d,0x6d,0x5f,0x6f,0x72,0x5f,0x70,0x73,0x28,0x78,0x2c,0x30,0x78,
|
||||||
|
0x30,0x30,0x38,0x30,0x30,0x30,0x30,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x76,0x6f,0x69,0x64,0x20,0x73,0x75,0x62,0x5f,0x72,0x6f,0x75,
|
||||||
|
0x6e,0x64,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x30,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x31,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x32,
|
||||||
|
0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x33,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x72,0x6e,0x64,0x5f,0x63,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x2a,0x20,
|
||||||
|
0x6e,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x2a,0x20,0x64,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x2a,0x20,0x63,0x29,0x0a,0x7b,0x0a,0x6e,0x31,0x3d,0x5f,0x6d,0x6d,0x5f,
|
||||||
|
0x61,0x64,0x64,0x5f,0x70,0x73,0x28,0x6e,0x31,0x2c,0x2a,0x63,0x29,0x3b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x6e,0x3d,0x5f,0x6d,0x6d,0x5f,0x6d,0x75,0x6c,
|
||||||
|
0x5f,0x70,0x73,0x28,0x6e,0x30,0x2c,0x2a,0x63,0x29,0x3b,0x0a,0x6e,0x6e,0x3d,0x5f,0x6d,0x6d,0x5f,0x6d,0x75,0x6c,0x5f,0x70,0x73,0x28,0x6e,0x31,0x2c,0x5f,0x6d,0x6d,
|
||||||
|
0x5f,0x6d,0x75,0x6c,0x5f,0x70,0x73,0x28,0x6e,0x6e,0x2c,0x6e,0x6e,0x29,0x29,0x3b,0x0a,0x6e,0x6e,0x3d,0x66,0x6d,0x61,0x5f,0x62,0x72,0x65,0x61,0x6b,0x28,0x6e,0x6e,
|
||||||
|
0x29,0x3b,0x0a,0x2a,0x6e,0x3d,0x5f,0x6d,0x6d,0x5f,0x61,0x64,0x64,0x5f,0x70,0x73,0x28,0x2a,0x6e,0x2c,0x6e,0x6e,0x29,0x3b,0x0a,0x6e,0x33,0x3d,0x5f,0x6d,0x6d,0x5f,
|
||||||
|
0x73,0x75,0x62,0x5f,0x70,0x73,0x28,0x6e,0x33,0x2c,0x2a,0x63,0x29,0x3b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x64,0x64,0x3d,0x5f,0x6d,0x6d,0x5f,0x6d,0x75,0x6c,
|
||||||
|
0x5f,0x70,0x73,0x28,0x6e,0x32,0x2c,0x2a,0x63,0x29,0x3b,0x0a,0x64,0x64,0x3d,0x5f,0x6d,0x6d,0x5f,0x6d,0x75,0x6c,0x5f,0x70,0x73,0x28,0x6e,0x33,0x2c,0x5f,0x6d,0x6d,
|
||||||
|
0x5f,0x6d,0x75,0x6c,0x5f,0x70,0x73,0x28,0x64,0x64,0x2c,0x64,0x64,0x29,0x29,0x3b,0x0a,0x64,0x64,0x3d,0x66,0x6d,0x61,0x5f,0x62,0x72,0x65,0x61,0x6b,0x28,0x64,0x64,
|
||||||
|
0x29,0x3b,0x0a,0x2a,0x64,0x3d,0x5f,0x6d,0x6d,0x5f,0x61,0x64,0x64,0x5f,0x70,0x73,0x28,0x2a,0x64,0x2c,0x64,0x64,0x29,0x3b,0x0a,0x2a,0x63,0x3d,0x5f,0x6d,0x6d,0x5f,
|
||||||
|
0x61,0x64,0x64,0x5f,0x70,0x73,0x28,0x2a,0x63,0x2c,0x72,0x6e,0x64,0x5f,0x63,0x29,0x3b,0x0a,0x2a,0x63,0x3d,0x5f,0x6d,0x6d,0x5f,0x61,0x64,0x64,0x5f,0x70,0x73,0x28,
|
||||||
|
0x2a,0x63,0x2c,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x29,0x28,0x30,0x2e,0x37,0x33,0x34,0x33,0x37,0x35,0x66,0x29,0x29,0x3b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
|
||||||
|
0x72,0x3d,0x5f,0x6d,0x6d,0x5f,0x61,0x64,0x64,0x5f,0x70,0x73,0x28,0x6e,0x6e,0x2c,0x64,0x64,0x29,0x3b,0x0a,0x72,0x3d,0x5f,0x6d,0x6d,0x5f,0x61,0x6e,0x64,0x5f,0x70,
|
||||||
|
0x73,0x28,0x72,0x2c,0x30,0x78,0x38,0x30,0x37,0x46,0x46,0x46,0x46,0x46,0x29,0x3b,0x0a,0x72,0x3d,0x5f,0x6d,0x6d,0x5f,0x6f,0x72,0x5f,0x70,0x73,0x28,0x72,0x2c,0x30,
|
||||||
|
0x78,0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x29,0x3b,0x0a,0x2a,0x63,0x3d,0x5f,0x6d,0x6d,0x5f,0x61,0x64,0x64,0x5f,0x70,0x73,0x28,0x2a,0x63,0x2c,0x72,0x29,0x3b,
|
||||||
|
0x0a,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x76,0x6f,0x69,0x64,0x20,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x28,0x66,0x6c,0x6f,
|
||||||
|
0x61,0x74,0x34,0x20,0x6e,0x30,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x31,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x32,0x2c,0x66,0x6c,0x6f,0x61,0x74,
|
||||||
|
0x34,0x20,0x6e,0x33,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x72,0x6e,0x64,0x5f,0x63,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x2a,0x20,0x63,0x2c,0x66,0x6c,0x6f,0x61,
|
||||||
|
0x74,0x34,0x2a,0x20,0x72,0x29,0x0a,0x7b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x3d,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x29,0x28,0x30,0x2e,0x30,0x66,0x29,
|
||||||
|
0x3b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x64,0x3d,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x29,0x28,0x30,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x73,0x75,0x62,0x5f,0x72,
|
||||||
|
0x6f,0x75,0x6e,0x64,0x28,0x6e,0x30,0x2c,0x6e,0x31,0x2c,0x6e,0x32,0x2c,0x6e,0x33,0x2c,0x72,0x6e,0x64,0x5f,0x63,0x2c,0x26,0x6e,0x2c,0x26,0x64,0x2c,0x63,0x29,0x3b,
|
||||||
|
0x0a,0x73,0x75,0x62,0x5f,0x72,0x6f,0x75,0x6e,0x64,0x28,0x6e,0x31,0x2c,0x6e,0x32,0x2c,0x6e,0x33,0x2c,0x6e,0x30,0x2c,0x72,0x6e,0x64,0x5f,0x63,0x2c,0x26,0x6e,0x2c,
|
||||||
|
0x26,0x64,0x2c,0x63,0x29,0x3b,0x0a,0x73,0x75,0x62,0x5f,0x72,0x6f,0x75,0x6e,0x64,0x28,0x6e,0x32,0x2c,0x6e,0x33,0x2c,0x6e,0x30,0x2c,0x6e,0x31,0x2c,0x72,0x6e,0x64,
|
||||||
|
0x5f,0x63,0x2c,0x26,0x6e,0x2c,0x26,0x64,0x2c,0x63,0x29,0x3b,0x0a,0x73,0x75,0x62,0x5f,0x72,0x6f,0x75,0x6e,0x64,0x28,0x6e,0x33,0x2c,0x6e,0x30,0x2c,0x6e,0x31,0x2c,
|
||||||
|
0x6e,0x32,0x2c,0x72,0x6e,0x64,0x5f,0x63,0x2c,0x26,0x6e,0x2c,0x26,0x64,0x2c,0x63,0x29,0x3b,0x0a,0x73,0x75,0x62,0x5f,0x72,0x6f,0x75,0x6e,0x64,0x28,0x6e,0x33,0x2c,
|
||||||
|
0x6e,0x32,0x2c,0x6e,0x31,0x2c,0x6e,0x30,0x2c,0x72,0x6e,0x64,0x5f,0x63,0x2c,0x26,0x6e,0x2c,0x26,0x64,0x2c,0x63,0x29,0x3b,0x0a,0x73,0x75,0x62,0x5f,0x72,0x6f,0x75,
|
||||||
|
0x6e,0x64,0x28,0x6e,0x32,0x2c,0x6e,0x31,0x2c,0x6e,0x30,0x2c,0x6e,0x33,0x2c,0x72,0x6e,0x64,0x5f,0x63,0x2c,0x26,0x6e,0x2c,0x26,0x64,0x2c,0x63,0x29,0x3b,0x0a,0x73,
|
||||||
|
0x75,0x62,0x5f,0x72,0x6f,0x75,0x6e,0x64,0x28,0x6e,0x31,0x2c,0x6e,0x30,0x2c,0x6e,0x33,0x2c,0x6e,0x32,0x2c,0x72,0x6e,0x64,0x5f,0x63,0x2c,0x26,0x6e,0x2c,0x26,0x64,
|
||||||
|
0x2c,0x63,0x29,0x3b,0x0a,0x73,0x75,0x62,0x5f,0x72,0x6f,0x75,0x6e,0x64,0x28,0x6e,0x30,0x2c,0x6e,0x33,0x2c,0x6e,0x32,0x2c,0x6e,0x31,0x2c,0x72,0x6e,0x64,0x5f,0x63,
|
||||||
|
0x2c,0x26,0x6e,0x2c,0x26,0x64,0x2c,0x63,0x29,0x3b,0x0a,0x64,0x3d,0x5f,0x6d,0x6d,0x5f,0x61,0x6e,0x64,0x5f,0x70,0x73,0x28,0x64,0x2c,0x30,0x78,0x46,0x46,0x37,0x46,
|
||||||
|
0x46,0x46,0x46,0x46,0x29,0x3b,0x0a,0x64,0x3d,0x5f,0x6d,0x6d,0x5f,0x6f,0x72,0x5f,0x70,0x73,0x28,0x64,0x2c,0x30,0x78,0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x29,
|
||||||
|
0x3b,0x0a,0x2a,0x72,0x20,0x3d,0x5f,0x6d,0x6d,0x5f,0x61,0x64,0x64,0x5f,0x70,0x73,0x28,0x2a,0x72,0x2c,0x5f,0x6d,0x6d,0x5f,0x64,0x69,0x76,0x5f,0x70,0x73,0x28,0x6e,
|
||||||
|
0x2c,0x64,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x69,0x6e,0x74,0x34,0x20,0x73,0x69,0x6e,0x67,0x6c,0x65,0x5f,0x63,0x6f,0x6d,0x70,0x75,
|
||||||
|
0x74,0x65,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x30,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x31,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x32,
|
||||||
|
0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x33,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63,0x6e,0x74,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x72,0x6e,0x64,0x5f,
|
||||||
|
0x63,0x2c,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x2a,0x20,0x73,0x75,0x6d,0x29,0x0a,0x7b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
|
||||||
|
0x63,0x3d,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x29,0x28,0x63,0x6e,0x74,0x29,0x3b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x72,0x3d,0x28,0x66,0x6c,0x6f,0x61,
|
||||||
|
0x74,0x34,0x29,0x28,0x30,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x34,0x3b,0x20,0x2b,0x2b,
|
||||||
|
0x69,0x29,0x20,0x7b,0x0a,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x28,0x6e,0x30,0x2c,0x6e,0x31,0x2c,0x6e,0x32,0x2c,0x6e,0x33,0x2c,0x72,
|
||||||
|
0x6e,0x64,0x5f,0x63,0x2c,0x26,0x63,0x2c,0x26,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x72,0x3d,0x5f,0x6d,0x6d,0x5f,0x61,0x6e,0x64,0x5f,0x70,0x73,0x28,0x72,0x2c,0x30,0x78,
|
||||||
|
0x38,0x30,0x37,0x46,0x46,0x46,0x46,0x46,0x29,0x3b,0x0a,0x72,0x3d,0x5f,0x6d,0x6d,0x5f,0x6f,0x72,0x5f,0x70,0x73,0x28,0x72,0x2c,0x30,0x78,0x34,0x30,0x30,0x30,0x30,
|
||||||
|
0x30,0x30,0x30,0x29,0x3b,0x0a,0x2a,0x73,0x75,0x6d,0x3d,0x72,0x3b,0x20,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x78,0x3d,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x29,
|
||||||
|
0x28,0x35,0x33,0x36,0x38,0x37,0x30,0x38,0x38,0x30,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x72,0x3d,0x5f,0x6d,0x6d,0x5f,0x6d,0x75,0x6c,0x5f,0x70,0x73,0x28,0x72,0x2c,0x78,
|
||||||
|
0x29,0x3b,0x20,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x63,0x6f,0x6e,0x76,0x65,0x72,0x74,0x5f,0x69,0x6e,0x74,0x34,0x5f,0x72,0x74,0x65,0x28,0x72,0x29,0x3b,0x0a,
|
||||||
|
0x7d,0x0a,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x76,0x6f,0x69,0x64,0x20,0x73,0x69,0x6e,0x67,0x6c,0x65,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x5f,0x77,0x72,0x61,
|
||||||
|
0x70,0x28,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x72,0x6f,0x74,0x2c,0x69,0x6e,0x74,0x34,0x20,0x76,0x30,0x2c,0x69,0x6e,0x74,0x34,0x20,0x76,0x31,
|
||||||
|
0x2c,0x69,0x6e,0x74,0x34,0x20,0x76,0x32,0x2c,0x69,0x6e,0x74,0x34,0x20,0x76,0x33,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63,0x6e,0x74,0x2c,0x66,0x6c,0x6f,0x61,0x74,
|
||||||
|
0x34,0x20,0x72,0x6e,0x64,0x5f,0x63,0x2c,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x2a,0x20,0x73,0x75,0x6d,0x2c,0x5f,0x5f,0x6c,0x6f,
|
||||||
|
0x63,0x61,0x6c,0x20,0x69,0x6e,0x74,0x34,0x2a,0x20,0x6f,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x30,0x3d,0x63,0x6f,0x6e,0x76,0x65,
|
||||||
|
0x72,0x74,0x5f,0x66,0x6c,0x6f,0x61,0x74,0x34,0x5f,0x72,0x74,0x65,0x28,0x76,0x30,0x29,0x3b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x31,0x3d,0x63,0x6f,0x6e,
|
||||||
|
0x76,0x65,0x72,0x74,0x5f,0x66,0x6c,0x6f,0x61,0x74,0x34,0x5f,0x72,0x74,0x65,0x28,0x76,0x31,0x29,0x3b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x32,0x3d,0x63,
|
||||||
|
0x6f,0x6e,0x76,0x65,0x72,0x74,0x5f,0x66,0x6c,0x6f,0x61,0x74,0x34,0x5f,0x72,0x74,0x65,0x28,0x76,0x32,0x29,0x3b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x33,
|
||||||
|
0x3d,0x63,0x6f,0x6e,0x76,0x65,0x72,0x74,0x5f,0x66,0x6c,0x6f,0x61,0x74,0x34,0x5f,0x72,0x74,0x65,0x28,0x76,0x33,0x29,0x3b,0x0a,0x69,0x6e,0x74,0x34,0x20,0x72,0x3d,
|
||||||
|
0x73,0x69,0x6e,0x67,0x6c,0x65,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x28,0x6e,0x30,0x2c,0x6e,0x31,0x2c,0x6e,0x32,0x2c,0x6e,0x33,0x2c,0x63,0x6e,0x74,0x2c,0x72,
|
||||||
|
0x6e,0x64,0x5f,0x63,0x2c,0x73,0x75,0x6d,0x29,0x3b,0x0a,0x2a,0x6f,0x75,0x74,0x3d,0x72,0x6f,0x74,0x3d,0x3d,0x30,0x3f,0x72,0x3a,0x5f,0x6d,0x6d,0x5f,0x61,0x6c,0x69,
|
||||||
|
0x67,0x6e,0x72,0x5f,0x65,0x70,0x69,0x38,0x28,0x72,0x2c,0x72,0x6f,0x74,0x29,0x3b,0x0a,0x7d,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,
|
||||||
|
0x5f,0x5f,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x6c,0x6f,0x6f,0x6b,0x5b,0x31,0x36,0x5d,0x5b,0x34,0x5d,0x3d,0x7b,0x0a,0x7b,0x30,
|
||||||
|
0x2c,0x31,0x2c,0x32,0x2c,0x33,0x7d,0x2c,0x0a,0x7b,0x30,0x2c,0x32,0x2c,0x33,0x2c,0x31,0x7d,0x2c,0x0a,0x7b,0x30,0x2c,0x33,0x2c,0x31,0x2c,0x32,0x7d,0x2c,0x0a,0x7b,
|
||||||
|
0x30,0x2c,0x33,0x2c,0x32,0x2c,0x31,0x7d,0x2c,0x0a,0x7b,0x31,0x2c,0x30,0x2c,0x32,0x2c,0x33,0x7d,0x2c,0x0a,0x7b,0x31,0x2c,0x32,0x2c,0x33,0x2c,0x30,0x7d,0x2c,0x0a,
|
||||||
|
0x7b,0x31,0x2c,0x33,0x2c,0x30,0x2c,0x32,0x7d,0x2c,0x0a,0x7b,0x31,0x2c,0x33,0x2c,0x32,0x2c,0x30,0x7d,0x2c,0x0a,0x7b,0x32,0x2c,0x31,0x2c,0x30,0x2c,0x33,0x7d,0x2c,
|
||||||
|
0x0a,0x7b,0x32,0x2c,0x30,0x2c,0x33,0x2c,0x31,0x7d,0x2c,0x0a,0x7b,0x32,0x2c,0x33,0x2c,0x31,0x2c,0x30,0x7d,0x2c,0x0a,0x7b,0x32,0x2c,0x33,0x2c,0x30,0x2c,0x31,0x7d,
|
||||||
|
0x2c,0x0a,0x7b,0x33,0x2c,0x31,0x2c,0x32,0x2c,0x30,0x7d,0x2c,0x0a,0x7b,0x33,0x2c,0x32,0x2c,0x30,0x2c,0x31,0x7d,0x2c,0x0a,0x7b,0x33,0x2c,0x30,0x2c,0x31,0x2c,0x32,
|
||||||
|
0x7d,0x2c,0x0a,0x7b,0x33,0x2c,0x30,0x2c,0x32,0x2c,0x31,0x7d,0x0a,0x7d,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x63,
|
||||||
|
0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63,0x63,0x6e,0x74,0x5b,0x31,0x36,0x5d,0x3d,0x7b,0x0a,0x31,0x2e,0x33,0x34,0x33,0x37,0x35,
|
||||||
|
0x66,0x2c,0x0a,0x31,0x2e,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x33,0x35,0x39,0x33,0x37,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x33,0x36,0x37,0x31,0x38,0x37,
|
||||||
|
0x35,0x66,0x2c,0x0a,0x31,0x2e,0x34,0x32,0x39,0x36,0x38,0x37,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x33,0x39,0x38,0x34,0x33,0x37,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x33,0x38,
|
||||||
|
0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x33,0x30,0x34,0x36,0x38,0x37,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,0x0a,
|
||||||
|
0x31,0x2e,0x32,0x37,0x33,0x34,0x33,0x37,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x32,0x38,0x39,0x30,0x36,0x32,
|
||||||
|
0x35,0x66,0x2c,0x0a,0x31,0x2e,0x33,0x32,0x30,0x33,0x31,0x32,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x33,0x35,0x31,0x35,0x36,0x32,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x33,0x33,
|
||||||
|
0x35,0x39,0x33,0x37,0x35,0x66,0x2c,0x0a,0x31,0x2e,0x34,0x36,0x30,0x39,0x33,0x37,0x35,0x66,0x0a,0x7d,0x3b,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x68,0x61,
|
||||||
|
0x72,0x65,0x64,0x4d,0x65,0x6d,0x43,0x68,0x75,0x6e,0x6b,0x0a,0x7b,0x0a,0x69,0x6e,0x74,0x34,0x20,0x6f,0x75,0x74,0x5b,0x31,0x36,0x5d,0x3b,0x0a,0x66,0x6c,0x6f,0x61,
|
||||||
|
0x74,0x34,0x20,0x76,0x61,0x5b,0x31,0x36,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x72,0x65,0x71,
|
||||||
|
0x64,0x5f,0x77,0x6f,0x72,0x6b,0x5f,0x67,0x72,0x6f,0x75,0x70,0x5f,0x73,0x69,0x7a,0x65,0x28,0x57,0x4f,0x52,0x4b,0x53,0x49,0x5a,0x45,0x2a,0x31,0x36,0x2c,0x31,0x2c,
|
||||||
|
0x31,0x29,0x29,0x29,0x0a,0x5f,0x5f,0x6b,0x65,0x72,0x6e,0x65,0x6c,0x20,0x76,0x6f,0x69,0x64,0x20,0x63,0x6e,0x31,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,
|
||||||
|
0x69,0x6e,0x74,0x20,0x2a,0x6c,0x70,0x61,0x64,0x5f,0x69,0x6e,0x2c,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x20,0x2a,0x73,0x70,0x61,0x64,0x2c,
|
||||||
|
0x75,0x69,0x6e,0x74,0x20,0x6e,0x75,0x6d,0x54,0x68,0x72,0x65,0x61,0x64,0x73,0x29,0x0a,0x7b,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x49,
|
||||||
|
0x64,0x78,0x3d,0x67,0x65,0x74,0x49,0x64,0x78,0x28,0x29,0x3b,0x0a,0x75,0x69,0x6e,0x74,0x20,0x63,0x68,0x75,0x6e,0x6b,0x3d,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,
|
||||||
|
0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x2f,0x31,0x36,0x3b,0x0a,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x20,0x6c,0x70,0x61,0x64,0x3d,0x28,
|
||||||
|
0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,0x28,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x63,0x68,0x61,0x72,0x2a,0x29,0x6c,
|
||||||
|
0x70,0x61,0x64,0x5f,0x69,0x6e,0x2b,0x4d,0x45,0x4d,0x4f,0x52,0x59,0x2a,0x28,0x67,0x49,0x64,0x78,0x2f,0x31,0x36,0x29,0x29,0x3b,0x0a,0x5f,0x5f,0x6c,0x6f,0x63,0x61,
|
||||||
|
0x6c,0x20,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x68,0x61,0x72,0x65,0x64,0x4d,0x65,0x6d,0x43,0x68,0x75,0x6e,0x6b,0x20,0x73,0x6d,0x65,0x6d,0x5f,0x69,0x6e,0x5b,
|
||||||
|
0x57,0x4f,0x52,0x4b,0x53,0x49,0x5a,0x45,0x5d,0x3b,0x0a,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x68,0x61,0x72,0x65,0x64,
|
||||||
|
0x4d,0x65,0x6d,0x43,0x68,0x75,0x6e,0x6b,0x2a,0x20,0x73,0x6d,0x65,0x6d,0x3d,0x73,0x6d,0x65,0x6d,0x5f,0x69,0x6e,0x2b,0x63,0x68,0x75,0x6e,0x6b,0x3b,0x0a,0x75,0x69,
|
||||||
|
0x6e,0x74,0x20,0x74,0x69,0x64,0x3d,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x20,0x25,0x20,0x31,0x36,0x3b,0x0a,0x75,0x69,0x6e,
|
||||||
|
0x74,0x20,0x69,0x64,0x78,0x48,0x61,0x73,0x68,0x3d,0x67,0x49,0x64,0x78,0x2f,0x31,0x36,0x3b,0x0a,0x75,0x69,0x6e,0x74,0x20,0x73,0x3d,0x28,0x28,0x5f,0x5f,0x67,0x6c,
|
||||||
|
0x6f,0x62,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x2a,0x29,0x73,0x70,0x61,0x64,0x29,0x5b,0x69,0x64,0x78,0x48,0x61,0x73,0x68,0x2a,0x35,0x30,0x5d,0x3e,0x3e,0x38,0x3b,
|
||||||
|
0x0a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x73,0x3d,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x29,0x28,0x30,0x29,0x3b,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,
|
||||||
|
0x6e,0x74,0x20,0x74,0x69,0x64,0x64,0x3d,0x74,0x69,0x64,0x2f,0x34,0x3b,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x74,0x69,0x64,0x6d,0x3d,0x74,
|
||||||
|
0x69,0x64,0x20,0x25,0x20,0x34,0x3b,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x62,0x6c,0x6f,0x63,0x6b,0x3d,0x74,0x69,0x64,0x64,0x2a,0x31,0x36,
|
||||||
|
0x2b,0x74,0x69,0x64,0x6d,0x3b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,0x6f,0x6c,0x6c,0x20,0x43,0x4e,0x5f,0x55,0x4e,0x52,0x4f,0x4c,0x4c,0x0a,
|
||||||
|
0x66,0x6f,0x72,0x20,0x28,0x75,0x69,0x6e,0x74,0x20,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x49,0x54,0x45,0x52,0x41,0x54,0x49,0x4f,0x4e,0x53,0x3b,0x20,0x69,0x2b,0x2b,
|
||||||
|
0x29,0x20,0x7b,0x0a,0x6d,0x65,0x6d,0x5f,0x66,0x65,0x6e,0x63,0x65,0x28,0x43,0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,0x45,0x4e,0x43,
|
||||||
|
0x45,0x29,0x3b,0x0a,0x69,0x6e,0x74,0x20,0x74,0x6d,0x70,0x3d,0x28,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,0x73,0x63,0x72,0x61,
|
||||||
|
0x74,0x63,0x68,0x70,0x61,0x64,0x5f,0x70,0x74,0x72,0x28,0x73,0x2c,0x74,0x69,0x64,0x64,0x2c,0x6c,0x70,0x61,0x64,0x29,0x29,0x5b,0x74,0x69,0x64,0x6d,0x5d,0x3b,0x0a,
|
||||||
|
0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,0x28,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x29,0x29,0x5b,0x74,0x69,0x64,0x5d,
|
||||||
|
0x3d,0x74,0x6d,0x70,0x3b,0x0a,0x6d,0x65,0x6d,0x5f,0x66,0x65,0x6e,0x63,0x65,0x28,0x43,0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,0x45,
|
||||||
|
0x4e,0x43,0x45,0x29,0x3b,0x0a,0x7b,0x0a,0x73,0x69,0x6e,0x67,0x6c,0x65,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x5f,0x77,0x72,0x61,0x70,0x28,0x0a,0x74,0x69,0x64,
|
||||||
|
0x6d,0x2c,0x0a,0x2a,0x28,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x2b,0x6c,0x6f,0x6f,0x6b,0x5b,0x74,0x69,0x64,0x5d,0x5b,0x30,0x5d,0x29,0x2c,0x0a,0x2a,0x28,
|
||||||
|
0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x2b,0x6c,0x6f,0x6f,0x6b,0x5b,0x74,0x69,0x64,0x5d,0x5b,0x31,0x5d,0x29,0x2c,0x0a,0x2a,0x28,0x73,0x6d,0x65,0x6d,0x2d,
|
||||||
|
0x3e,0x6f,0x75,0x74,0x2b,0x6c,0x6f,0x6f,0x6b,0x5b,0x74,0x69,0x64,0x5d,0x5b,0x32,0x5d,0x29,0x2c,0x0a,0x2a,0x28,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x2b,
|
||||||
|
0x6c,0x6f,0x6f,0x6b,0x5b,0x74,0x69,0x64,0x5d,0x5b,0x33,0x5d,0x29,0x2c,0x0a,0x63,0x63,0x6e,0x74,0x5b,0x74,0x69,0x64,0x5d,0x2c,0x76,0x73,0x2c,0x73,0x6d,0x65,0x6d,
|
||||||
|
0x2d,0x3e,0x76,0x61,0x2b,0x74,0x69,0x64,0x2c,0x0a,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x2b,0x74,0x69,0x64,0x0a,0x29,0x3b,0x0a,0x7d,0x0a,0x6d,0x65,0x6d,
|
||||||
|
0x5f,0x66,0x65,0x6e,0x63,0x65,0x28,0x43,0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x69,0x6e,0x74,
|
||||||
|
0x20,0x6f,0x75,0x74,0x58,0x6f,0x72,0x3d,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,
|
||||||
|
0x29,0x5b,0x62,0x6c,0x6f,0x63,0x6b,0x5d,0x3b,0x0a,0x66,0x6f,0x72,0x20,0x28,0x75,0x69,0x6e,0x74,0x20,0x64,0x64,0x3d,0x62,0x6c,0x6f,0x63,0x6b,0x2b,0x34,0x3b,0x20,
|
||||||
|
0x64,0x64,0x3c,0x28,0x74,0x69,0x64,0x64,0x2b,0x31,0x29,0x2a,0x31,0x36,0x3b,0x20,0x64,0x64,0x2b,0x3d,0x34,0x29,0x20,0x7b,0x0a,0x6f,0x75,0x74,0x58,0x6f,0x72,0x20,
|
||||||
|
0x5e,0x3d,0x20,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x29,0x5b,0x64,0x64,0x5d,
|
||||||
|
0x3b,0x0a,0x7d,0x0a,0x28,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,0x73,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x5f,0x70,
|
||||||
|
0x74,0x72,0x28,0x73,0x2c,0x74,0x69,0x64,0x64,0x2c,0x6c,0x70,0x61,0x64,0x29,0x29,0x5b,0x74,0x69,0x64,0x6d,0x5d,0x3d,0x6f,0x75,0x74,0x58,0x6f,0x72,0x5e,0x74,0x6d,
|
||||||
|
0x70,0x3b,0x0a,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x29,0x5b,0x74,0x69,0x64,
|
||||||
|
0x5d,0x3d,0x6f,0x75,0x74,0x58,0x6f,0x72,0x3b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20,0x76,0x61,0x5f,0x74,0x6d,0x70,0x31,0x3d,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,
|
||||||
|
0x6c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x76,0x61,0x29,0x5b,0x62,0x6c,0x6f,0x63,0x6b,0x5d,0x2b,0x28,0x28,0x5f,0x5f,0x6c,0x6f,
|
||||||
|
0x63,0x61,0x6c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x76,0x61,0x29,0x5b,0x62,0x6c,0x6f,0x63,0x6b,0x2b,0x34,0x5d,0x3b,0x0a,0x66,
|
||||||
|
0x6c,0x6f,0x61,0x74,0x20,0x76,0x61,0x5f,0x74,0x6d,0x70,0x32,0x3d,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x2a,0x29,0x73,0x6d,
|
||||||
|
0x65,0x6d,0x2d,0x3e,0x76,0x61,0x29,0x5b,0x62,0x6c,0x6f,0x63,0x6b,0x2b,0x20,0x38,0x5d,0x2b,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x66,0x6c,0x6f,0x61,
|
||||||
|
0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x76,0x61,0x29,0x5b,0x62,0x6c,0x6f,0x63,0x6b,0x2b,0x31,0x32,0x5d,0x3b,0x0a,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,
|
||||||
|
0x6c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x76,0x61,0x29,0x5b,0x74,0x69,0x64,0x5d,0x3d,0x76,0x61,0x5f,0x74,0x6d,0x70,0x31,0x2b,
|
||||||
|
0x76,0x61,0x5f,0x74,0x6d,0x70,0x32,0x3b,0x0a,0x6d,0x65,0x6d,0x5f,0x66,0x65,0x6e,0x63,0x65,0x28,0x43,0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,
|
||||||
|
0x5f,0x46,0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x69,0x6e,0x74,0x20,0x6f,0x75,0x74,0x32,0x3d,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,
|
||||||
|
0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x29,0x5b,0x74,0x69,0x64,0x5d,0x5e,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,
|
||||||
|
0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x29,0x5b,0x74,0x69,0x64,0x2b,0x34,0x20,0x5d,0x5e,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x69,0x6e,0x74,
|
||||||
|
0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x29,0x5b,0x74,0x69,0x64,0x2b,0x38,0x5d,0x5e,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x69,0x6e,
|
||||||
|
0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x29,0x5b,0x74,0x69,0x64,0x2b,0x31,0x32,0x5d,0x3b,0x0a,0x76,0x61,0x5f,0x74,0x6d,0x70,0x31,0x3d,0x28,
|
||||||
|
0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x76,0x61,0x29,0x5b,0x62,0x6c,0x6f,0x63,0x6b,0x5d,
|
||||||
|
0x2b,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x76,0x61,0x29,0x5b,0x62,0x6c,0x6f,0x63,
|
||||||
|
0x6b,0x2b,0x34,0x5d,0x3b,0x0a,0x76,0x61,0x5f,0x74,0x6d,0x70,0x32,0x3d,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x2a,0x29,0x73,
|
||||||
|
0x6d,0x65,0x6d,0x2d,0x3e,0x76,0x61,0x29,0x5b,0x62,0x6c,0x6f,0x63,0x6b,0x2b,0x38,0x5d,0x2b,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x66,0x6c,0x6f,0x61,
|
||||||
|
0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x76,0x61,0x29,0x5b,0x62,0x6c,0x6f,0x63,0x6b,0x2b,0x31,0x32,0x5d,0x3b,0x0a,0x76,0x61,0x5f,0x74,0x6d,0x70,0x31,0x3d,
|
||||||
|
0x76,0x61,0x5f,0x74,0x6d,0x70,0x31,0x2b,0x76,0x61,0x5f,0x74,0x6d,0x70,0x32,0x3b,0x0a,0x76,0x61,0x5f,0x74,0x6d,0x70,0x31,0x3d,0x66,0x61,0x62,0x73,0x28,0x76,0x61,
|
||||||
|
0x5f,0x74,0x6d,0x70,0x31,0x29,0x3b,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20,0x78,0x78,0x3d,0x76,0x61,0x5f,0x74,0x6d,0x70,0x31,0x2a,0x31,0x36,0x37,0x37,0x37,0x32,0x31,
|
||||||
|
0x36,0x2e,0x30,0x66,0x3b,0x0a,0x69,0x6e,0x74,0x20,0x78,0x78,0x5f,0x69,0x6e,0x74,0x3d,0x28,0x69,0x6e,0x74,0x29,0x78,0x78,0x3b,0x0a,0x28,0x28,0x5f,0x5f,0x6c,0x6f,
|
||||||
|
0x63,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x29,0x5b,0x74,0x69,0x64,0x5d,0x3d,0x6f,0x75,0x74,0x32,0x5e,0x78,0x78,
|
||||||
|
0x5f,0x69,0x6e,0x74,0x3b,0x0a,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x2a,0x29,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x76,0x61,0x29,
|
||||||
|
0x5b,0x74,0x69,0x64,0x5d,0x3d,0x76,0x61,0x5f,0x74,0x6d,0x70,0x31,0x2f,0x36,0x34,0x2e,0x30,0x66,0x3b,0x0a,0x6d,0x65,0x6d,0x5f,0x66,0x65,0x6e,0x63,0x65,0x28,0x43,
|
||||||
|
0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x76,0x73,0x3d,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x76,0x61,
|
||||||
|
0x5b,0x30,0x5d,0x3b,0x0a,0x73,0x3d,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x5b,0x30,0x5d,0x2e,0x78,0x5e,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x5b,
|
||||||
|
0x30,0x5d,0x2e,0x79,0x5e,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x5b,0x30,0x5d,0x2e,0x7a,0x5e,0x73,0x6d,0x65,0x6d,0x2d,0x3e,0x6f,0x75,0x74,0x5b,0x30,0x5d,
|
||||||
|
0x2e,0x77,0x3b,0x0a,0x7d,0x0a,0x7d,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x5f,0x5f,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,
|
||||||
|
0x75,0x69,0x6e,0x74,0x20,0x73,0x6b,0x69,0x70,0x5b,0x33,0x5d,0x3d,0x7b,0x0a,0x32,0x30,0x2c,0x32,0x32,0x2c,0x32,0x32,0x0a,0x7d,0x3b,0x0a,0x69,0x6e,0x6c,0x69,0x6e,
|
||||||
|
0x65,0x20,0x76,0x6f,0x69,0x64,0x20,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x5f,0x35,0x31,0x32,0x28,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x2c,0x5f,0x5f,0x6c,
|
||||||
|
0x6f,0x63,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x2a,0x20,0x69,0x6e,0x2c,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x2a,0x20,0x6f,
|
||||||
|
0x75,0x74,0x29,0x0a,0x7b,0x0a,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x68,0x61,0x73,0x68,0x5b,0x32,0x35,0x5d,0x3b,0x0a,0x68,0x61,0x73,0x68,0x5b,0x30,0x5d,0x3d,0x69,0x6e,
|
||||||
|
0x5b,0x30,0x5d,0x5e,0x69,0x64,0x78,0x3b,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x31,0x3b,0x20,0x69,0x3c,0x32,0x35,0x3b,0x20,0x2b,0x2b,0x69,
|
||||||
|
0x29,0x20,0x7b,0x0a,0x68,0x61,0x73,0x68,0x5b,0x69,0x5d,0x3d,0x69,0x6e,0x5b,0x69,0x5d,0x3b,0x0a,0x7d,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x61,0x3d,
|
||||||
|
0x30,0x3b,0x20,0x61,0x3c,0x33,0x3b,0x20,0x2b,0x2b,0x61,0x29,0x20,0x7b,0x0a,0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,0x31,0x36,0x30,0x30,0x5f,0x31,0x28,0x68,0x61,0x73,
|
||||||
|
0x68,0x29,0x3b,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x73,0x6b,0x69,0x70,0x5b,0x61,0x5d,0x3b,0x20,0x2b,0x2b,0x69,
|
||||||
|
0x29,0x20,0x7b,0x0a,0x6f,0x75,0x74,0x5b,0x69,0x5d,0x3d,0x68,0x61,0x73,0x68,0x5b,0x69,0x5d,0x3b,0x0a,0x7d,0x0a,0x6f,0x75,0x74,0x2b,0x3d,0x73,0x6b,0x69,0x70,0x5b,
|
||||||
|
0x61,0x5d,0x3b,0x0a,0x7d,0x0a,0x7d,0x0a,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x72,0x65,0x71,0x64,0x5f,0x77,0x6f,0x72,0x6b,
|
||||||
|
0x5f,0x67,0x72,0x6f,0x75,0x70,0x5f,0x73,0x69,0x7a,0x65,0x28,0x38,0x2c,0x38,0x2c,0x31,0x29,0x29,0x29,0x0a,0x5f,0x5f,0x6b,0x65,0x72,0x6e,0x65,0x6c,0x20,0x76,0x6f,
|
||||||
|
0x69,0x64,0x20,0x63,0x6e,0x30,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x2a,0x69,0x6e,0x70,0x75,0x74,0x2c,0x69,0x6e,0x74,
|
||||||
|
0x20,0x69,0x6e,0x6c,0x65,0x6e,0x2c,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x20,0x2a,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x2c,
|
||||||
|
0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x2a,0x73,0x74,0x61,0x74,0x65,0x73,0x2c,0x75,0x69,0x6e,0x74,0x20,0x54,0x68,0x72,0x65,
|
||||||
|
0x61,0x64,0x73,0x29,0x0a,0x7b,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x49,0x64,0x78,0x3d,0x67,0x65,0x74,0x49,0x64,0x78,0x28,0x29,0x3b,
|
||||||
|
0x0a,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x53,0x74,0x61,0x74,0x65,0x5f,0x62,0x75,0x66,0x5b,0x38,0x2a,0x32,0x35,0x5d,0x3b,0x0a,
|
||||||
|
0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x2a,0x20,0x53,0x74,0x61,0x74,0x65,0x3d,0x53,0x74,0x61,0x74,0x65,0x5f,0x62,0x75,0x66,0x2b,0x67,
|
||||||
|
0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x2a,0x32,0x35,0x3b,0x0a,0x7b,0x0a,0x73,0x74,0x61,0x74,0x65,0x73,0x2b,0x3d,0x32,0x35,0x2a,
|
||||||
|
0x67,0x49,0x64,0x78,0x3b,0x0a,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x3d,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,
|
||||||
|
0x28,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x63,0x68,0x61,0x72,0x2a,0x29,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x2b,0x4d,0x45,0x4d,0x4f,
|
||||||
|
0x52,0x59,0x2a,0x67,0x49,0x64,0x78,0x29,0x3b,0x0a,0x69,0x66,0x28,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x31,0x29,0x3d,0x3d,0x30,0x29,
|
||||||
|
0x20,0x7b,0x0a,0x23,0x69,0x66,0x64,0x65,0x66,0x20,0x5f,0x5f,0x4e,0x56,0x5f,0x43,0x4c,0x5f,0x43,0x5f,0x56,0x45,0x52,0x53,0x49,0x4f,0x4e,0x0a,0x66,0x6f,0x72,0x28,
|
||||||
|
0x75,0x69,0x6e,0x74,0x20,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x38,0x3b,0x20,0x2b,0x2b,0x69,0x29,0x0a,0x53,0x74,0x61,0x74,0x65,0x5b,0x69,0x5d,0x3d,0x69,0x6e,0x70,
|
||||||
|
0x75,0x74,0x5b,0x69,0x5d,0x3b,0x0a,0x23,0x65,0x6c,0x73,0x65,0x0a,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x38,0x20,0x2a,0x29,
|
||||||
|
0x53,0x74,0x61,0x74,0x65,0x29,0x5b,0x30,0x5d,0x3d,0x76,0x6c,0x6f,0x61,0x64,0x38,0x28,0x30,0x2c,0x69,0x6e,0x70,0x75,0x74,0x29,0x3b,0x0a,0x23,0x65,0x6e,0x64,0x69,
|
||||||
|
0x66,0x0a,0x53,0x74,0x61,0x74,0x65,0x5b,0x38,0x5d,0x3d,0x69,0x6e,0x70,0x75,0x74,0x5b,0x38,0x5d,0x3b,0x0a,0x53,0x74,0x61,0x74,0x65,0x5b,0x39,0x5d,0x3d,0x69,0x6e,
|
||||||
|
0x70,0x75,0x74,0x5b,0x39,0x5d,0x3b,0x0a,0x53,0x74,0x61,0x74,0x65,0x5b,0x31,0x30,0x5d,0x3d,0x69,0x6e,0x70,0x75,0x74,0x5b,0x31,0x30,0x5d,0x3b,0x0a,0x28,0x28,0x5f,
|
||||||
|
0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x20,0x2a,0x29,0x53,0x74,0x61,0x74,0x65,0x29,0x5b,0x39,0x5d,0x20,0x26,0x3d,0x20,0x30,0x78,0x30,0x30,0x46,
|
||||||
|
0x46,0x46,0x46,0x46,0x46,0x55,0x3b,0x0a,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x20,0x2a,0x29,0x53,0x74,0x61,0x74,0x65,0x29,0x5b,
|
||||||
|
0x39,0x5d,0x7c,0x3d,0x28,0x28,0x28,0x75,0x69,0x6e,0x74,0x29,0x67,0x65,0x74,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x29,0x26,0x30,0x78,
|
||||||
|
0x46,0x46,0x29,0x3c,0x3c,0x32,0x34,0x3b,0x0a,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x20,0x2a,0x29,0x53,0x74,0x61,0x74,0x65,0x29,
|
||||||
|
0x5b,0x31,0x30,0x5d,0x20,0x26,0x3d,0x20,0x30,0x78,0x46,0x46,0x30,0x30,0x30,0x30,0x30,0x30,0x55,0x3b,0x0a,0x28,0x28,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,
|
||||||
|
0x69,0x6e,0x74,0x20,0x2a,0x29,0x53,0x74,0x61,0x74,0x65,0x29,0x5b,0x31,0x30,0x5d,0x7c,0x3d,0x28,0x28,0x28,0x75,0x69,0x6e,0x74,0x29,0x67,0x65,0x74,0x5f,0x67,0x6c,
|
||||||
|
0x6f,0x62,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x3e,0x3e,0x38,0x29,0x29,0x3b,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x31,0x31,0x3b,0x20,
|
||||||
|
0x69,0x3c,0x32,0x35,0x3b,0x20,0x2b,0x2b,0x69,0x29,0x20,0x7b,0x0a,0x53,0x74,0x61,0x74,0x65,0x5b,0x69,0x5d,0x3d,0x30,0x78,0x30,0x30,0x55,0x4c,0x3b,0x0a,0x7d,0x0a,
|
||||||
|
0x53,0x74,0x61,0x74,0x65,0x5b,0x31,0x36,0x5d,0x3d,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x55,0x4c,0x3b,0x0a,
|
||||||
|
0x6b,0x65,0x63,0x63,0x61,0x6b,0x66,0x31,0x36,0x30,0x30,0x5f,0x32,0x28,0x53,0x74,0x61,0x74,0x65,0x29,0x3b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,
|
||||||
|
0x72,0x6f,0x6c,0x6c,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x32,0x35,0x3b,0x20,0x2b,0x2b,0x69,0x29,0x20,0x7b,0x0a,
|
||||||
|
0x73,0x74,0x61,0x74,0x65,0x73,0x5b,0x69,0x5d,0x3d,0x53,0x74,0x61,0x74,0x65,0x5b,0x69,0x5d,0x3b,0x0a,0x7d,0x0a,0x7d,0x0a,0x7d,0x0a,0x7d,0x0a,0x5f,0x5f,0x61,0x74,
|
||||||
|
0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x72,0x65,0x71,0x64,0x5f,0x77,0x6f,0x72,0x6b,0x5f,0x67,0x72,0x6f,0x75,0x70,0x5f,0x73,0x69,0x7a,0x65,0x28,
|
||||||
|
0x36,0x34,0x2c,0x31,0x2c,0x31,0x29,0x29,0x29,0x0a,0x5f,0x5f,0x6b,0x65,0x72,0x6e,0x65,0x6c,0x20,0x76,0x6f,0x69,0x64,0x20,0x63,0x6e,0x30,0x30,0x28,0x5f,0x5f,0x67,
|
||||||
|
0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x20,0x2a,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x2c,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x75,
|
||||||
|
0x6c,0x6f,0x6e,0x67,0x20,0x2a,0x73,0x74,0x61,0x74,0x65,0x73,0x29,0x0a,0x7b,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x49,0x64,0x78,0x3d,
|
||||||
|
0x67,0x65,0x74,0x49,0x64,0x78,0x28,0x29,0x2f,0x36,0x34,0x3b,0x0a,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x53,0x74,0x61,0x74,0x65,
|
||||||
|
0x5b,0x32,0x35,0x5d,0x3b,0x0a,0x73,0x74,0x61,0x74,0x65,0x73,0x2b,0x3d,0x32,0x35,0x2a,0x67,0x49,0x64,0x78,0x3b,0x0a,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,
|
||||||
|
0x64,0x3d,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x69,0x6e,0x74,0x2a,0x29,0x28,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x63,0x68,0x61,0x72,
|
||||||
|
0x2a,0x29,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x2b,0x4d,0x45,0x4d,0x4f,0x52,0x59,0x2a,0x67,0x49,0x64,0x78,0x29,0x3b,0x0a,0x66,0x6f,0x72,0x20,0x28,
|
||||||
|
0x69,0x6e,0x74,0x20,0x69,0x3d,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x3b,0x20,0x69,0x3c,0x32,0x35,0x3b,0x20,0x69,0x2b,0x3d,
|
||||||
|
0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x73,0x69,0x7a,0x65,0x28,0x30,0x29,0x29,0x20,0x7b,0x0a,0x53,0x74,0x61,0x74,0x65,0x5b,0x69,0x5d,0x3d,0x73,0x74,
|
||||||
|
0x61,0x74,0x65,0x73,0x5b,0x69,0x5d,0x3b,0x0a,0x7d,0x0a,0x62,0x61,0x72,0x72,0x69,0x65,0x72,0x28,0x43,0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,
|
||||||
|
0x5f,0x46,0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x66,0x6f,0x72,0x20,0x28,0x75,0x69,0x6e,0x74,0x20,0x69,0x3d,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,
|
||||||
|
0x64,0x28,0x30,0x29,0x3b,0x20,0x69,0x3c,0x4d,0x45,0x4d,0x4f,0x52,0x59,0x2f,0x35,0x31,0x32,0x3b,0x20,0x69,0x2b,0x3d,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,
|
||||||
|
0x5f,0x73,0x69,0x7a,0x65,0x28,0x30,0x29,0x29,0x20,0x7b,0x0a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x5f,0x35,0x31,0x32,0x28,0x69,0x2c,0x53,0x74,0x61,0x74,0x65,
|
||||||
|
0x2c,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x2a,0x29,0x28,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x75,0x63,0x68,
|
||||||
|
0x61,0x72,0x2a,0x29,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x2b,0x69,0x2a,0x35,0x31,0x32,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x7d,0x0a,0x5f,0x5f,0x61,0x74,
|
||||||
|
0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x72,0x65,0x71,0x64,0x5f,0x77,0x6f,0x72,0x6b,0x5f,0x67,0x72,0x6f,0x75,0x70,0x5f,0x73,0x69,0x7a,0x65,0x28,
|
||||||
|
0x38,0x2c,0x38,0x2c,0x31,0x29,0x29,0x29,0x0a,0x5f,0x5f,0x6b,0x65,0x72,0x6e,0x65,0x6c,0x20,0x76,0x6f,0x69,0x64,0x20,0x63,0x6e,0x32,0x28,0x5f,0x5f,0x67,0x6c,0x6f,
|
||||||
|
0x62,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x34,0x20,0x2a,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x2c,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x75,
|
||||||
|
0x6c,0x6f,0x6e,0x67,0x20,0x2a,0x73,0x74,0x61,0x74,0x65,0x73,0x2c,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x20,0x2a,0x6f,0x75,0x74,0x70,
|
||||||
|
0x75,0x74,0x2c,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x54,0x61,0x72,0x67,0x65,0x74,0x2c,0x75,0x69,0x6e,0x74,0x20,0x54,0x68,0x72,0x65,0x61,0x64,0x73,0x29,0x0a,0x7b,0x0a,
|
||||||
|
0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x20,0x41,0x45,0x53,0x30,0x5b,0x32,0x35,0x36,0x5d,0x2c,0x41,0x45,0x53,0x31,0x5b,0x32,0x35,0x36,0x5d,
|
||||||
|
0x2c,0x41,0x45,0x53,0x32,0x5b,0x32,0x35,0x36,0x5d,0x2c,0x41,0x45,0x53,0x33,0x5b,0x32,0x35,0x36,0x5d,0x3b,0x0a,0x75,0x69,0x6e,0x74,0x20,0x45,0x78,0x70,0x61,0x6e,
|
||||||
|
0x64,0x65,0x64,0x4b,0x65,0x79,0x32,0x5b,0x34,0x30,0x5d,0x3b,0x0a,0x75,0x69,0x6e,0x74,0x34,0x20,0x74,0x65,0x78,0x74,0x3b,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,
|
||||||
|
0x69,0x6e,0x74,0x20,0x67,0x49,0x64,0x78,0x3d,0x67,0x65,0x74,0x49,0x64,0x78,0x28,0x29,0x3b,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x67,0x65,
|
||||||
|
0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x31,0x29,0x2a,0x38,0x2b,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x3b,
|
||||||
|
0x20,0x69,0x3c,0x32,0x35,0x36,0x3b,0x20,0x69,0x2b,0x3d,0x38,0x2a,0x38,0x29,0x20,0x7b,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x74,0x6d,0x70,
|
||||||
|
0x3d,0x41,0x45,0x53,0x30,0x5f,0x43,0x5b,0x69,0x5d,0x3b,0x0a,0x41,0x45,0x53,0x30,0x5b,0x69,0x5d,0x3d,0x74,0x6d,0x70,0x3b,0x0a,0x41,0x45,0x53,0x31,0x5b,0x69,0x5d,
|
||||||
|
0x3d,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x74,0x6d,0x70,0x2c,0x38,0x55,0x29,0x3b,0x0a,0x41,0x45,0x53,0x32,0x5b,0x69,0x5d,0x3d,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,
|
||||||
|
0x74,0x6d,0x70,0x2c,0x31,0x36,0x55,0x29,0x3b,0x0a,0x41,0x45,0x53,0x33,0x5b,0x69,0x5d,0x3d,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x74,0x6d,0x70,0x2c,0x32,0x34,0x55,
|
||||||
|
0x29,0x3b,0x0a,0x7d,0x0a,0x62,0x61,0x72,0x72,0x69,0x65,0x72,0x28,0x43,0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,0x45,0x4e,0x43,0x45,
|
||||||
|
0x29,0x3b,0x0a,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x34,0x20,0x78,0x69,0x6e,0x31,0x5b,0x38,0x5d,0x5b,0x38,0x5d,0x3b,0x0a,0x5f,0x5f,0x6c,
|
||||||
|
0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x34,0x20,0x78,0x69,0x6e,0x32,0x5b,0x38,0x5d,0x5b,0x38,0x5d,0x3b,0x0a,0x7b,0x0a,0x73,0x74,0x61,0x74,0x65,0x73,0x2b,
|
||||||
|
0x3d,0x32,0x35,0x2a,0x67,0x49,0x64,0x78,0x3b,0x0a,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x2b,0x3d,0x67,0x49,0x64,0x78,0x2a,0x28,0x4d,0x45,0x4d,0x4f,
|
||||||
|
0x52,0x59,0x3e,0x3e,0x34,0x29,0x3b,0x0a,0x23,0x69,0x66,0x20,0x64,0x65,0x66,0x69,0x6e,0x65,0x64,0x28,0x5f,0x5f,0x54,0x61,0x68,0x69,0x74,0x69,0x5f,0x5f,0x29,0x20,
|
||||||
|
0x7c,0x7c,0x20,0x64,0x65,0x66,0x69,0x6e,0x65,0x64,0x28,0x5f,0x5f,0x50,0x69,0x74,0x63,0x61,0x69,0x72,0x6e,0x5f,0x5f,0x29,0x0a,0x66,0x6f,0x72,0x28,0x69,0x6e,0x74,
|
||||||
|
0x20,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x34,0x3b,0x20,0x2b,0x2b,0x69,0x29,0x20,0x28,0x28,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x2a,0x29,0x45,0x78,0x70,0x61,0x6e,0x64,
|
||||||
|
0x65,0x64,0x4b,0x65,0x79,0x32,0x29,0x5b,0x69,0x5d,0x3d,0x73,0x74,0x61,0x74,0x65,0x73,0x5b,0x69,0x2b,0x34,0x5d,0x3b,0x0a,0x74,0x65,0x78,0x74,0x3d,0x76,0x6c,0x6f,
|
||||||
|
0x61,0x64,0x34,0x28,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x31,0x29,0x2b,0x34,0x2c,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,
|
||||||
|
0x75,0x69,0x6e,0x74,0x20,0x2a,0x29,0x73,0x74,0x61,0x74,0x65,0x73,0x29,0x3b,0x0a,0x23,0x65,0x6c,0x73,0x65,0x0a,0x74,0x65,0x78,0x74,0x3d,0x76,0x6c,0x6f,0x61,0x64,
|
||||||
|
0x34,0x28,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x31,0x29,0x2b,0x34,0x2c,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x75,0x69,
|
||||||
|
0x6e,0x74,0x20,0x2a,0x29,0x73,0x74,0x61,0x74,0x65,0x73,0x29,0x3b,0x0a,0x28,0x28,0x75,0x69,0x6e,0x74,0x38,0x20,0x2a,0x29,0x45,0x78,0x70,0x61,0x6e,0x64,0x65,0x64,
|
||||||
|
0x4b,0x65,0x79,0x32,0x29,0x5b,0x30,0x5d,0x3d,0x76,0x6c,0x6f,0x61,0x64,0x38,0x28,0x31,0x2c,0x28,0x5f,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,
|
||||||
|
0x20,0x2a,0x29,0x73,0x74,0x61,0x74,0x65,0x73,0x29,0x3b,0x0a,0x23,0x65,0x6e,0x64,0x69,0x66,0x0a,0x41,0x45,0x53,0x45,0x78,0x70,0x61,0x6e,0x64,0x4b,0x65,0x79,0x32,
|
||||||
|
0x35,0x36,0x28,0x45,0x78,0x70,0x61,0x6e,0x64,0x65,0x64,0x4b,0x65,0x79,0x32,0x29,0x3b,0x0a,0x7d,0x0a,0x62,0x61,0x72,0x72,0x69,0x65,0x72,0x28,0x43,0x4c,0x4b,0x5f,
|
||||||
|
0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x34,0x2a,
|
||||||
|
0x20,0x78,0x69,0x6e,0x31,0x5f,0x73,0x74,0x6f,0x72,0x65,0x3d,0x26,0x78,0x69,0x6e,0x31,0x5b,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x31,
|
||||||
|
0x29,0x5d,0x5b,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x5d,0x3b,0x0a,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,
|
||||||
|
0x74,0x34,0x2a,0x20,0x78,0x69,0x6e,0x31,0x5f,0x6c,0x6f,0x61,0x64,0x3d,0x26,0x78,0x69,0x6e,0x31,0x5b,0x28,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,
|
||||||
|
0x64,0x28,0x31,0x29,0x2b,0x31,0x29,0x20,0x25,0x20,0x38,0x5d,0x5b,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x5d,0x3b,0x0a,0x5f,
|
||||||
|
0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x34,0x2a,0x20,0x78,0x69,0x6e,0x32,0x5f,0x73,0x74,0x6f,0x72,0x65,0x3d,0x26,0x78,0x69,0x6e,0x32,0x5b,0x67,
|
||||||
|
0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x31,0x29,0x5d,0x5b,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x5d,
|
||||||
|
0x3b,0x0a,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x69,0x6e,0x74,0x34,0x2a,0x20,0x78,0x69,0x6e,0x32,0x5f,0x6c,0x6f,0x61,0x64,0x3d,0x26,0x78,0x69,0x6e,0x32,
|
||||||
|
0x5b,0x28,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x31,0x29,0x2b,0x31,0x29,0x20,0x25,0x20,0x38,0x5d,0x5b,0x67,0x65,0x74,0x5f,0x6c,0x6f,
|
||||||
|
0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x5d,0x3b,0x0a,0x2a,0x78,0x69,0x6e,0x32,0x5f,0x73,0x74,0x6f,0x72,0x65,0x3d,0x28,0x75,0x69,0x6e,0x74,0x34,0x29,0x28,
|
||||||
|
0x30,0x2c,0x30,0x2c,0x30,0x2c,0x30,0x29,0x3b,0x0a,0x7b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,0x6f,0x6c,0x6c,0x20,0x32,0x0a,0x66,0x6f,0x72,
|
||||||
|
0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x30,0x2c,0x69,0x31,0x3d,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x31,0x29,0x3b,0x20,0x69,0x3c,
|
||||||
|
0x28,0x4d,0x45,0x4d,0x4f,0x52,0x59,0x3e,0x3e,0x37,0x29,0x3b,0x20,0x2b,0x2b,0x69,0x2c,0x69,0x31,0x3d,0x28,0x69,0x31,0x2b,0x31,0x36,0x29,0x20,0x25,0x20,0x28,0x4d,
|
||||||
|
0x45,0x4d,0x4f,0x52,0x59,0x3e,0x3e,0x34,0x29,0x29,0x20,0x7b,0x0a,0x74,0x65,0x78,0x74,0x20,0x5e,0x3d,0x20,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x5b,
|
||||||
|
0x28,0x75,0x69,0x6e,0x74,0x29,0x69,0x31,0x5d,0x3b,0x0a,0x62,0x61,0x72,0x72,0x69,0x65,0x72,0x28,0x43,0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,
|
||||||
|
0x5f,0x46,0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x74,0x65,0x78,0x74,0x20,0x5e,0x3d,0x20,0x2a,0x78,0x69,0x6e,0x32,0x5f,0x6c,0x6f,0x61,0x64,0x3b,0x0a,0x23,0x70,0x72,
|
||||||
|
0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,0x6f,0x6c,0x6c,0x20,0x31,0x30,0x0a,0x66,0x6f,0x72,0x28,0x69,0x6e,0x74,0x20,0x6a,0x3d,0x30,0x3b,0x20,0x6a,0x3c,0x31,0x30,
|
||||||
|
0x3b,0x20,0x2b,0x2b,0x6a,0x29,0x0a,0x74,0x65,0x78,0x74,0x3d,0x41,0x45,0x53,0x5f,0x52,0x6f,0x75,0x6e,0x64,0x28,0x41,0x45,0x53,0x30,0x2c,0x41,0x45,0x53,0x31,0x2c,
|
||||||
|
0x41,0x45,0x53,0x32,0x2c,0x41,0x45,0x53,0x33,0x2c,0x74,0x65,0x78,0x74,0x2c,0x28,0x28,0x75,0x69,0x6e,0x74,0x34,0x20,0x2a,0x29,0x45,0x78,0x70,0x61,0x6e,0x64,0x65,
|
||||||
|
0x64,0x4b,0x65,0x79,0x32,0x29,0x5b,0x6a,0x5d,0x29,0x3b,0x0a,0x2a,0x78,0x69,0x6e,0x31,0x5f,0x73,0x74,0x6f,0x72,0x65,0x3d,0x74,0x65,0x78,0x74,0x3b,0x0a,0x74,0x65,
|
||||||
|
0x78,0x74,0x20,0x5e,0x3d,0x20,0x53,0x63,0x72,0x61,0x74,0x63,0x68,0x70,0x61,0x64,0x5b,0x28,0x75,0x69,0x6e,0x74,0x29,0x69,0x31,0x2b,0x38,0x75,0x5d,0x3b,0x0a,0x62,
|
||||||
|
0x61,0x72,0x72,0x69,0x65,0x72,0x28,0x43,0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x74,0x65,0x78,
|
||||||
|
0x74,0x20,0x5e,0x3d,0x20,0x2a,0x78,0x69,0x6e,0x31,0x5f,0x6c,0x6f,0x61,0x64,0x3b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,0x6f,0x6c,0x6c,0x20,
|
||||||
|
0x31,0x30,0x0a,0x66,0x6f,0x72,0x28,0x69,0x6e,0x74,0x20,0x6a,0x3d,0x30,0x3b,0x20,0x6a,0x3c,0x31,0x30,0x3b,0x20,0x2b,0x2b,0x6a,0x29,0x0a,0x74,0x65,0x78,0x74,0x3d,
|
||||||
|
0x41,0x45,0x53,0x5f,0x52,0x6f,0x75,0x6e,0x64,0x28,0x41,0x45,0x53,0x30,0x2c,0x41,0x45,0x53,0x31,0x2c,0x41,0x45,0x53,0x32,0x2c,0x41,0x45,0x53,0x33,0x2c,0x74,0x65,
|
||||||
|
0x78,0x74,0x2c,0x28,0x28,0x75,0x69,0x6e,0x74,0x34,0x20,0x2a,0x29,0x45,0x78,0x70,0x61,0x6e,0x64,0x65,0x64,0x4b,0x65,0x79,0x32,0x29,0x5b,0x6a,0x5d,0x29,0x3b,0x0a,
|
||||||
|
0x2a,0x78,0x69,0x6e,0x32,0x5f,0x73,0x74,0x6f,0x72,0x65,0x3d,0x74,0x65,0x78,0x74,0x3b,0x0a,0x7d,0x0a,0x62,0x61,0x72,0x72,0x69,0x65,0x72,0x28,0x43,0x4c,0x4b,0x5f,
|
||||||
|
0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x74,0x65,0x78,0x74,0x20,0x5e,0x3d,0x20,0x2a,0x78,0x69,0x6e,0x32,0x5f,
|
||||||
|
0x6c,0x6f,0x61,0x64,0x3b,0x0a,0x7d,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,0x6e,0x72,0x6f,0x6c,0x6c,0x20,0x31,0x36,0x0a,0x66,0x6f,0x72,0x28,0x73,0x69,
|
||||||
|
0x7a,0x65,0x5f,0x74,0x20,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x31,0x36,0x3b,0x20,0x69,0x2b,0x2b,0x29,0x0a,0x7b,0x0a,0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x75,
|
||||||
|
0x6e,0x72,0x6f,0x6c,0x6c,0x20,0x31,0x30,0x0a,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x6a,0x3d,0x30,0x3b,0x20,0x6a,0x3c,0x31,0x30,0x3b,0x20,0x2b,0x2b,0x6a,
|
||||||
|
0x29,0x20,0x7b,0x0a,0x74,0x65,0x78,0x74,0x3d,0x41,0x45,0x53,0x5f,0x52,0x6f,0x75,0x6e,0x64,0x28,0x41,0x45,0x53,0x30,0x2c,0x41,0x45,0x53,0x31,0x2c,0x41,0x45,0x53,
|
||||||
|
0x32,0x2c,0x41,0x45,0x53,0x33,0x2c,0x74,0x65,0x78,0x74,0x2c,0x28,0x28,0x75,0x69,0x6e,0x74,0x34,0x20,0x2a,0x29,0x45,0x78,0x70,0x61,0x6e,0x64,0x65,0x64,0x4b,0x65,
|
||||||
|
0x79,0x32,0x29,0x5b,0x6a,0x5d,0x29,0x3b,0x0a,0x7d,0x0a,0x62,0x61,0x72,0x72,0x69,0x65,0x72,0x28,0x43,0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,
|
||||||
|
0x5f,0x46,0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x2a,0x78,0x69,0x6e,0x31,0x5f,0x73,0x74,0x6f,0x72,0x65,0x3d,0x74,0x65,0x78,0x74,0x3b,0x0a,0x62,0x61,0x72,0x72,0x69,
|
||||||
|
0x65,0x72,0x28,0x43,0x4c,0x4b,0x5f,0x4c,0x4f,0x43,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x74,0x65,0x78,0x74,0x20,0x5e,0x3d,
|
||||||
|
0x20,0x2a,0x78,0x69,0x6e,0x31,0x5f,0x6c,0x6f,0x61,0x64,0x3b,0x0a,0x7d,0x0a,0x5f,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x53,0x74,0x61,
|
||||||
|
0x74,0x65,0x5f,0x62,0x75,0x66,0x5b,0x38,0x2a,0x32,0x35,0x5d,0x3b,0x0a,0x7b,0x0a,0x76,0x73,0x74,0x6f,0x72,0x65,0x32,0x28,0x61,0x73,0x5f,0x75,0x6c,0x6f,0x6e,0x67,
|
||||||
|
0x32,0x28,0x74,0x65,0x78,0x74,0x29,0x2c,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x31,0x29,0x2b,0x34,0x2c,0x73,0x74,0x61,0x74,0x65,0x73,
|
||||||
|
0x29,0x3b,0x0a,0x7d,0x0a,0x62,0x61,0x72,0x72,0x69,0x65,0x72,0x28,0x43,0x4c,0x4b,0x5f,0x47,0x4c,0x4f,0x42,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,0x45,0x4e,0x43,
|
||||||
|
0x45,0x29,0x3b,0x0a,0x7b,0x0a,0x69,0x66,0x28,0x21,0x67,0x65,0x74,0x5f,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x31,0x29,0x29,0x0a,0x7b,0x0a,0x5f,0x5f,0x6c,
|
||||||
|
0x6f,0x63,0x61,0x6c,0x20,0x75,0x6c,0x6f,0x6e,0x67,0x2a,0x20,0x53,0x74,0x61,0x74,0x65,0x3d,0x53,0x74,0x61,0x74,0x65,0x5f,0x62,0x75,0x66,0x2b,0x67,0x65,0x74,0x5f,
|
||||||
|
0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x2a,0x32,0x35,0x3b,0x0a,0x66,0x6f,0x72,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x30,0x3b,0x20,0x69,0x3c,0x32,
|
||||||
|
0x35,0x3b,0x20,0x2b,0x2b,0x69,0x29,0x20,0x53,0x74,0x61,0x74,0x65,0x5b,0x69,0x5d,0x3d,0x73,0x74,0x61,0x74,0x65,0x73,0x5b,0x69,0x5d,0x3b,0x0a,0x6b,0x65,0x63,0x63,
|
||||||
|
0x61,0x6b,0x66,0x31,0x36,0x30,0x30,0x5f,0x32,0x28,0x53,0x74,0x61,0x74,0x65,0x29,0x3b,0x0a,0x69,0x66,0x28,0x53,0x74,0x61,0x74,0x65,0x5b,0x33,0x5d,0x3c,0x3d,0x54,
|
||||||
|
0x61,0x72,0x67,0x65,0x74,0x29,0x0a,0x7b,0x0a,0x75,0x6c,0x6f,0x6e,0x67,0x20,0x6f,0x75,0x74,0x49,0x64,0x78,0x3d,0x61,0x74,0x6f,0x6d,0x69,0x63,0x5f,0x69,0x6e,0x63,
|
||||||
|
0x28,0x6f,0x75,0x74,0x70,0x75,0x74,0x2b,0x30,0x78,0x46,0x46,0x29,0x3b,0x0a,0x69,0x66,0x28,0x6f,0x75,0x74,0x49,0x64,0x78,0x3c,0x30,0x78,0x46,0x46,0x29,0x0a,0x6f,
|
||||||
|
0x75,0x74,0x70,0x75,0x74,0x5b,0x6f,0x75,0x74,0x49,0x64,0x78,0x5d,0x3d,0x67,0x65,0x74,0x5f,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x5f,0x69,0x64,0x28,0x30,0x29,0x3b,0x0a,
|
||||||
|
0x7d,0x0a,0x7d,0x0a,0x7d,0x0a,0x6d,0x65,0x6d,0x5f,0x66,0x65,0x6e,0x63,0x65,0x28,0x43,0x4c,0x4b,0x5f,0x47,0x4c,0x4f,0x42,0x41,0x4c,0x5f,0x4d,0x45,0x4d,0x5f,0x46,
|
||||||
|
0x45,0x4e,0x43,0x45,0x29,0x3b,0x0a,0x7d,0x0a,0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
@@ -4,8 +4,10 @@
|
|||||||
#include "randomx_constants_monero.h"
|
#include "randomx_constants_monero.h"
|
||||||
#elif (ALGO == ALGO_RX_WOW)
|
#elif (ALGO == ALGO_RX_WOW)
|
||||||
#include "randomx_constants_wow.h"
|
#include "randomx_constants_wow.h"
|
||||||
#elif (ALGO == ALGO_RX_ARQMA)
|
#elif (ALGO == ALGO_RX_ARQ)
|
||||||
#include "randomx_constants_arqma.h"
|
#include "randomx_constants_arqma.h"
|
||||||
|
#elif (ALGO == ALGO_RX_XEQ)
|
||||||
|
#include "randomx_constants_equilibria.h"
|
||||||
#elif (ALGO == ALGO_RX_KEVA)
|
#elif (ALGO == ALGO_RX_KEVA)
|
||||||
#include "randomx_constants_keva.h"
|
#include "randomx_constants_keva.h"
|
||||||
#elif (ALGO == ALGO_RX_GRAFT)
|
#elif (ALGO == ALGO_RX_GRAFT)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
96
src/backend/opencl/cl/rx/randomx_constants_equilibria.h
Normal file
96
src/backend/opencl/cl/rx/randomx_constants_equilibria.h
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019 SChernykh
|
||||||
|
|
||||||
|
This file is part of RandomX OpenCL.
|
||||||
|
|
||||||
|
RandomX OpenCL is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
RandomX OpenCL is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with RandomX OpenCL. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//Dataset base size in bytes. Must be a power of 2.
|
||||||
|
#define RANDOMX_DATASET_BASE_SIZE 2147483648
|
||||||
|
|
||||||
|
//Dataset extra size. Must be divisible by 64.
|
||||||
|
#define RANDOMX_DATASET_EXTRA_SIZE 33554368
|
||||||
|
|
||||||
|
//Scratchpad L3 size in bytes. Must be a power of 2.
|
||||||
|
#define RANDOMX_SCRATCHPAD_L3 262144
|
||||||
|
|
||||||
|
//Scratchpad L2 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L3.
|
||||||
|
#define RANDOMX_SCRATCHPAD_L2 131072
|
||||||
|
|
||||||
|
//Scratchpad L1 size in bytes. Must be a power of two (minimum 64) and less than or equal to RANDOMX_SCRATCHPAD_L2.
|
||||||
|
#define RANDOMX_SCRATCHPAD_L1 16384
|
||||||
|
|
||||||
|
//Jump condition mask size in bits.
|
||||||
|
#define RANDOMX_JUMP_BITS 8
|
||||||
|
|
||||||
|
//Jump condition mask offset in bits. The sum of RANDOMX_JUMP_BITS and RANDOMX_JUMP_OFFSET must not exceed 16.
|
||||||
|
#define RANDOMX_JUMP_OFFSET 8
|
||||||
|
|
||||||
|
//Integer instructions
|
||||||
|
#define RANDOMX_FREQ_IADD_RS 16
|
||||||
|
#define RANDOMX_FREQ_IADD_M 7
|
||||||
|
#define RANDOMX_FREQ_ISUB_R 16
|
||||||
|
#define RANDOMX_FREQ_ISUB_M 7
|
||||||
|
#define RANDOMX_FREQ_IMUL_R 16
|
||||||
|
#define RANDOMX_FREQ_IMUL_M 4
|
||||||
|
#define RANDOMX_FREQ_IMULH_R 4
|
||||||
|
#define RANDOMX_FREQ_IMULH_M 1
|
||||||
|
#define RANDOMX_FREQ_ISMULH_R 4
|
||||||
|
#define RANDOMX_FREQ_ISMULH_M 1
|
||||||
|
#define RANDOMX_FREQ_IMUL_RCP 8
|
||||||
|
#define RANDOMX_FREQ_INEG_R 2
|
||||||
|
#define RANDOMX_FREQ_IXOR_R 15
|
||||||
|
#define RANDOMX_FREQ_IXOR_M 5
|
||||||
|
#define RANDOMX_FREQ_IROR_R 8
|
||||||
|
#define RANDOMX_FREQ_IROL_R 2
|
||||||
|
#define RANDOMX_FREQ_ISWAP_R 4
|
||||||
|
|
||||||
|
//Floating point instructions
|
||||||
|
#define RANDOMX_FREQ_FSWAP_R 4
|
||||||
|
#define RANDOMX_FREQ_FADD_R 16
|
||||||
|
#define RANDOMX_FREQ_FADD_M 5
|
||||||
|
#define RANDOMX_FREQ_FSUB_R 16
|
||||||
|
#define RANDOMX_FREQ_FSUB_M 5
|
||||||
|
#define RANDOMX_FREQ_FSCAL_R 6
|
||||||
|
#define RANDOMX_FREQ_FMUL_R 32
|
||||||
|
#define RANDOMX_FREQ_FDIV_M 4
|
||||||
|
#define RANDOMX_FREQ_FSQRT_R 6
|
||||||
|
|
||||||
|
//Control instructions
|
||||||
|
#define RANDOMX_FREQ_CBRANCH 25
|
||||||
|
#define RANDOMX_FREQ_CFROUND 1
|
||||||
|
|
||||||
|
//Store instruction
|
||||||
|
#define RANDOMX_FREQ_ISTORE 16
|
||||||
|
|
||||||
|
//No-op instruction
|
||||||
|
#define RANDOMX_FREQ_NOP 0
|
||||||
|
|
||||||
|
#define RANDOMX_DATASET_ITEM_SIZE 64
|
||||||
|
|
||||||
|
#define RANDOMX_PROGRAM_SIZE 256
|
||||||
|
|
||||||
|
#define HASH_SIZE 64
|
||||||
|
#define ENTROPY_SIZE (128 + RANDOMX_PROGRAM_SIZE * 8)
|
||||||
|
#define REGISTERS_SIZE 256
|
||||||
|
#define IMM_BUF_SIZE (RANDOMX_PROGRAM_SIZE * 4 - REGISTERS_SIZE)
|
||||||
|
#define IMM_INDEX_COUNT ((IMM_BUF_SIZE / 4) - 2)
|
||||||
|
#define VM_STATE_SIZE (REGISTERS_SIZE + IMM_BUF_SIZE + RANDOMX_PROGRAM_SIZE * 4)
|
||||||
|
#define ROUNDING_MODE (RANDOMX_FREQ_CFROUND ? -1 : 0)
|
||||||
|
|
||||||
|
// Scratchpad L1/L2/L3 bits
|
||||||
|
#define LOC_L1 (32 - 14)
|
||||||
|
#define LOC_L2 (32 - 17)
|
||||||
|
#define LOC_L3 (32 - 18)
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "backend/opencl/OclThreads.h"
|
||||||
|
#include "backend/opencl/wrappers/OclDevice.h"
|
||||||
|
#include "base/crypto/Algorithm.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
constexpr const size_t oneMiB = 1024u * 1024u;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool ocl_generic_cn_gpu_generator(const OclDevice &device, const Algorithm &algorithm, OclThreads &threads)
|
||||||
|
{
|
||||||
|
if (algorithm != Algorithm::CN_GPU) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t worksize = 8;
|
||||||
|
uint32_t numThreads = 1u;
|
||||||
|
size_t minFreeMem = 128u * oneMiB;
|
||||||
|
|
||||||
|
if (device.type() == OclDevice::Vega_10 || device.type() == OclDevice::Vega_20) {
|
||||||
|
minFreeMem = oneMiB;
|
||||||
|
worksize = 16;
|
||||||
|
}
|
||||||
|
else if (device.type() == OclDevice::Navi_10) {
|
||||||
|
numThreads = 2u;
|
||||||
|
}
|
||||||
|
else if (device.name() == "Fiji") {
|
||||||
|
worksize = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t maxThreads = device.computeUnits() * 6 * 8;
|
||||||
|
|
||||||
|
const size_t maxAvailableFreeMem = device.freeMemSize() - minFreeMem;
|
||||||
|
const size_t memPerThread = std::min(device.maxMemAllocSize(), maxAvailableFreeMem);
|
||||||
|
|
||||||
|
size_t memPerHash = algorithm.l3() + 240u;
|
||||||
|
size_t maxIntensity = memPerThread / memPerHash;
|
||||||
|
size_t possibleIntensity = std::min(maxThreads, maxIntensity);
|
||||||
|
size_t intensity = 0;
|
||||||
|
size_t cuUtilization = ((possibleIntensity * 100) / (worksize * device.computeUnits())) % 100;
|
||||||
|
|
||||||
|
if (cuUtilization >= 75) {
|
||||||
|
intensity = (possibleIntensity / worksize) * worksize;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
intensity = (possibleIntensity / (worksize * device.computeUnits())) * device.computeUnits() * worksize;
|
||||||
|
}
|
||||||
|
|
||||||
|
threads.add(OclThread(device.index(), intensity, worksize, numThreads, 1));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
44
src/backend/opencl/kernels/Cn00RyoKernel.cpp
Normal file
44
src/backend/opencl/kernels/Cn00RyoKernel.cpp
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "backend/opencl/kernels/Cn00RyoKernel.h"
|
||||||
|
#include "backend/opencl/wrappers/OclLib.h"
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Cn00RyoKernel::enqueue(cl_command_queue queue, size_t threads)
|
||||||
|
{
|
||||||
|
const size_t gthreads = threads * 64;
|
||||||
|
const size_t lthreads = 64;
|
||||||
|
|
||||||
|
enqueueNDRange(queue, 1, nullptr, >hreads, <hreads);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// __kernel void cn00(__global int *Scratchpad, __global ulong *states)
|
||||||
|
void xmrig::Cn00RyoKernel::setArgs(cl_mem scratchpads, cl_mem states)
|
||||||
|
{
|
||||||
|
setArg(0, sizeof(cl_mem), &scratchpads);
|
||||||
|
setArg(1, sizeof(cl_mem), &states);
|
||||||
|
}
|
||||||
48
src/backend/opencl/kernels/Cn00RyoKernel.h
Normal file
48
src/backend/opencl/kernels/Cn00RyoKernel.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XMRIG_CN00RYOKERNEL_H
|
||||||
|
#define XMRIG_CN00RYOKERNEL_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "backend/opencl/wrappers/OclKernel.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
class Cn00RyoKernel : public OclKernel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline Cn00RyoKernel(cl_program program) : OclKernel(program, "cn00") {}
|
||||||
|
|
||||||
|
void enqueue(cl_command_queue queue, size_t threads);
|
||||||
|
void setArgs(cl_mem scratchpads, cl_mem states);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* XMRIG_CN00RYOKERNEL_H */
|
||||||
48
src/backend/opencl/kernels/Cn1RyoKernel.cpp
Normal file
48
src/backend/opencl/kernels/Cn1RyoKernel.cpp
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
#include "backend/opencl/kernels/Cn1RyoKernel.h"
|
||||||
|
#include "backend/opencl/wrappers/OclLib.h"
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Cn1RyoKernel::enqueue(cl_command_queue queue, size_t threads, size_t worksize)
|
||||||
|
{
|
||||||
|
const size_t gthreads = threads * 16;
|
||||||
|
const size_t lthreads = worksize * 16;
|
||||||
|
|
||||||
|
enqueueNDRange(queue, 1, nullptr, >hreads, <hreads);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// __kernel void cn1(__global int *lpad_in, __global int *spad, uint numThreads)
|
||||||
|
void xmrig::Cn1RyoKernel::setArgs(cl_mem scratchpads, cl_mem states, uint32_t threads)
|
||||||
|
{
|
||||||
|
setArg(0, sizeof(cl_mem), &scratchpads);
|
||||||
|
setArg(1, sizeof(cl_mem), &states);
|
||||||
|
setArg(2, sizeof(uint32_t), &threads);
|
||||||
|
}
|
||||||
48
src/backend/opencl/kernels/Cn1RyoKernel.h
Normal file
48
src/backend/opencl/kernels/Cn1RyoKernel.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XMRIG_CN1RYOKERNEL_H
|
||||||
|
#define XMRIG_CN1RYOKERNEL_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "backend/opencl/wrappers/OclKernel.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
class Cn1RyoKernel : public OclKernel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline Cn1RyoKernel(cl_program program) : OclKernel(program, "cn1") {}
|
||||||
|
|
||||||
|
void enqueue(cl_command_queue queue, size_t threads, size_t worksize);
|
||||||
|
void setArgs(cl_mem scratchpads, cl_mem states, uint32_t threads);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* XMRIG_CN1RYOKERNEL_H */
|
||||||
53
src/backend/opencl/kernels/Cn2RyoKernel.cpp
Normal file
53
src/backend/opencl/kernels/Cn2RyoKernel.cpp
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "backend/opencl/kernels/Cn2RyoKernel.h"
|
||||||
|
#include "backend/opencl/wrappers/OclLib.h"
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Cn2RyoKernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads)
|
||||||
|
{
|
||||||
|
const size_t offset[2] = { nonce, 1 };
|
||||||
|
const size_t gthreads[2] = { threads, 8 };
|
||||||
|
static const size_t lthreads[2] = { 8, 8 };
|
||||||
|
|
||||||
|
enqueueNDRange(queue, 2, offset, gthreads, lthreads);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// __kernel void cn2(__global uint4 *Scratchpad, __global ulong *states, __global uint *output, ulong Target, uint Threads)
|
||||||
|
void xmrig::Cn2RyoKernel::setArgs(cl_mem scratchpads, cl_mem states, cl_mem output, uint32_t threads)
|
||||||
|
{
|
||||||
|
setArg(0, sizeof(cl_mem), &scratchpads);
|
||||||
|
setArg(1, sizeof(cl_mem), &states);
|
||||||
|
setArg(2, sizeof(cl_mem), &output);
|
||||||
|
setArg(4, sizeof(uint32_t), &threads);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Cn2RyoKernel::setTarget(uint64_t target)
|
||||||
|
{
|
||||||
|
setArg(3, sizeof(cl_ulong), &target);
|
||||||
|
}
|
||||||
49
src/backend/opencl/kernels/Cn2RyoKernel.h
Normal file
49
src/backend/opencl/kernels/Cn2RyoKernel.h
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XMRIG_CN2RYOKERNEL_H
|
||||||
|
#define XMRIG_CN2RYOKERNEL_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "backend/opencl/wrappers/OclKernel.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
class Cn2RyoKernel : public OclKernel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline Cn2RyoKernel(cl_program program) : OclKernel(program, "cn2") {}
|
||||||
|
|
||||||
|
void enqueue(cl_command_queue queue, uint32_t nonce, size_t threads);
|
||||||
|
void setArgs(cl_mem scratchpads, cl_mem states, cl_mem output, uint32_t threads);
|
||||||
|
void setTarget(uint64_t target);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* XMRIG_CN2RYOKERNEL_H */
|
||||||
@@ -127,6 +127,23 @@ if (WITH_OPENCL)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WITH_CN_GPU AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
list(APPEND HEADERS_BACKEND_OPENCL
|
||||||
|
src/backend/opencl/kernels/Cn00RyoKernel.h
|
||||||
|
src/backend/opencl/kernels/Cn1RyoKernel.h
|
||||||
|
src/backend/opencl/kernels/Cn2RyoKernel.h
|
||||||
|
src/backend/opencl/runners/OclRyoRunner.h
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND SOURCES_BACKEND_OPENCL
|
||||||
|
src/backend/opencl/generators/ocl_generic_cn_gpu_generator.cpp
|
||||||
|
src/backend/opencl/kernels/Cn00RyoKernel.cpp
|
||||||
|
src/backend/opencl/kernels/Cn1RyoKernel.cpp
|
||||||
|
src/backend/opencl/kernels/Cn2RyoKernel.cpp
|
||||||
|
src/backend/opencl/runners/OclRyoRunner.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (WITH_STRICT_CACHE)
|
if (WITH_STRICT_CACHE)
|
||||||
add_definitions(/DXMRIG_STRICT_OPENCL_CACHE)
|
add_definitions(/DXMRIG_STRICT_OPENCL_CACHE)
|
||||||
else()
|
else()
|
||||||
|
|||||||
129
src/backend/opencl/runners/OclRyoRunner.cpp
Normal file
129
src/backend/opencl/runners/OclRyoRunner.cpp
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "backend/opencl/runners/OclRyoRunner.h"
|
||||||
|
#include "backend/opencl/kernels/Cn00RyoKernel.h"
|
||||||
|
#include "backend/opencl/kernels/Cn0Kernel.h"
|
||||||
|
#include "backend/opencl/kernels/Cn1RyoKernel.h"
|
||||||
|
#include "backend/opencl/kernels/Cn2RyoKernel.h"
|
||||||
|
#include "backend/opencl/kernels/CnBranchKernel.h"
|
||||||
|
#include "backend/opencl/OclLaunchData.h"
|
||||||
|
#include "backend/opencl/wrappers/OclLib.h"
|
||||||
|
#include "base/io/log/Log.h"
|
||||||
|
#include "base/net/stratum/Job.h"
|
||||||
|
#include "crypto/cn/CnAlgo.h"
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
|
||||||
|
xmrig::OclRyoRunner::OclRyoRunner(size_t index, const OclLaunchData &data) : OclBaseRunner(index, data)
|
||||||
|
{
|
||||||
|
m_options += " -DITERATIONS=" + std::to_string(CnAlgo<>::iterations(m_algorithm)) + "U";
|
||||||
|
m_options += " -DMASK=" + std::to_string(CnAlgo<>::mask(m_algorithm)) + "U";
|
||||||
|
m_options += " -DWORKSIZE=" + std::to_string(data.thread.worksize()) + "U";
|
||||||
|
m_options += " -DMEMORY=" + std::to_string(m_algorithm.l3()) + "LU";
|
||||||
|
m_options += " -DCN_UNROLL=" + std::to_string(data.thread.unrollFactor());
|
||||||
|
|
||||||
|
m_options += " -cl-fp32-correctly-rounded-divide-sqrt";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
xmrig::OclRyoRunner::~OclRyoRunner()
|
||||||
|
{
|
||||||
|
delete m_cn00;
|
||||||
|
delete m_cn0;
|
||||||
|
delete m_cn1;
|
||||||
|
delete m_cn2;
|
||||||
|
|
||||||
|
OclLib::release(m_scratchpads);
|
||||||
|
OclLib::release(m_states);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t xmrig::OclRyoRunner::bufferSize() const
|
||||||
|
{
|
||||||
|
return OclBaseRunner::bufferSize() + align(data().algorithm.l3() * m_intensity) + align(200 * m_intensity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::OclRyoRunner::run(uint32_t nonce, uint32_t *hashOutput)
|
||||||
|
{
|
||||||
|
static const cl_uint zero = 0;
|
||||||
|
|
||||||
|
const size_t w_size = data().thread.worksize();
|
||||||
|
const size_t g_thd = ((m_intensity + w_size - 1u) / w_size) * w_size;
|
||||||
|
|
||||||
|
assert(g_thd % w_size == 0);
|
||||||
|
|
||||||
|
enqueueWriteBuffer(m_output, CL_FALSE, sizeof(cl_uint) * 0xFF, sizeof(cl_uint), &zero);
|
||||||
|
|
||||||
|
m_cn0->enqueue(m_queue, nonce, g_thd);
|
||||||
|
m_cn00->enqueue(m_queue, g_thd);
|
||||||
|
m_cn1->enqueue(m_queue, g_thd, w_size);
|
||||||
|
m_cn2->enqueue(m_queue, nonce, g_thd);
|
||||||
|
|
||||||
|
finalize(hashOutput);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::OclRyoRunner::set(const Job &job, uint8_t *blob)
|
||||||
|
{
|
||||||
|
if (job.size() > (Job::kMaxBlobSize - 4)) {
|
||||||
|
throw std::length_error("job size too big");
|
||||||
|
}
|
||||||
|
|
||||||
|
blob[job.size()] = 0x01;
|
||||||
|
memset(blob + job.size() + 1, 0, Job::kMaxBlobSize - job.size() - 1);
|
||||||
|
|
||||||
|
enqueueWriteBuffer(m_input, CL_TRUE, 0, Job::kMaxBlobSize, blob);
|
||||||
|
|
||||||
|
m_cn2->setTarget(job.target());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::OclRyoRunner::build()
|
||||||
|
{
|
||||||
|
OclBaseRunner::build();
|
||||||
|
|
||||||
|
m_cn00 = new Cn00RyoKernel(m_program);
|
||||||
|
m_cn00->setArgs(m_scratchpads, m_states);
|
||||||
|
|
||||||
|
m_cn0 = new Cn0Kernel(m_program);
|
||||||
|
m_cn0->setArgs(m_input, 0, m_scratchpads, m_states, m_intensity);
|
||||||
|
|
||||||
|
m_cn1 = new Cn1RyoKernel(m_program);
|
||||||
|
m_cn1->setArgs(m_scratchpads, m_states, m_intensity);
|
||||||
|
|
||||||
|
m_cn2 = new Cn2RyoKernel(m_program);
|
||||||
|
m_cn2->setArgs(m_scratchpads, m_states, m_output, m_intensity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::OclRyoRunner::init()
|
||||||
|
{
|
||||||
|
OclBaseRunner::init();
|
||||||
|
|
||||||
|
m_scratchpads = createSubBuffer(CL_MEM_READ_WRITE, data().algorithm.l3() * m_intensity);
|
||||||
|
m_states = createSubBuffer(CL_MEM_READ_WRITE, 200 * m_intensity);
|
||||||
|
}
|
||||||
70
src/backend/opencl/runners/OclRyoRunner.h
Normal file
70
src/backend/opencl/runners/OclRyoRunner.h
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XMRIG_OCLRYORUNNER_H
|
||||||
|
#define XMRIG_OCLRYORUNNER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "backend/opencl/runners/OclBaseRunner.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
class Cn00RyoKernel;
|
||||||
|
class Cn0Kernel;
|
||||||
|
class Cn1RyoKernel;
|
||||||
|
class Cn2RyoKernel;
|
||||||
|
|
||||||
|
|
||||||
|
class OclRyoRunner : public OclBaseRunner
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XMRIG_DISABLE_COPY_MOVE_DEFAULT(OclRyoRunner)
|
||||||
|
|
||||||
|
OclRyoRunner(size_t index, const OclLaunchData &data);
|
||||||
|
|
||||||
|
~OclRyoRunner() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
size_t bufferSize() const override;
|
||||||
|
void run(uint32_t nonce, uint32_t *hashOutput) override;
|
||||||
|
void set(const Job &job, uint8_t *blob) override;
|
||||||
|
void build() override;
|
||||||
|
void init() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
cl_mem m_scratchpads = nullptr;
|
||||||
|
cl_mem m_states = nullptr;
|
||||||
|
Cn00RyoKernel *m_cn00 = nullptr;
|
||||||
|
Cn0Kernel *m_cn0 = nullptr;
|
||||||
|
Cn1RyoKernel *m_cn1 = nullptr;
|
||||||
|
Cn2RyoKernel *m_cn2 = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
|
||||||
|
#endif // XMRIG_OCLRYORUNNER_H
|
||||||
@@ -54,6 +54,10 @@ extern bool ocl_generic_kawpow_generator(const OclDevice& device, const Algorith
|
|||||||
extern bool ocl_vega_cn_generator(const OclDevice &device, const Algorithm &algorithm, OclThreads &threads);
|
extern bool ocl_vega_cn_generator(const OclDevice &device, const Algorithm &algorithm, OclThreads &threads);
|
||||||
extern bool ocl_generic_cn_generator(const OclDevice &device, const Algorithm &algorithm, OclThreads &threads);
|
extern bool ocl_generic_cn_generator(const OclDevice &device, const Algorithm &algorithm, OclThreads &threads);
|
||||||
|
|
||||||
|
#ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
extern bool ocl_generic_cn_gpu_generator(const OclDevice &device, const Algorithm &algorithm, OclThreads &threads);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static ocl_gen_config_fun generators[] = {
|
static ocl_gen_config_fun generators[] = {
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
@@ -63,7 +67,10 @@ static ocl_gen_config_fun generators[] = {
|
|||||||
ocl_generic_kawpow_generator,
|
ocl_generic_kawpow_generator,
|
||||||
# endif
|
# endif
|
||||||
ocl_vega_cn_generator,
|
ocl_vega_cn_generator,
|
||||||
ocl_generic_cn_generator
|
ocl_generic_cn_generator,
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
ocl_generic_cn_gpu_generator,
|
||||||
|
# endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -74,11 +74,16 @@ const char *Algorithm::kCN_PICO_TLO = "cn-pico/tlo";
|
|||||||
const char *Algorithm::kCN_UPX2 = "cn/upx2";
|
const char *Algorithm::kCN_UPX2 = "cn/upx2";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
const char *Algorithm::kCN_GPU = "cn/gpu";
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef XMRIG_ALGO_RANDOMX
|
#ifdef XMRIG_ALGO_RANDOMX
|
||||||
const char *Algorithm::kRX = "rx";
|
const char *Algorithm::kRX = "rx";
|
||||||
const char *Algorithm::kRX_0 = "rx/0";
|
const char *Algorithm::kRX_0 = "rx/0";
|
||||||
const char *Algorithm::kRX_WOW = "rx/wow";
|
const char *Algorithm::kRX_WOW = "rx/wow";
|
||||||
const char *Algorithm::kRX_ARQ = "rx/arq";
|
const char *Algorithm::kRX_ARQ = "rx/arq";
|
||||||
|
const char *Algorithm::kRX_XEQ = "rx/xeq";
|
||||||
const char *Algorithm::kRX_GRAFT = "rx/graft";
|
const char *Algorithm::kRX_GRAFT = "rx/graft";
|
||||||
const char *Algorithm::kRX_SFX = "rx/sfx";
|
const char *Algorithm::kRX_SFX = "rx/sfx";
|
||||||
const char *Algorithm::kRX_KEVA = "rx/keva";
|
const char *Algorithm::kRX_KEVA = "rx/keva";
|
||||||
@@ -99,6 +104,12 @@ const char *Algorithm::kKAWPOW_RVN = "kawpow";
|
|||||||
#ifdef XMRIG_ALGO_GHOSTRIDER
|
#ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
const char* Algorithm::kGHOSTRIDER = "ghostrider";
|
const char* Algorithm::kGHOSTRIDER = "ghostrider";
|
||||||
const char* Algorithm::kGHOSTRIDER_RTM = "ghostrider";
|
const char* Algorithm::kGHOSTRIDER_RTM = "ghostrider";
|
||||||
|
const char* Algorithm::kFLEX = "flex";
|
||||||
|
const char* Algorithm::kFLEX_KCN = "flex";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XMRIG_ALGO_RANDOMX
|
||||||
|
const char *Algorithm::kRX_XLA = "panthera";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -141,10 +152,15 @@ static const std::map<uint32_t, const char *> kAlgorithmNames = {
|
|||||||
ALGO_NAME(CN_UPX2),
|
ALGO_NAME(CN_UPX2),
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
ALGO_NAME(CN_GPU),
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
ALGO_NAME(RX_0),
|
ALGO_NAME(RX_0),
|
||||||
ALGO_NAME(RX_WOW),
|
ALGO_NAME(RX_WOW),
|
||||||
ALGO_NAME(RX_ARQ),
|
ALGO_NAME(RX_ARQ),
|
||||||
|
ALGO_NAME(RX_XEQ),
|
||||||
ALGO_NAME(RX_GRAFT),
|
ALGO_NAME(RX_GRAFT),
|
||||||
ALGO_NAME(RX_SFX),
|
ALGO_NAME(RX_SFX),
|
||||||
ALGO_NAME(RX_KEVA),
|
ALGO_NAME(RX_KEVA),
|
||||||
@@ -160,8 +176,13 @@ static const std::map<uint32_t, const char *> kAlgorithmNames = {
|
|||||||
ALGO_NAME(KAWPOW_RVN),
|
ALGO_NAME(KAWPOW_RVN),
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
|
ALGO_NAME(RX_XLA),
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
ALGO_NAME(GHOSTRIDER_RTM),
|
ALGO_NAME(GHOSTRIDER_RTM),
|
||||||
|
ALGO_NAME(FLEX_KCN),
|
||||||
# endif
|
# endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -247,6 +268,11 @@ static const std::map<const char *, Algorithm::Id, aliasCompare> kAlgorithmAlias
|
|||||||
ALGO_ALIAS(CN_UPX2, "cryptonight-upx/2"),
|
ALGO_ALIAS(CN_UPX2, "cryptonight-upx/2"),
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
ALGO_ALIAS_AUTO(CN_GPU), ALGO_ALIAS(CN_GPU, "cryptonight/gpu"),
|
||||||
|
ALGO_ALIAS(CN_GPU, "cryptonight_gpu"),
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
ALGO_ALIAS_AUTO(RX_0), ALGO_ALIAS(RX_0, "randomx/0"),
|
ALGO_ALIAS_AUTO(RX_0), ALGO_ALIAS(RX_0, "randomx/0"),
|
||||||
ALGO_ALIAS(RX_0, "randomx/test"),
|
ALGO_ALIAS(RX_0, "randomx/test"),
|
||||||
@@ -257,6 +283,8 @@ static const std::map<const char *, Algorithm::Id, aliasCompare> kAlgorithmAlias
|
|||||||
ALGO_ALIAS(RX_WOW, "randomwow"),
|
ALGO_ALIAS(RX_WOW, "randomwow"),
|
||||||
ALGO_ALIAS_AUTO(RX_ARQ), ALGO_ALIAS(RX_ARQ, "randomx/arq"),
|
ALGO_ALIAS_AUTO(RX_ARQ), ALGO_ALIAS(RX_ARQ, "randomx/arq"),
|
||||||
ALGO_ALIAS(RX_ARQ, "randomarq"),
|
ALGO_ALIAS(RX_ARQ, "randomarq"),
|
||||||
|
ALGO_ALIAS_AUTO(RX_XEQ), ALGO_ALIAS(RX_XEQ, "randomx/xeq"),
|
||||||
|
ALGO_ALIAS(RX_XEQ, "randomxeq"),
|
||||||
ALGO_ALIAS_AUTO(RX_GRAFT), ALGO_ALIAS(RX_GRAFT, "randomx/graft"),
|
ALGO_ALIAS_AUTO(RX_GRAFT), ALGO_ALIAS(RX_GRAFT, "randomx/graft"),
|
||||||
ALGO_ALIAS(RX_GRAFT, "randomgraft"),
|
ALGO_ALIAS(RX_GRAFT, "randomgraft"),
|
||||||
ALGO_ALIAS_AUTO(RX_SFX), ALGO_ALIAS(RX_SFX, "randomx/sfx"),
|
ALGO_ALIAS_AUTO(RX_SFX), ALGO_ALIAS(RX_SFX, "randomx/sfx"),
|
||||||
@@ -275,9 +303,15 @@ static const std::map<const char *, Algorithm::Id, aliasCompare> kAlgorithmAlias
|
|||||||
ALGO_ALIAS_AUTO(KAWPOW_RVN), ALGO_ALIAS(KAWPOW_RVN, "kawpow/rvn"),
|
ALGO_ALIAS_AUTO(KAWPOW_RVN), ALGO_ALIAS(KAWPOW_RVN, "kawpow/rvn"),
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
|
ALGO_ALIAS_AUTO(RX_XLA), ALGO_ALIAS(RX_XLA, "Panthera"),
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
ALGO_ALIAS_AUTO(GHOSTRIDER_RTM), ALGO_ALIAS(GHOSTRIDER_RTM, "ghostrider/rtm"),
|
ALGO_ALIAS_AUTO(GHOSTRIDER_RTM), ALGO_ALIAS(GHOSTRIDER_RTM, "ghostrider/rtm"),
|
||||||
ALGO_ALIAS(GHOSTRIDER_RTM, "gr"),
|
ALGO_ALIAS(GHOSTRIDER_RTM, "gr"),
|
||||||
|
ALGO_ALIAS_AUTO(FLEX_KCN), ALGO_ALIAS(FLEX_KCN, "flex/kcn"),
|
||||||
|
ALGO_ALIAS(FLEX_KCN, "flex"),
|
||||||
# endif
|
# endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -350,10 +384,13 @@ std::vector<xmrig::Algorithm> xmrig::Algorithm::all(const std::function<bool(con
|
|||||||
CN_HEAVY_0, CN_HEAVY_TUBE, CN_HEAVY_XHV,
|
CN_HEAVY_0, CN_HEAVY_TUBE, CN_HEAVY_XHV,
|
||||||
CN_PICO_0, CN_PICO_TLO,
|
CN_PICO_0, CN_PICO_TLO,
|
||||||
CN_UPX2,
|
CN_UPX2,
|
||||||
RX_0, RX_WOW, RX_ARQ, RX_GRAFT, RX_SFX, RX_KEVA,
|
CN_GPU,
|
||||||
|
RX_0, RX_WOW, RX_ARQ, RX_XEQ, RX_GRAFT, RX_SFX, RX_KEVA,
|
||||||
|
RX_XLA,
|
||||||
AR2_CHUKWA, AR2_CHUKWA_V2, AR2_WRKZ,
|
AR2_CHUKWA, AR2_CHUKWA_V2, AR2_WRKZ,
|
||||||
KAWPOW_RVN,
|
KAWPOW_RVN,
|
||||||
GHOSTRIDER_RTM
|
GHOSTRIDER_RTM,
|
||||||
|
FLEX_KCN
|
||||||
};
|
};
|
||||||
|
|
||||||
Algorithms out;
|
Algorithms out;
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public:
|
|||||||
CN_PICO_0 = 0x63120200, // "cn-pico" CryptoNight-Pico
|
CN_PICO_0 = 0x63120200, // "cn-pico" CryptoNight-Pico
|
||||||
CN_PICO_TLO = 0x63120274, // "cn-pico/tlo" CryptoNight-Pico (TLO)
|
CN_PICO_TLO = 0x63120274, // "cn-pico/tlo" CryptoNight-Pico (TLO)
|
||||||
CN_UPX2 = 0x63110200, // "cn/upx2" Uplexa (UPX2)
|
CN_UPX2 = 0x63110200, // "cn/upx2" Uplexa (UPX2)
|
||||||
|
CN_GPU = 0x63150300, // "cn/gpu" CryptoNight-GPU (Ryo).
|
||||||
CN_GR_0 = 0x63130100, // "cn/dark" GhostRider
|
CN_GR_0 = 0x63130100, // "cn/dark" GhostRider
|
||||||
CN_GR_1 = 0x63130101, // "cn/dark-lite" GhostRider
|
CN_GR_1 = 0x63130101, // "cn/dark-lite" GhostRider
|
||||||
CN_GR_2 = 0x63150102, // "cn/fast" GhostRider
|
CN_GR_2 = 0x63150102, // "cn/fast" GhostRider
|
||||||
@@ -72,9 +73,11 @@ public:
|
|||||||
CN_GR_4 = 0x63120104, // "cn/turtle" GhostRider
|
CN_GR_4 = 0x63120104, // "cn/turtle" GhostRider
|
||||||
CN_GR_5 = 0x63120105, // "cn/turtle-lite" GhostRider
|
CN_GR_5 = 0x63120105, // "cn/turtle-lite" GhostRider
|
||||||
GHOSTRIDER_RTM = 0x6c150000, // "ghostrider" GhostRider
|
GHOSTRIDER_RTM = 0x6c150000, // "ghostrider" GhostRider
|
||||||
|
FLEX_KCN = 0x6c150001, // "flex" Flex
|
||||||
RX_0 = 0x72151200, // "rx/0" RandomX (reference configuration).
|
RX_0 = 0x72151200, // "rx/0" RandomX (reference configuration).
|
||||||
RX_WOW = 0x72141177, // "rx/wow" RandomWOW (Wownero).
|
RX_WOW = 0x72141177, // "rx/wow" RandomWOW (Wownero).
|
||||||
RX_ARQ = 0x72121061, // "rx/arq" RandomARQ (Arqma).
|
RX_ARQ = 0x72121061, // "rx/arq" RandomARQ (Arqma).
|
||||||
|
RX_XEQ = 0x72121000,
|
||||||
RX_GRAFT = 0x72151267, // "rx/graft" RandomGRAFT (Graft).
|
RX_GRAFT = 0x72151267, // "rx/graft" RandomGRAFT (Graft).
|
||||||
RX_SFX = 0x72151273, // "rx/sfx" RandomSFX (Safex Cash).
|
RX_SFX = 0x72151273, // "rx/sfx" RandomSFX (Safex Cash).
|
||||||
RX_KEVA = 0x7214116b, // "rx/keva" RandomKEVA (Keva).
|
RX_KEVA = 0x7214116b, // "rx/keva" RandomKEVA (Keva).
|
||||||
@@ -82,6 +85,8 @@ public:
|
|||||||
AR2_CHUKWA_V2 = 0x61140000, // "argon2/chukwav2" Argon2id (Chukwa v2).
|
AR2_CHUKWA_V2 = 0x61140000, // "argon2/chukwav2" Argon2id (Chukwa v2).
|
||||||
AR2_WRKZ = 0x61120000, // "argon2/wrkz" Argon2id (WRKZ)
|
AR2_WRKZ = 0x61120000, // "argon2/wrkz" Argon2id (WRKZ)
|
||||||
KAWPOW_RVN = 0x6b0f0000, // "kawpow/rvn" KawPow (RVN)
|
KAWPOW_RVN = 0x6b0f0000, // "kawpow/rvn" KawPow (RVN)
|
||||||
|
|
||||||
|
RX_XLA = 0x721211ff, // "panthera" Panthera (Scala2).
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Family : uint32_t {
|
enum Family : uint32_t {
|
||||||
@@ -136,11 +141,16 @@ public:
|
|||||||
static const char *kCN_UPX2;
|
static const char *kCN_UPX2;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
static const char *kCN_GPU;
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
static const char *kRX;
|
static const char *kRX;
|
||||||
static const char *kRX_0;
|
static const char *kRX_0;
|
||||||
static const char *kRX_WOW;
|
static const char *kRX_WOW;
|
||||||
static const char *kRX_ARQ;
|
static const char *kRX_ARQ;
|
||||||
|
static const char *kRX_XEQ;
|
||||||
static const char *kRX_GRAFT;
|
static const char *kRX_GRAFT;
|
||||||
static const char *kRX_SFX;
|
static const char *kRX_SFX;
|
||||||
static const char *kRX_KEVA;
|
static const char *kRX_KEVA;
|
||||||
@@ -158,9 +168,15 @@ public:
|
|||||||
static const char *kKAWPOW_RVN;
|
static const char *kKAWPOW_RVN;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
|
static const char *kRX_XLA;
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
static const char* kGHOSTRIDER;
|
static const char* kGHOSTRIDER;
|
||||||
static const char* kGHOSTRIDER_RTM;
|
static const char* kGHOSTRIDER_RTM;
|
||||||
|
static const char* kFLEX;
|
||||||
|
static const char* kFLEX_KCN;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
inline Algorithm() = default;
|
inline Algorithm() = default;
|
||||||
@@ -182,8 +198,8 @@ public:
|
|||||||
inline Id id() const { return m_id; }
|
inline Id id() const { return m_id; }
|
||||||
inline size_t l2() const { return l2(m_id); }
|
inline size_t l2() const { return l2(m_id); }
|
||||||
inline uint32_t family() const { return family(m_id); }
|
inline uint32_t family() const { return family(m_id); }
|
||||||
inline uint32_t minIntensity() const { return ((m_id == GHOSTRIDER_RTM) ? 8 : 1); };
|
inline uint32_t minIntensity() const { return ((family(m_id) == GHOSTRIDER) ? 8 : 1); };
|
||||||
inline uint32_t maxIntensity() const { return isCN() ? 5 : ((m_id == GHOSTRIDER_RTM) ? 8 : 1); };
|
inline uint32_t maxIntensity() const { return isCN() ? 5 : ((family(m_id) == GHOSTRIDER) ? 8 : 1); };
|
||||||
|
|
||||||
inline size_t l3() const { return l3(m_id); }
|
inline size_t l3() const { return l3(m_id); }
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ static const CoinInfo coinInfo[] = {
|
|||||||
{ Algorithm::RX_0, "XMR", "Monero", 120, 1000000000000, YELLOW_BG_BOLD( WHITE_BOLD_S " monero ") },
|
{ Algorithm::RX_0, "XMR", "Monero", 120, 1000000000000, YELLOW_BG_BOLD( WHITE_BOLD_S " monero ") },
|
||||||
{ Algorithm::CN_R, "SUMO", "Sumokoin", 240, 1000000000, BLUE_BG_BOLD( WHITE_BOLD_S " sumo ") },
|
{ Algorithm::CN_R, "SUMO", "Sumokoin", 240, 1000000000, BLUE_BG_BOLD( WHITE_BOLD_S " sumo ") },
|
||||||
{ Algorithm::RX_ARQ, "ARQ", "ArQmA", 120, 1000000000, BLUE_BG_BOLD( WHITE_BOLD_S " arqma ") },
|
{ Algorithm::RX_ARQ, "ARQ", "ArQmA", 120, 1000000000, BLUE_BG_BOLD( WHITE_BOLD_S " arqma ") },
|
||||||
|
{ Algorithm::RX_XEQ, "XEQ", "Equilibria", 120, 10000, BLUE_BG_BOLD( WHITE_BOLD_S " equilibria ") },
|
||||||
{ Algorithm::RX_GRAFT, "GRFT", "Graft", 120, 10000000000, BLUE_BG_BOLD( WHITE_BOLD_S " graft ") },
|
{ Algorithm::RX_GRAFT, "GRFT", "Graft", 120, 10000000000, BLUE_BG_BOLD( WHITE_BOLD_S " graft ") },
|
||||||
{ Algorithm::RX_KEVA, "KVA", "Kevacoin", 0, 0, MAGENTA_BG_BOLD(WHITE_BOLD_S " keva ") },
|
{ Algorithm::RX_KEVA, "KVA", "Kevacoin", 0, 0, MAGENTA_BG_BOLD(WHITE_BOLD_S " keva ") },
|
||||||
{ Algorithm::KAWPOW_RVN, "RVN", "Ravencoin", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " raven ") },
|
{ Algorithm::KAWPOW_RVN, "RVN", "Ravencoin", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " raven ") },
|
||||||
@@ -65,7 +66,6 @@ const char *Coin::kDisabled = "DISABLED_COIN";
|
|||||||
const char *Coin::kField = "coin";
|
const char *Coin::kField = "coin";
|
||||||
const char *Coin::kUnknown = "UNKNOWN_COIN";
|
const char *Coin::kUnknown = "UNKNOWN_COIN";
|
||||||
|
|
||||||
|
|
||||||
} /* namespace xmrig */
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ public:
|
|||||||
INVALID,
|
INVALID,
|
||||||
MONERO,
|
MONERO,
|
||||||
SUMO,
|
SUMO,
|
||||||
ARQMA,
|
ARQ,
|
||||||
|
XEQ,
|
||||||
GRAFT,
|
GRAFT,
|
||||||
KEVA,
|
KEVA,
|
||||||
RAVEN,
|
RAVEN,
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ private:
|
|||||||
#define WHITE_S CSI "0;37m" // another name for LT.GRAY
|
#define WHITE_S CSI "0;37m" // another name for LT.GRAY
|
||||||
#define WHITE_BOLD_S CSI "1;37m" // actually white
|
#define WHITE_BOLD_S CSI "1;37m" // actually white
|
||||||
|
|
||||||
|
#define BRIGHT_BLACK_BG_S CSI "100m" // somewhat MD.GRAY
|
||||||
#define RED_BG_BOLD_S CSI "41;1m"
|
#define RED_BG_BOLD_S CSI "41;1m"
|
||||||
#define GREEN_BG_BOLD_S CSI "42;1m"
|
#define GREEN_BG_BOLD_S CSI "42;1m"
|
||||||
#define YELLOW_BG_BOLD_S CSI "43;1m"
|
#define YELLOW_BG_BOLD_S CSI "43;1m"
|
||||||
@@ -125,6 +126,7 @@ private:
|
|||||||
#define WHITE(x) WHITE_S x CLEAR
|
#define WHITE(x) WHITE_S x CLEAR
|
||||||
#define WHITE_BOLD(x) WHITE_BOLD_S x CLEAR
|
#define WHITE_BOLD(x) WHITE_BOLD_S x CLEAR
|
||||||
|
|
||||||
|
#define BRIGHT_BLACK_BG(x) BRIGHT_BLACK_BG_S x CLEAR
|
||||||
#define RED_BG_BOLD(x) RED_BG_BOLD_S x CLEAR
|
#define RED_BG_BOLD(x) RED_BG_BOLD_S x CLEAR
|
||||||
#define GREEN_BG_BOLD(x) GREEN_BG_BOLD_S x CLEAR
|
#define GREEN_BG_BOLD(x) GREEN_BG_BOLD_S x CLEAR
|
||||||
#define YELLOW_BG_BOLD(x) YELLOW_BG_BOLD_S x CLEAR
|
#define YELLOW_BG_BOLD(x) YELLOW_BG_BOLD_S x CLEAR
|
||||||
|
|||||||
@@ -121,6 +121,15 @@ const char *xmrig::Tags::opencl()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
const char *xmrig::Tags::benchmark()
|
||||||
|
{
|
||||||
|
static const char *tag = BRIGHT_BLACK_BG(CYAN_BOLD_S " benchmk ");
|
||||||
|
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef XMRIG_FEATURE_PROFILING
|
#ifdef XMRIG_FEATURE_PROFILING
|
||||||
const char* xmrig::Tags::profiler()
|
const char* xmrig::Tags::profiler()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ public:
|
|||||||
static const char *opencl();
|
static const char *opencl();
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
static const char *benchmark();
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_PROFILING
|
# ifdef XMRIG_FEATURE_PROFILING
|
||||||
static const char* profiler();
|
static const char* profiler();
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@@ -47,16 +47,26 @@
|
|||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
const char *BaseConfig::kAlgoMinTime = "algo-min-time";
|
||||||
|
const char *BaseConfig::kAlgoPerf = "algo-perf";
|
||||||
|
#endif
|
||||||
const char *BaseConfig::kApi = "api";
|
const char *BaseConfig::kApi = "api";
|
||||||
const char *BaseConfig::kApiId = "id";
|
const char *BaseConfig::kApiId = "id";
|
||||||
const char *BaseConfig::kApiWorkerId = "worker-id";
|
const char *BaseConfig::kApiWorkerId = "worker-id";
|
||||||
const char *BaseConfig::kAutosave = "autosave";
|
const char *BaseConfig::kAutosave = "autosave";
|
||||||
const char *BaseConfig::kBackground = "background";
|
const char *BaseConfig::kBackground = "background";
|
||||||
|
#ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
const char *BaseConfig::kBenchAlgoTime = "bench-algo-time";
|
||||||
|
#endif
|
||||||
const char *BaseConfig::kColors = "colors";
|
const char *BaseConfig::kColors = "colors";
|
||||||
const char *BaseConfig::kDryRun = "dry-run";
|
const char *BaseConfig::kDryRun = "dry-run";
|
||||||
const char *BaseConfig::kHttp = "http";
|
const char *BaseConfig::kHttp = "http";
|
||||||
const char *BaseConfig::kLogFile = "log-file";
|
const char *BaseConfig::kLogFile = "log-file";
|
||||||
const char *BaseConfig::kPrintTime = "print-time";
|
const char *BaseConfig::kPrintTime = "print-time";
|
||||||
|
#ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
const char *BaseConfig::kRebenchAlgo = "rebench-algo";
|
||||||
|
#endif
|
||||||
const char *BaseConfig::kSyslog = "syslog";
|
const char *BaseConfig::kSyslog = "syslog";
|
||||||
const char *BaseConfig::kTitle = "title";
|
const char *BaseConfig::kTitle = "title";
|
||||||
const char *BaseConfig::kUserAgent = "user-agent";
|
const char *BaseConfig::kUserAgent = "user-agent";
|
||||||
@@ -83,6 +93,9 @@ bool xmrig::BaseConfig::read(const IJsonReader &reader, const char *fileName)
|
|||||||
m_autoSave = reader.getBool(kAutosave, m_autoSave);
|
m_autoSave = reader.getBool(kAutosave, m_autoSave);
|
||||||
m_background = reader.getBool(kBackground, m_background);
|
m_background = reader.getBool(kBackground, m_background);
|
||||||
m_dryRun = reader.getBool(kDryRun, m_dryRun);
|
m_dryRun = reader.getBool(kDryRun, m_dryRun);
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
m_rebenchAlgo = reader.getBool(kRebenchAlgo, m_rebenchAlgo);
|
||||||
|
# endif
|
||||||
m_syslog = reader.getBool(kSyslog, m_syslog);
|
m_syslog = reader.getBool(kSyslog, m_syslog);
|
||||||
m_watch = reader.getBool(kWatch, m_watch);
|
m_watch = reader.getBool(kWatch, m_watch);
|
||||||
m_logFile = reader.getString(kLogFile);
|
m_logFile = reader.getString(kLogFile);
|
||||||
@@ -95,6 +108,10 @@ bool xmrig::BaseConfig::read(const IJsonReader &reader, const char *fileName)
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
Log::setColors(reader.getBool(kColors, Log::isColors()));
|
Log::setColors(reader.getBool(kColors, Log::isColors()));
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
m_benchAlgoTime = reader.getInt(kBenchAlgoTime, m_benchAlgoTime);
|
||||||
|
m_algoMinTime = reader.getInt(kAlgoMinTime, m_algoMinTime);
|
||||||
|
# endif
|
||||||
setVerbose(reader.getValue(kVerbose));
|
setVerbose(reader.getValue(kVerbose));
|
||||||
|
|
||||||
const auto &api = reader.getObject(kApi);
|
const auto &api = reader.getObject(kApi);
|
||||||
|
|||||||
@@ -40,16 +40,26 @@ class IJsonReader;
|
|||||||
class BaseConfig : public IConfig
|
class BaseConfig : public IConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
static const char *kAlgoMinTime;
|
||||||
|
static const char *kAlgoPerf;
|
||||||
|
# endif
|
||||||
static const char *kApi;
|
static const char *kApi;
|
||||||
static const char *kApiId;
|
static const char *kApiId;
|
||||||
static const char *kApiWorkerId;
|
static const char *kApiWorkerId;
|
||||||
static const char *kAutosave;
|
static const char *kAutosave;
|
||||||
static const char *kBackground;
|
static const char *kBackground;
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
static const char *kBenchAlgoTime;
|
||||||
|
# endif
|
||||||
static const char *kColors;
|
static const char *kColors;
|
||||||
static const char *kDryRun;
|
static const char *kDryRun;
|
||||||
static const char *kHttp;
|
static const char *kHttp;
|
||||||
static const char *kLogFile;
|
static const char *kLogFile;
|
||||||
static const char *kPrintTime;
|
static const char *kPrintTime;
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
static const char *kRebenchAlgo;
|
||||||
|
# endif
|
||||||
static const char *kSyslog;
|
static const char *kSyslog;
|
||||||
static const char *kTitle;
|
static const char *kTitle;
|
||||||
static const char *kUserAgent;
|
static const char *kUserAgent;
|
||||||
@@ -75,6 +85,12 @@ public:
|
|||||||
inline const Title &title() const { return m_title; }
|
inline const Title &title() const { return m_title; }
|
||||||
inline uint32_t printTime() const { return m_printTime; }
|
inline uint32_t printTime() const { return m_printTime; }
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
inline bool isRebenchAlgo() const { return m_rebenchAlgo; }
|
||||||
|
inline int benchAlgoTime() const { return m_benchAlgoTime; }
|
||||||
|
inline int algoMinTime() const { return m_algoMinTime; }
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
inline const TlsConfig &tls() const { return m_tls; }
|
inline const TlsConfig &tls() const { return m_tls; }
|
||||||
# endif
|
# endif
|
||||||
@@ -105,6 +121,12 @@ protected:
|
|||||||
Title m_title;
|
Title m_title;
|
||||||
uint32_t m_printTime = 60;
|
uint32_t m_printTime = 60;
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
bool m_rebenchAlgo = false;
|
||||||
|
int m_benchAlgoTime = 10;
|
||||||
|
int m_algoMinTime = 0;
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
TlsConfig m_tls;
|
TlsConfig m_tls;
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@@ -242,6 +242,10 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
case IConfig::RetriesKey: /* --retries */
|
case IConfig::RetriesKey: /* --retries */
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
case IConfig::BenchAlgoTimeKey: /* --bench-algo-time */
|
||||||
|
case IConfig::AlgoMinTimeKey: /* --algo-min-time */
|
||||||
|
# endif
|
||||||
case IConfig::RetryPauseKey: /* --retry-pause */
|
case IConfig::RetryPauseKey: /* --retry-pause */
|
||||||
case IConfig::PrintTimeKey: /* --print-time */
|
case IConfig::PrintTimeKey: /* --print-time */
|
||||||
case IConfig::HttpPort: /* --http-port */
|
case IConfig::HttpPort: /* --http-port */
|
||||||
@@ -256,10 +260,18 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
|
|||||||
case IConfig::SyslogKey: /* --syslog */
|
case IConfig::SyslogKey: /* --syslog */
|
||||||
case IConfig::KeepAliveKey: /* --keepalive */
|
case IConfig::KeepAliveKey: /* --keepalive */
|
||||||
case IConfig::NicehashKey: /* --nicehash */
|
case IConfig::NicehashKey: /* --nicehash */
|
||||||
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
case IConfig::TlsKey: /* --tls */
|
case IConfig::TlsKey: /* --tls */
|
||||||
|
# endif
|
||||||
case IConfig::DryRunKey: /* --dry-run */
|
case IConfig::DryRunKey: /* --dry-run */
|
||||||
|
# ifdef XMRIG_FEATURE_HTTP
|
||||||
case IConfig::HttpEnabledKey: /* --http-enabled */
|
case IConfig::HttpEnabledKey: /* --http-enabled */
|
||||||
case IConfig::DaemonKey: /* --daemon */
|
case IConfig::DaemonKey: /* --daemon */
|
||||||
|
# endif
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
case IConfig::RebenchAlgoKey: /* --rebench-algo */
|
||||||
|
# endif
|
||||||
|
case IConfig::PauseOnBatteryKey: /* --pause-on-battery */
|
||||||
case IConfig::SubmitToOriginKey: /* --submit-to-origin */
|
case IConfig::SubmitToOriginKey: /* --submit-to-origin */
|
||||||
case IConfig::VerboseKey: /* --verbose */
|
case IConfig::VerboseKey: /* --verbose */
|
||||||
case IConfig::DnsIPv6Key: /* --dns-ipv6 */
|
case IConfig::DnsIPv6Key: /* --dns-ipv6 */
|
||||||
@@ -323,6 +335,11 @@ void xmrig::BaseTransform::transformBoolean(rapidjson::Document &doc, int key, b
|
|||||||
case IConfig::NoTitleKey: /* --no-title */
|
case IConfig::NoTitleKey: /* --no-title */
|
||||||
return set(doc, BaseConfig::kTitle, enable);
|
return set(doc, BaseConfig::kTitle, enable);
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
case IConfig::RebenchAlgoKey: /* --rebench-algo */
|
||||||
|
return set(doc, BaseConfig::kRebenchAlgo, enable);
|
||||||
|
# endif
|
||||||
|
|
||||||
case IConfig::DnsIPv6Key: /* --dns-ipv6 */
|
case IConfig::DnsIPv6Key: /* --dns-ipv6 */
|
||||||
return set(doc, DnsConfig::kField, DnsConfig::kIPv6, enable);
|
return set(doc, DnsConfig::kField, DnsConfig::kIPv6, enable);
|
||||||
|
|
||||||
@@ -368,6 +385,14 @@ void xmrig::BaseTransform::transformUint64(rapidjson::Document &doc, int key, ui
|
|||||||
return add(doc, Pools::kPools, Pool::kDaemonZMQPort, arg);
|
return add(doc, Pools::kPools, Pool::kDaemonZMQPort, arg);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
case IConfig::BenchAlgoTimeKey: /* --bench-algo-time */
|
||||||
|
return set(doc, BaseConfig::kBenchAlgoTime, arg);
|
||||||
|
|
||||||
|
case IConfig::AlgoMinTimeKey: /* --algo-min-time */
|
||||||
|
return set(doc, BaseConfig::kAlgoMinTime, arg);
|
||||||
|
# endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,12 @@ public:
|
|||||||
NicehashKey = 1006,
|
NicehashKey = 1006,
|
||||||
PrintTimeKey = 1007,
|
PrintTimeKey = 1007,
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
RebenchAlgoKey = 10001,
|
||||||
|
BenchAlgoTimeKey = 10002,
|
||||||
|
AlgoMinTimeKey = 10003,
|
||||||
|
# endif
|
||||||
|
|
||||||
// xmrig cpu
|
// xmrig cpu
|
||||||
CPUKey = 1024,
|
CPUKey = 1024,
|
||||||
AVKey = 'v',
|
AVKey = 'v',
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "base/net/stratum/AutoClient.h"
|
#include "base/net/stratum/AutoClient.h"
|
||||||
#include "3rdparty/rapidjson/document.h"
|
#include "3rdparty/rapidjson/document.h"
|
||||||
#include "base/io/json/Json.h"
|
#include "base/io/json/Json.h"
|
||||||
|
#include "net/JobResult.h"
|
||||||
|
|
||||||
|
|
||||||
xmrig::AutoClient::AutoClient(int id, const char *agent, IClientListener *listener) :
|
xmrig::AutoClient::AutoClient(int id, const char *agent, IClientListener *listener) :
|
||||||
@@ -77,7 +78,7 @@ bool xmrig::AutoClient::parseLogin(const rapidjson::Value &result, int *code)
|
|||||||
|
|
||||||
int64_t xmrig::AutoClient::submit(const JobResult &result)
|
int64_t xmrig::AutoClient::submit(const JobResult &result)
|
||||||
{
|
{
|
||||||
if (m_mode == DEFAULT_MODE) {
|
if (result.algorithm.family() != Algorithm::KAWPOW || result.algorithm.family() != Algorithm::GHOSTRIDER) {
|
||||||
return Client::submit(result); // NOLINT(bugprone-parent-virtual-call)
|
return Client::submit(result); // NOLINT(bugprone-parent-virtual-call)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,9 +88,11 @@ int64_t xmrig::AutoClient::submit(const JobResult &result)
|
|||||||
|
|
||||||
void xmrig::AutoClient::parseNotification(const char *method, const rapidjson::Value ¶ms, const rapidjson::Value &error)
|
void xmrig::AutoClient::parseNotification(const char *method, const rapidjson::Value ¶ms, const rapidjson::Value &error)
|
||||||
{
|
{
|
||||||
if (m_mode == DEFAULT_MODE) {
|
if (strcmp(method, "job") == 0) {
|
||||||
|
m_mode = DEFAULT_MODE;
|
||||||
return Client::parseNotification(method, params, error); // NOLINT(bugprone-parent-virtual-call)
|
return Client::parseNotification(method, params, error); // NOLINT(bugprone-parent-virtual-call)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_mode = ETH_MODE;
|
||||||
return EthStratumClient::parseNotification(method, params, error);
|
return EthStratumClient::parseNotification(method, params, error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,6 +178,8 @@ int64_t xmrig::Client::send(const rapidjson::Value &obj)
|
|||||||
|
|
||||||
int64_t xmrig::Client::submit(const JobResult &result)
|
int64_t xmrig::Client::submit(const JobResult &result)
|
||||||
{
|
{
|
||||||
|
if (m_rpcId.isNull()) return 0; // ignore leftout benchmark jobs
|
||||||
|
|
||||||
# ifndef XMRIG_PROXY_PROJECT
|
# ifndef XMRIG_PROXY_PROJECT
|
||||||
if (result.clientId != m_rpcId || m_rpcId.isNull() || m_state != ConnectedState) {
|
if (result.clientId != m_rpcId || m_rpcId.isNull() || m_state != ConnectedState) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -241,6 +241,10 @@ void xmrig::DaemonClient::setPool(const Pool &pool)
|
|||||||
if (!m_coin.isValid() && pool.algorithm() == Algorithm::RX_WOW) {
|
if (!m_coin.isValid() && pool.algorithm() == Algorithm::RX_WOW) {
|
||||||
m_coin = Coin::WOWNERO;
|
m_coin = Coin::WOWNERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_coin.isValid() && pool.algorithm() == Algorithm::RX_XEQ) {
|
||||||
|
m_coin = Coin::XEQ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ int64_t xmrig::EthStratumClient::submit(const JobResult& result)
|
|||||||
params.PushBack(result.jobId.toJSON(), allocator);
|
params.PushBack(result.jobId.toJSON(), allocator);
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
if (m_pool.algorithm().id() == Algorithm::GHOSTRIDER_RTM) {
|
if (m_pool.algorithm().family() == Algorithm::GHOSTRIDER) {
|
||||||
params.PushBack(Value("00000000000000000000000000000000", static_cast<uint32_t>(m_extraNonce2Size * 2)), allocator);
|
params.PushBack(Value("00000000000000000000000000000000", static_cast<uint32_t>(m_extraNonce2Size * 2)), allocator);
|
||||||
params.PushBack(Value(m_ntime.data(), allocator), allocator);
|
params.PushBack(Value(m_ntime.data(), allocator), allocator);
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ int64_t xmrig::EthStratumClient::submit(const JobResult& result)
|
|||||||
uint64_t actual_diff;
|
uint64_t actual_diff;
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
if (result.algorithm == Algorithm::GHOSTRIDER_RTM) {
|
if (result.algorithm.family() == Algorithm::GHOSTRIDER) {
|
||||||
actual_diff = reinterpret_cast<const uint64_t*>(result.result())[3];
|
actual_diff = reinterpret_cast<const uint64_t*>(result.result())[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -202,7 +202,7 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pool.algorithm().id() != Algorithm::GHOSTRIDER_RTM) {
|
if (m_pool.algorithm().family() != Algorithm::GHOSTRIDER) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
|
|||||||
algo = m_pool.coin().algorithm();
|
algo = m_pool.coin().algorithm();
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t min_arr_size = (algo.id() == Algorithm::GHOSTRIDER_RTM) ? 8 : 6;
|
const size_t min_arr_size = (algo.family() == Algorithm::GHOSTRIDER) ? 8 : 6;
|
||||||
|
|
||||||
if (arr.Size() < min_arr_size) {
|
if (arr.Size() < min_arr_size) {
|
||||||
LOG_ERR("%s " RED("invalid mining.notify notification: params array has wrong size"), tag());
|
LOG_ERR("%s " RED("invalid mining.notify notification: params array has wrong size"), tag());
|
||||||
@@ -257,7 +257,7 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
|
|||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
if (algo.id() == Algorithm::GHOSTRIDER_RTM) {
|
if (algo.family() == Algorithm::GHOSTRIDER) {
|
||||||
// Raptoreum uses Bitcoin's Stratum protocol
|
// Raptoreum uses Bitcoin's Stratum protocol
|
||||||
// https://en.bitcoinwiki.org/wiki/Stratum_mining_protocol#mining.notify
|
// https://en.bitcoinwiki.org/wiki/Stratum_mining_protocol#mining.notify
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ public:
|
|||||||
MODE_POOL,
|
MODE_POOL,
|
||||||
MODE_DAEMON,
|
MODE_DAEMON,
|
||||||
MODE_SELF_SELECT,
|
MODE_SELF_SELECT,
|
||||||
|
# ifdef XMRIG_ALGO_KAWPOW
|
||||||
MODE_AUTO_ETH,
|
MODE_AUTO_ETH,
|
||||||
|
# endif
|
||||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
MODE_BENCHMARK,
|
MODE_BENCHMARK,
|
||||||
# endif
|
# endif
|
||||||
@@ -153,7 +155,11 @@ private:
|
|||||||
bool m_submitToOrigin = false;
|
bool m_submitToOrigin = false;
|
||||||
Coin m_coin;
|
Coin m_coin;
|
||||||
int m_keepAlive = 0;
|
int m_keepAlive = 0;
|
||||||
|
# ifdef XMRIG_ALGO_KAWPOW
|
||||||
|
Mode m_mode = MODE_AUTO_ETH;
|
||||||
|
# else
|
||||||
Mode m_mode = MODE_POOL;
|
Mode m_mode = MODE_POOL;
|
||||||
|
# endif
|
||||||
ProxyUrl m_proxy;
|
ProxyUrl m_proxy;
|
||||||
std::bitset<FLAG_MAX> m_flags = 0;
|
std::bitset<FLAG_MAX> m_flags = 0;
|
||||||
String m_fingerprint;
|
String m_fingerprint;
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ void xmrig::Pools::load(const IJsonReader &reader)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool mo = false;
|
||||||
for (const rapidjson::Value &value : pools.GetArray()) {
|
for (const rapidjson::Value &value : pools.GetArray()) {
|
||||||
if (!value.IsObject()) {
|
if (!value.IsObject()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -154,10 +155,12 @@ void xmrig::Pools::load(const IJsonReader &reader)
|
|||||||
|
|
||||||
Pool pool(value);
|
Pool pool(value);
|
||||||
if (pool.isValid()) {
|
if (pool.isValid()) {
|
||||||
|
if (m_data.empty() && strstr(pool.host(), "moneroocean.stream")) mo = true;
|
||||||
m_data.push_back(std::move(pool));
|
m_data.push_back(std::move(pool));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mo) m_donateLevel = 0; else
|
||||||
setDonateLevel(reader.getInt(kDonateLevel, kDefaultDonateLevel));
|
setDonateLevel(reader.getInt(kDonateLevel, kDefaultDonateLevel));
|
||||||
setProxyDonate(reader.getInt(kDonateOverProxy, PROXY_DONATE_AUTO));
|
setProxyDonate(reader.getInt(kDonateOverProxy, PROXY_DONATE_AUTO));
|
||||||
setRetries(reader.getInt(kRetries));
|
setRetries(reader.getInt(kRetries));
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
|
|||||||
blob.back() = '\0';
|
blob.back() = '\0';
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
if (m_benchmark->algorithm() == Algorithm::GHOSTRIDER_RTM) {
|
if (m_benchmark->algorithm().family() == Algorithm::GHOSTRIDER) {
|
||||||
const uint32_t q = (benchmark->rotation() / 20) & 1;
|
const uint32_t q = (benchmark->rotation() / 20) & 1;
|
||||||
const uint32_t r = benchmark->rotation() % 20;
|
const uint32_t r = benchmark->rotation() % 20;
|
||||||
|
|
||||||
|
|||||||
@@ -228,17 +228,21 @@ const xmrig::WalletAddress::TagInfo &xmrig::WalletAddress::tagInfo(uint64_t tag)
|
|||||||
{ 0x34f51a, { Coin::SUMO, TESTNET, INTEGRATED, 29734, 29735 } },
|
{ 0x34f51a, { Coin::SUMO, TESTNET, INTEGRATED, 29734, 29735 } },
|
||||||
{ 0x1d351a, { Coin::SUMO, TESTNET, SUBADDRESS, 29734, 29735 } },
|
{ 0x1d351a, { Coin::SUMO, TESTNET, SUBADDRESS, 29734, 29735 } },
|
||||||
|
|
||||||
{ 0x2cca, { Coin::ARQMA, MAINNET, PUBLIC, 19994, 19995 } },
|
{ 0x2cca, { Coin::ARQ, MAINNET, PUBLIC, 19994, 19995 } },
|
||||||
{ 0x116bc7, { Coin::ARQMA, MAINNET, INTEGRATED, 19994, 19995 } },
|
{ 0x116bc7, { Coin::ARQ, MAINNET, INTEGRATED, 19994, 19995 } },
|
||||||
{ 0x6847, { Coin::ARQMA, MAINNET, SUBADDRESS, 19994, 19995 } },
|
{ 0x6847, { Coin::ARQ, MAINNET, SUBADDRESS, 19994, 19995 } },
|
||||||
|
|
||||||
{ 0x53ca, { Coin::ARQMA, TESTNET, PUBLIC, 29994, 29995 } },
|
{ 0x53ca, { Coin::ARQ, TESTNET, PUBLIC, 29994, 29995 } },
|
||||||
{ 0x504a, { Coin::ARQMA, TESTNET, INTEGRATED, 29994, 29995 } },
|
{ 0x504a, { Coin::ARQ, TESTNET, INTEGRATED, 29994, 29995 } },
|
||||||
{ 0x524a, { Coin::ARQMA, TESTNET, SUBADDRESS, 29994, 29995 } },
|
{ 0x524a, { Coin::ARQ, TESTNET, SUBADDRESS, 29994, 29995 } },
|
||||||
|
|
||||||
{ 0x39ca, { Coin::ARQMA, STAGENET, PUBLIC, 39994, 39995 } },
|
{ 0x39ca, { Coin::ARQ, STAGENET, PUBLIC, 39994, 39995 } },
|
||||||
{ 0x1742ca, { Coin::ARQMA, STAGENET, INTEGRATED, 39994, 39995 } },
|
{ 0x1742ca, { Coin::ARQ, STAGENET, INTEGRATED, 39994, 39995 } },
|
||||||
{ 0x1d84ca, { Coin::ARQMA, STAGENET, SUBADDRESS, 39994, 39995 } },
|
{ 0x1d84ca, { Coin::ARQ, STAGENET, SUBADDRESS, 39994, 39995 } },
|
||||||
|
|
||||||
|
{ 0x121, { Coin::XEQ, MAINNET, PUBLIC, 9231, 9232 } },
|
||||||
|
{ 0x629f, { Coin::XEQ, MAINNET, INTEGRATED, 9231, 9232 } },
|
||||||
|
{ 0x59a0, { Coin::XEQ, MAINNET, SUBADDRESS, 9231, 9232 } },
|
||||||
|
|
||||||
{ 0x1032, { Coin::WOWNERO, MAINNET, PUBLIC, 34568, 34569 } },
|
{ 0x1032, { Coin::WOWNERO, MAINNET, PUBLIC, 34568, 34569 } },
|
||||||
{ 0x1a9a, { Coin::WOWNERO, MAINNET, INTEGRATED, 34568, 34569 } },
|
{ 0x1a9a, { Coin::WOWNERO, MAINNET, INTEGRATED, 34568, 34569 } },
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
"title": true,
|
"title": true,
|
||||||
"randomx": {
|
"randomx": {
|
||||||
"init": -1,
|
"init": -1,
|
||||||
"init-avx2": -1,
|
"init-avx2": 0,
|
||||||
"mode": "auto",
|
"mode": "auto",
|
||||||
"1gb-pages": false,
|
"1gb-pages": false,
|
||||||
"rdmsr": true,
|
"rdmsr": true,
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
"huge-pages-jit": false,
|
"huge-pages-jit": false,
|
||||||
"hw-aes": null,
|
"hw-aes": null,
|
||||||
"priority": null,
|
"priority": null,
|
||||||
"memory-pool": false,
|
"memory-pool": true,
|
||||||
"yield": true,
|
"yield": true,
|
||||||
"max-threads-hint": 100,
|
"max-threads-hint": 100,
|
||||||
"asm": true,
|
"asm": true,
|
||||||
@@ -46,14 +46,17 @@
|
|||||||
"platform": "AMD",
|
"platform": "AMD",
|
||||||
"adl": true,
|
"adl": true,
|
||||||
"cn/0": false,
|
"cn/0": false,
|
||||||
"cn-lite/0": false
|
"cn-lite/0": false,
|
||||||
|
"panthera": false
|
||||||
},
|
},
|
||||||
"cuda": {
|
"cuda": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"loader": null,
|
"loader": null,
|
||||||
"nvml": true,
|
"nvml": true,
|
||||||
"cn/0": false,
|
"cn/0": false,
|
||||||
"cn-lite/0": false
|
"cn-lite/0": false,
|
||||||
|
"panthera": false,
|
||||||
|
"astrobwt": false
|
||||||
},
|
},
|
||||||
"donate-level": 1,
|
"donate-level": 1,
|
||||||
"donate-over-proxy": 1,
|
"donate-over-proxy": 1,
|
||||||
@@ -62,12 +65,12 @@
|
|||||||
{
|
{
|
||||||
"algo": null,
|
"algo": null,
|
||||||
"coin": null,
|
"coin": null,
|
||||||
"url": "donate.v2.xmrig.com:3333",
|
"url": "gulf.moneroocean.stream:10128",
|
||||||
"user": "YOUR_WALLET_ADDRESS",
|
"user": "YOUR_WALLET_ADDRESS",
|
||||||
"pass": "x",
|
"pass": "x",
|
||||||
"rig-id": null,
|
"rig-id": null,
|
||||||
"nicehash": false,
|
"nicehash": false,
|
||||||
"keepalive": false,
|
"keepalive": true,
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"tls": false,
|
"tls": false,
|
||||||
"tls-fingerprint": null,
|
"tls-fingerprint": null,
|
||||||
@@ -99,6 +102,8 @@
|
|||||||
"user-agent": null,
|
"user-agent": null,
|
||||||
"verbose": 0,
|
"verbose": 0,
|
||||||
"watch": true,
|
"watch": true,
|
||||||
|
"rebench-algo": false,
|
||||||
|
"bench-algo-time": 20,
|
||||||
"pause-on-battery": false,
|
"pause-on-battery": false,
|
||||||
"pause-on-active": false
|
"pause-on-active": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,12 +61,19 @@ int xmrig::Controller::init()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
void xmrig::Controller::pre_start()
|
||||||
|
{
|
||||||
|
m_miner = std::make_shared<Miner>(this);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Controller::start()
|
void xmrig::Controller::start()
|
||||||
{
|
{
|
||||||
Base::start();
|
Base::start();
|
||||||
|
|
||||||
m_miner = std::make_shared<Miner>(this);
|
if (m_miner == nullptr) m_miner = std::make_shared<Miner>(this);
|
||||||
|
|
||||||
network()->connect();
|
network()->connect();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ public:
|
|||||||
~Controller() override;
|
~Controller() override;
|
||||||
|
|
||||||
int init() override;
|
int init() override;
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
void pre_start();
|
||||||
|
# endif
|
||||||
void start() override;
|
void start() override;
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
|
|||||||
242
src/core/MoBenchmark.cpp
Normal file
242
src/core/MoBenchmark.cpp
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2018-2020 MoneroOcean <https://github.com/MoneroOcean>, <support@moneroocean.stream>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "core/MoBenchmark.h"
|
||||||
|
#include "3rdparty/rapidjson/document.h"
|
||||||
|
#include "backend/common/Hashrate.h"
|
||||||
|
#include "backend/common/interfaces/IBackend.h"
|
||||||
|
#include "backend/common/Tags.h"
|
||||||
|
#include "base/io/log/Log.h"
|
||||||
|
#include "base/io/log/Tags.h"
|
||||||
|
#include "core/config/Config.h"
|
||||||
|
#include "core/Controller.h"
|
||||||
|
#include "core/Miner.h"
|
||||||
|
#include "net/JobResult.h"
|
||||||
|
#include "net/JobResults.h"
|
||||||
|
#include "net/Network.h"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
MoBenchmark::MoBenchmark() : m_controller(nullptr), m_isNewBenchRun(true) {}
|
||||||
|
|
||||||
|
MoBenchmark::~MoBenchmark() {}
|
||||||
|
|
||||||
|
// start performance measurements from the first bench_algo
|
||||||
|
void MoBenchmark::start_perf() {
|
||||||
|
JobResults::setListener(this, m_controller->config()->cpu().isHwAES()); // register benchmark as job result listener to compute hashrates there
|
||||||
|
// write text before first benchmark round
|
||||||
|
LOG_INFO("%s " BRIGHT_BLACK_BG(CYAN_BOLD_S " STARTING ALGO PERFORMANCE CALIBRATION (with " MAGENTA_BOLD_S "%i" CYAN_BOLD_S " seconds round) "), Tags::benchmark(), m_controller->config()->benchAlgoTime());
|
||||||
|
// start benchmarking from first PerfAlgo in the list
|
||||||
|
m_bench_algo = 0;
|
||||||
|
start();
|
||||||
|
m_isNewBenchRun = true; // need to save it to true to save config after benchmark
|
||||||
|
}
|
||||||
|
|
||||||
|
// end of benchmarks, switch to jobs from the pool (network), fill algo_perf
|
||||||
|
void MoBenchmark::finish() {
|
||||||
|
for (const Algorithm::Id algo : Algorithm::all([this](const Algorithm &algo) { return true; })) {
|
||||||
|
if (algo_perf[algo] == 0.0f) algo_perf[algo] = get_algo_perf(algo);
|
||||||
|
}
|
||||||
|
LOG_INFO("%s " BRIGHT_BLACK_BG(CYAN_BOLD_S " ALGO PERFORMANCE CALIBRATION COMPLETE "), Tags::benchmark());
|
||||||
|
m_controller->miner()->pause(); // do not compute anything before job from the pool
|
||||||
|
JobResults::stop();
|
||||||
|
m_controller->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
rapidjson::Value MoBenchmark::toJSON(rapidjson::Document &doc) const
|
||||||
|
{
|
||||||
|
using namespace rapidjson;
|
||||||
|
auto &allocator = doc.GetAllocator();
|
||||||
|
|
||||||
|
Value obj(kObjectType);
|
||||||
|
|
||||||
|
for (const Algorithm a : Algorithm::all()) {
|
||||||
|
obj.AddMember(StringRef(a.name()), algo_perf[a.id()], allocator);
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MoBenchmark::flush_perf() {
|
||||||
|
for (const Algorithm::Id algo : Algorithm::all()) algo_perf[algo] = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MoBenchmark::read(const rapidjson::Value &value)
|
||||||
|
{
|
||||||
|
flush_perf();
|
||||||
|
if (value.IsObject()) {
|
||||||
|
for (auto &member : value.GetObject()) {
|
||||||
|
const Algorithm algo(member.name.GetString());
|
||||||
|
if (!algo.isValid()) {
|
||||||
|
LOG_INFO("%s " BRIGHT_BLACK_BG(MAGENTA_BOLD_S " Ignoring wrong name for algo-perf[%s] "), Tags::benchmark(), member.name.GetString());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (member.value.IsDouble()) {
|
||||||
|
algo_perf[algo.id()] = member.value.GetDouble();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (member.value.IsInt()) {
|
||||||
|
algo_perf[algo.id()] = member.value.GetInt();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
LOG_INFO("%s " BRIGHT_BLACK_BG(MAGENTA_BOLD_S " Ignoring wrong value for algo-perf[%s] "), Tags::benchmark(), member.name.GetString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_isNewBenchRun = false;
|
||||||
|
for (int i = 0; bench_algos[i] != Algorithm::INVALID; ++ i)
|
||||||
|
if (algo_perf[bench_algos[i]] == 0.0f) {
|
||||||
|
m_isNewBenchRun = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double MoBenchmark::get_algo_perf(Algorithm::Id algo) const {
|
||||||
|
switch (algo) {
|
||||||
|
case Algorithm::CN_0: return algo_perf[Algorithm::CN_CCX] / 2;
|
||||||
|
case Algorithm::CN_1: return algo_perf[Algorithm::CN_R];
|
||||||
|
case Algorithm::CN_2: return algo_perf[Algorithm::CN_R];
|
||||||
|
case Algorithm::CN_RTO: return algo_perf[Algorithm::CN_R];
|
||||||
|
case Algorithm::CN_XAO: return algo_perf[Algorithm::CN_R];
|
||||||
|
case Algorithm::CN_FAST: return algo_perf[Algorithm::CN_R] * 2;
|
||||||
|
case Algorithm::CN_HALF: return algo_perf[Algorithm::CN_R] * 2;
|
||||||
|
case Algorithm::CN_RWZ: return algo_perf[Algorithm::CN_R] / 3 * 4;
|
||||||
|
case Algorithm::CN_ZLS: return algo_perf[Algorithm::CN_R] / 3 * 4;
|
||||||
|
case Algorithm::CN_DOUBLE: return algo_perf[Algorithm::CN_R] / 2;
|
||||||
|
case Algorithm::CN_LITE_0: return algo_perf[Algorithm::CN_LITE_1];
|
||||||
|
case Algorithm::CN_PICO_TLO: return algo_perf[Algorithm::CN_PICO_0];
|
||||||
|
case Algorithm::RX_SFX: return algo_perf[Algorithm::RX_0];
|
||||||
|
case Algorithm::RX_XEQ: return algo_perf[Algorithm::RX_ARQ];
|
||||||
|
default: return algo_perf[algo];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// start performance measurements for bench_algos[m_bench_algo]
|
||||||
|
void MoBenchmark::start() {
|
||||||
|
const Algorithm algo(bench_algos[m_bench_algo]);
|
||||||
|
if (algo_perf[algo.id()] > 0.0f) {
|
||||||
|
run_next_bench_algo();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// calculate number of active miner backends in m_enabled_backend_count
|
||||||
|
m_enabled_backend_count = 0;
|
||||||
|
for (auto backend : m_controller->miner()->backends()) if (backend->isEnabled() && backend->isEnabled(algo)) ++ m_enabled_backend_count;
|
||||||
|
if (m_enabled_backend_count == 0) {
|
||||||
|
LOG_INFO("%s " BRIGHT_BLACK_BG(WHITE_BOLD_S " Algo " MAGENTA_BOLD_S "%s" WHITE_BOLD_S " is skipped due to a disabled backend"), Tags::benchmark(), algo.name());
|
||||||
|
run_next_bench_algo();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LOG_INFO("%s " BRIGHT_BLACK_BG(WHITE_BOLD_S " Algo " MAGENTA_BOLD_S "%s" WHITE_BOLD_S " Preparation "), Tags::benchmark(), algo.name());
|
||||||
|
// prepare test job for benchmark runs ("benchmark" client id is to make sure we can detect benchmark jobs)
|
||||||
|
m_bench_job = Job(false, Algorithm(bench_algos[m_bench_algo]), "benchmark");
|
||||||
|
m_bench_job.setId(algo.name()); // need to set different id so that workers will see job change
|
||||||
|
switch (algo.id()) {
|
||||||
|
case Algorithm::KAWPOW_RVN:
|
||||||
|
m_bench_job.setBlob("4c38e8a5f7b2944d1e4274635d828519b97bc64a1f1c7896ecdbb139989aa0e80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
||||||
|
m_bench_job.setDiff(Job::toDiff(strtoull("000000639c000000", nullptr, 16)));
|
||||||
|
m_bench_job.setHeight(1500000);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Algorithm::GHOSTRIDER_RTM:
|
||||||
|
case Algorithm::FLEX_KCN:
|
||||||
|
m_bench_job.setBlob("000000208c246d0b90c3b389c4086e8b672ee040d64db5b9648527133e217fbfa48da64c0f3c0a0b0e8350800568b40fbb323ac3ccdf2965de51b9aaeb939b4f11ff81c49b74a16156ff251c00000000");
|
||||||
|
m_bench_job.setDiff(1000);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// 99 here to trigger all future bench_algo versions for auto veriant detection based on block version
|
||||||
|
m_bench_job.setBlob("9905A0DBD6BF05CF16E503F3A66F78007CBF34144332ECBFC22ED95C8700383B309ACE1923A0964B00000008BA939A62724C0D7581FCE5761E9D8A0E6A1C3F924FDD8493D1115649C05EB601");
|
||||||
|
m_bench_job.setTarget("FFFFFFFFFFFFFF20"); // set difficulty to 8 cause onJobResult after every 8-th computed hash
|
||||||
|
m_bench_job.setHeight(1000);
|
||||||
|
m_bench_job.setSeedHash("0000000000000000000000000000000000000000000000000000000000000001");
|
||||||
|
}
|
||||||
|
m_hash_count = 0; // number of hashes calculated for current perf bench_algo
|
||||||
|
m_time_start = 0; // init time of the first result (in ms) during the first onJobResult
|
||||||
|
m_bench_start = 0; // init time of measurements start (in ms) during the first onJobResult
|
||||||
|
m_backends_started.clear();
|
||||||
|
m_controller->miner()->setJob(m_bench_job, false); // set job for workers to compute
|
||||||
|
}
|
||||||
|
|
||||||
|
// run next bench algo or finish benchmark for the last one
|
||||||
|
void MoBenchmark::run_next_bench_algo() {
|
||||||
|
++ m_bench_algo;
|
||||||
|
if (bench_algos[m_bench_algo] != Algorithm::INVALID) {
|
||||||
|
start();
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MoBenchmark::onJobResult(const JobResult& result) {
|
||||||
|
if (result.clientId != String("benchmark")) { // switch to network pool jobs
|
||||||
|
JobResults::setListener(m_controller->network(), m_controller->config()->cpu().isHwAES());
|
||||||
|
static_cast<IJobResultListener*>(m_controller->network())->onJobResult(result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const Algorithm algo(bench_algos[m_bench_algo]);
|
||||||
|
// ignore benchmark results for other perf bench_algo
|
||||||
|
if (algo.id() == Algorithm::INVALID || result.jobId != String(algo.name())) return;
|
||||||
|
const uint64_t now = get_now();
|
||||||
|
if (!m_time_start) m_time_start = now; // time of the first result (in ms)
|
||||||
|
m_backends_started.insert(result.backend);
|
||||||
|
// waiting for all backends to start
|
||||||
|
if (m_backends_started.size() < m_enabled_backend_count && (now - m_time_start < static_cast<unsigned>(3*60*1000))) return;
|
||||||
|
++ m_hash_count;
|
||||||
|
if (!m_bench_start) {
|
||||||
|
LOG_INFO("%s " BRIGHT_BLACK_BG(WHITE_BOLD_S " Algo " MAGENTA_BOLD_S "%s" WHITE_BOLD_S " Starting test "), Tags::benchmark(), algo.name());
|
||||||
|
m_bench_start = now; // time of measurements start (in ms)
|
||||||
|
} else if (now - m_bench_start > static_cast<unsigned>(m_controller->config()->benchAlgoTime()*1000)) { // end of benchmark round for m_bench_algo
|
||||||
|
double t[3] = { 0.0 };
|
||||||
|
for (auto backend : m_controller->miner()->backends()) {
|
||||||
|
const Hashrate *hr = backend->hashrate();
|
||||||
|
if (!hr) continue;
|
||||||
|
t[0] += hr->calc(Hashrate::ShortInterval);
|
||||||
|
t[1] += hr->calc(Hashrate::MediumInterval);
|
||||||
|
t[2] += hr->calc(Hashrate::LargeInterval);
|
||||||
|
}
|
||||||
|
double hashrate = 0.0f;
|
||||||
|
if (!(hashrate = t[2]))
|
||||||
|
if (!(hashrate = t[1]))
|
||||||
|
if (!(hashrate = t[0]))
|
||||||
|
hashrate = static_cast<double>(m_hash_count) * result.diff / (now - m_bench_start) * 1000.0f;
|
||||||
|
if (algo.id() == Algorithm::KAWPOW_RVN) hashrate /= ((double)0xFFFFFFFFFFFFFFFF) / 0xFF000000;
|
||||||
|
algo_perf[algo.id()] = hashrate; // store hashrate result
|
||||||
|
LOG_INFO("%s " BRIGHT_BLACK_BG(WHITE_BOLD_S " Algo " MAGENTA_BOLD_S "%s" WHITE_BOLD_S " hashrate: " CYAN_BOLD_S "%f "), Tags::benchmark(), algo.name(), hashrate);
|
||||||
|
run_next_bench_algo();
|
||||||
|
} else switch (algo.id()) { // Update GhostRider algo job to produce more accurate perf results
|
||||||
|
case Algorithm::GHOSTRIDER_RTM: {
|
||||||
|
uint8_t* blob = m_bench_job.blob();
|
||||||
|
++ *reinterpret_cast<uint32_t*>(blob+4);
|
||||||
|
m_controller->miner()->setJob(m_bench_job, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t MoBenchmark::get_now() const { // get current time in ms
|
||||||
|
using namespace std::chrono;
|
||||||
|
return time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
|
|
||||||
|
const char *xmrig::bm_tag()
|
||||||
|
{
|
||||||
|
return Tags::benchmark();
|
||||||
|
}
|
||||||
89
src/core/MoBenchmark.h
Normal file
89
src/core/MoBenchmark.h
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2018-2020 MoneroOcean <https://github.com/MoneroOcean>, <support@moneroocean.stream>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include <map>
|
||||||
|
#include "net/interfaces/IJobResultListener.h"
|
||||||
|
#include "base/crypto/Algorithm.h"
|
||||||
|
#include "base/net/stratum/Job.h"
|
||||||
|
#include "rapidjson/fwd.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
class Controller;
|
||||||
|
class Miner;
|
||||||
|
class Job;
|
||||||
|
|
||||||
|
class MoBenchmark : public IJobResultListener {
|
||||||
|
|
||||||
|
const Algorithm::Id bench_algos[15] = {
|
||||||
|
Algorithm::FLEX_KCN,
|
||||||
|
Algorithm::GHOSTRIDER_RTM,
|
||||||
|
Algorithm::CN_R,
|
||||||
|
Algorithm::CN_LITE_1,
|
||||||
|
Algorithm::CN_HEAVY_XHV,
|
||||||
|
Algorithm::CN_PICO_0,
|
||||||
|
Algorithm::CN_CCX,
|
||||||
|
Algorithm::CN_GPU,
|
||||||
|
Algorithm::AR2_CHUKWA_V2,
|
||||||
|
Algorithm::KAWPOW_RVN,
|
||||||
|
Algorithm::RX_0,
|
||||||
|
Algorithm::RX_GRAFT,
|
||||||
|
Algorithm::RX_ARQ,
|
||||||
|
Algorithm::RX_XLA,
|
||||||
|
Algorithm::INVALID
|
||||||
|
};
|
||||||
|
|
||||||
|
Job m_bench_job;
|
||||||
|
|
||||||
|
Controller *m_controller; // to get access to config and network
|
||||||
|
bool m_isNewBenchRun; // true if benchmark is need to be executed or was executed
|
||||||
|
uint64_t m_bench_algo; // current perf algo number we benchmark (in bench_algos array)
|
||||||
|
uint64_t m_hash_count; // number of hashes calculated for current perf algo
|
||||||
|
uint64_t m_time_start; // time of the first resultt for current perf algo (in ms)
|
||||||
|
uint64_t m_bench_start; // time of measurements start for current perf algo (in ms) after all backends are started
|
||||||
|
unsigned m_enabled_backend_count; // number of active miner backends
|
||||||
|
std::set<uint32_t> m_backends_started; // id of backend started for benchmark
|
||||||
|
|
||||||
|
uint64_t get_now() const; // get current time in ms
|
||||||
|
double get_algo_perf(Algorithm::Id algo) const; // get algo perf based on algo_perf known perf numbers
|
||||||
|
void start(); // start benchmark for m_bench_algo number
|
||||||
|
void finish(); // end of benchmarks, switch to jobs from the pool (network), fill algo_perf
|
||||||
|
void onJobResult(const JobResult&) override; // onJobResult is called after each computed benchmark hash
|
||||||
|
void run_next_bench_algo(); // run next bench algo or finish benchmark for the last one
|
||||||
|
|
||||||
|
public:
|
||||||
|
MoBenchmark();
|
||||||
|
virtual ~MoBenchmark();
|
||||||
|
|
||||||
|
void set_controller(std::shared_ptr<Controller> controller) { m_controller = controller.get(); }
|
||||||
|
|
||||||
|
void start_perf(); // start benchmarks
|
||||||
|
void flush_perf();
|
||||||
|
|
||||||
|
bool isNewBenchRun() const { return m_isNewBenchRun; }
|
||||||
|
mutable std::map<Algorithm::Id, double> algo_perf;
|
||||||
|
|
||||||
|
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||||
|
void read(const rapidjson::Value &value);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
@@ -202,6 +202,12 @@ bool xmrig::Config::isShouldSave() const
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
if (m_benchmark.isNewBenchRun()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
return (m_upgrade || cpu().isShouldSave());
|
return (m_upgrade || cpu().isShouldSave());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,6 +245,10 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName)
|
|||||||
d_ptr->healthPrintTime = reader.getUint(kHealthPrintTime, d_ptr->healthPrintTime);
|
d_ptr->healthPrintTime = reader.getUint(kHealthPrintTime, d_ptr->healthPrintTime);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
m_benchmark.read(reader.getValue(kAlgoPerf));
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_DMI
|
# ifdef XMRIG_FEATURE_DMI
|
||||||
d_ptr->dmi = reader.getBool(kDMI, d_ptr->dmi);
|
d_ptr->dmi = reader.getBool(kDMI, d_ptr->dmi);
|
||||||
# endif
|
# endif
|
||||||
@@ -303,6 +313,14 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
|||||||
doc.AddMember(StringRef(kUserAgent), m_userAgent.toJSON(), allocator);
|
doc.AddMember(StringRef(kUserAgent), m_userAgent.toJSON(), allocator);
|
||||||
doc.AddMember(StringRef(kVerbose), Log::verbose(), allocator);
|
doc.AddMember(StringRef(kVerbose), Log::verbose(), allocator);
|
||||||
doc.AddMember(StringRef(kWatch), m_watch, allocator);
|
doc.AddMember(StringRef(kWatch), m_watch, allocator);
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
doc.AddMember(StringRef(kRebenchAlgo), isRebenchAlgo(), allocator);
|
||||||
|
doc.AddMember(StringRef(kBenchAlgoTime), benchAlgoTime(), allocator);
|
||||||
|
doc.AddMember(StringRef(kAlgoMinTime), algoMinTime(), allocator);
|
||||||
|
doc.AddMember(StringRef(kAlgoPerf), m_benchmark.toJSON(doc), allocator);
|
||||||
|
# endif
|
||||||
|
|
||||||
doc.AddMember(StringRef(kPauseOnBattery), isPauseOnBattery(), allocator);
|
doc.AddMember(StringRef(kPauseOnBattery), isPauseOnBattery(), allocator);
|
||||||
doc.AddMember(StringRef(kPauseOnActive), (d_ptr->idleTime == 0U || d_ptr->idleTime == kIdleTime) ? Value(isPauseOnActive()) : Value(d_ptr->idleTime), allocator);
|
doc.AddMember(StringRef(kPauseOnActive), (d_ptr->idleTime == 0U || d_ptr->idleTime == kIdleTime) ? Value(isPauseOnActive()) : Value(d_ptr->idleTime), allocator);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,9 @@
|
|||||||
#include "backend/cpu/CpuConfig.h"
|
#include "backend/cpu/CpuConfig.h"
|
||||||
#include "base/kernel/config/BaseConfig.h"
|
#include "base/kernel/config/BaseConfig.h"
|
||||||
#include "base/tools/Object.h"
|
#include "base/tools/Object.h"
|
||||||
|
#ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
#include "core/MoBenchmark.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
@@ -100,8 +103,15 @@ public:
|
|||||||
bool read(const IJsonReader &reader, const char *fileName) override;
|
bool read(const IJsonReader &reader, const char *fileName) override;
|
||||||
void getJSON(rapidjson::Document &doc) const override;
|
void getJSON(rapidjson::Document &doc) const override;
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
inline MoBenchmark &benchmark() { return m_benchmark; }
|
||||||
|
# endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConfigPrivate *d_ptr;
|
ConfigPrivate *d_ptr;
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
MoBenchmark m_benchmark;
|
||||||
|
# endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ static const char *kAsterisk = "*";
|
|||||||
static const char *kEnabled = "enabled";
|
static const char *kEnabled = "enabled";
|
||||||
static const char *kIntensity = "intensity";
|
static const char *kIntensity = "intensity";
|
||||||
static const char *kThreads = "threads";
|
static const char *kThreads = "threads";
|
||||||
|
#ifdef XMRIG_ALGO_KAWPOW
|
||||||
|
//static const char *kKawPow = "kawpow";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static inline uint64_t intensity(uint64_t av)
|
static inline uint64_t intensity(uint64_t av)
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ static const option options[] = {
|
|||||||
{ "keepalive", 0, nullptr, IConfig::KeepAliveKey },
|
{ "keepalive", 0, nullptr, IConfig::KeepAliveKey },
|
||||||
{ "log-file", 1, nullptr, IConfig::LogFileKey },
|
{ "log-file", 1, nullptr, IConfig::LogFileKey },
|
||||||
{ "nicehash", 0, nullptr, IConfig::NicehashKey },
|
{ "nicehash", 0, nullptr, IConfig::NicehashKey },
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
{ "rebench-algo", 0, nullptr, IConfig::RebenchAlgoKey },
|
||||||
|
{ "bench-algo-time", 1, nullptr, IConfig::BenchAlgoTimeKey },
|
||||||
|
{ "algo-min-time", 1, nullptr, IConfig::AlgoMinTimeKey },
|
||||||
|
# endif
|
||||||
{ "no-color", 0, nullptr, IConfig::ColorKey },
|
{ "no-color", 0, nullptr, IConfig::ColorKey },
|
||||||
{ "no-huge-pages", 0, nullptr, IConfig::HugePagesKey },
|
{ "no-huge-pages", 0, nullptr, IConfig::HugePagesKey },
|
||||||
{ "no-hugepages", 0, nullptr, IConfig::HugePagesKey },
|
{ "no-hugepages", 0, nullptr, IConfig::HugePagesKey },
|
||||||
|
|||||||
@@ -201,6 +201,13 @@ static inline const std::string &usage()
|
|||||||
u += " --no-dmi disable DMI/SMBIOS reader\n";
|
u += " --no-dmi disable DMI/SMBIOS reader\n";
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_MO_BENCHMARK
|
||||||
|
u += "\nMoneroOcean Benchmark (algo-perf):\n";
|
||||||
|
u += " --rebench-algo run algo-perf benchmark (default if config contains no algo-perf)\n";
|
||||||
|
u += " --bench-algo-time=N run algo-perf benchmark this many seconds per algo (default: 10)\n";
|
||||||
|
u += " --algo-min-time=N when mining, avoid switching more often than every N seconds (default: 0/disabled)\n";
|
||||||
|
# endif
|
||||||
|
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,11 @@ public:
|
|||||||
return CN_ITER / 32;
|
return CN_ITER / 32;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
case Algorithm::CN_GPU:
|
||||||
|
return 0xC000;
|
||||||
|
# endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -109,6 +114,12 @@ public:
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
if (algo == Algorithm::CN_GPU) {
|
||||||
|
return 0x1FFFC0;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
if (algo == Algorithm::CN_GR_1) {
|
if (algo == Algorithm::CN_GR_1) {
|
||||||
return 0x3FFF0;
|
return 0x3FFF0;
|
||||||
@@ -142,10 +153,12 @@ template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_0>::iterations()
|
|||||||
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_TLO>::iterations() const { return CN_ITER / 8; }
|
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_TLO>::iterations() const { return CN_ITER / 8; }
|
||||||
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_CCX>::iterations() const { return CN_ITER / 2; }
|
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_CCX>::iterations() const { return CN_ITER / 2; }
|
||||||
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_UPX2>::iterations() const { return CN_ITER / 32; }
|
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_UPX2>::iterations() const { return CN_ITER / 32; }
|
||||||
|
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_GPU>::iterations() const { return 0xC000; }
|
||||||
|
|
||||||
|
|
||||||
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_0>::mask() const { return 0x1FFF0; }
|
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_0>::mask() const { return 0x1FFF0; }
|
||||||
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_UPX2>::mask() const { return 0x1FFF0; }
|
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_UPX2>::mask() const { return 0x1FFF0; }
|
||||||
|
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_GPU>::mask() const { return 0x1FFFC0; }
|
||||||
|
|
||||||
#ifdef XMRIG_ALGO_GHOSTRIDER
|
#ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_GR_0>::iterations() const { return CN_ITER / 4; }
|
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_GR_0>::iterations() const { return CN_ITER / 4; }
|
||||||
|
|||||||
@@ -356,6 +356,12 @@ xmrig::CnHash::CnHash()
|
|||||||
ADD_FN_ASM(Algorithm::CN_UPX2);
|
ADD_FN_ASM(Algorithm::CN_UPX2);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
m_map[Algorithm::CN_GPU] = new cn_hash_fun_array{};
|
||||||
|
m_map[Algorithm::CN_GPU]->data[AV_SINGLE][Assembly::NONE] = cryptonight_single_hash_gpu<Algorithm::CN_GPU, false>;
|
||||||
|
m_map[Algorithm::CN_GPU]->data[AV_SINGLE_SOFT][Assembly::NONE] = cryptonight_single_hash_gpu<Algorithm::CN_GPU, true>;
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_ARGON2
|
# ifdef XMRIG_ALGO_ARGON2
|
||||||
m_map[Algorithm::AR2_CHUKWA] = new cn_hash_fun_array{};
|
m_map[Algorithm::AR2_CHUKWA] = new cn_hash_fun_array{};
|
||||||
m_map[Algorithm::AR2_CHUKWA]->data[AV_SINGLE][Assembly::NONE] = argon2::single_hash<Algorithm::AR2_CHUKWA>;
|
m_map[Algorithm::AR2_CHUKWA]->data[AV_SINGLE][Assembly::NONE] = argon2::single_hash<Algorithm::AR2_CHUKWA>;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#if defined _MSC_VER || defined XMRIG_ARM
|
#if defined _MSC_VER || defined XMRIG_ARM || defined __INTEL_COMPILER
|
||||||
# define ABI_ATTRIBUTE
|
# define ABI_ATTRIBUTE
|
||||||
#else
|
#else
|
||||||
# define ABI_ATTRIBUTE __attribute__((ms_abi))
|
# define ABI_ATTRIBUTE __attribute__((ms_abi))
|
||||||
|
|||||||
@@ -230,7 +230,11 @@ static inline void cn_implode_scratchpad(const __m128i *input, __m128i *output)
|
|||||||
{
|
{
|
||||||
constexpr CnAlgo<ALGO> props;
|
constexpr CnAlgo<ALGO> props;
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
constexpr bool IS_HEAVY = props.isHeavy() || ALGO == Algorithm::CN_GPU;
|
||||||
|
# else
|
||||||
constexpr bool IS_HEAVY = props.isHeavy();
|
constexpr bool IS_HEAVY = props.isHeavy();
|
||||||
|
# endif
|
||||||
|
|
||||||
__m128i xout0, xout1, xout2, xout3, xout4, xout5, xout6, xout7;
|
__m128i xout0, xout1, xout2, xout3, xout4, xout5, xout6, xout7;
|
||||||
__m128i k0, k1, k2, k3, k4, k5, k6, k7, k8, k9;
|
__m128i k0, k1, k2, k3, k4, k5, k6, k7, k8, k9;
|
||||||
@@ -543,6 +547,66 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
template<size_t ITER, uint32_t MASK>
|
||||||
|
void cn_gpu_inner_arm(const uint8_t *spad, uint8_t *lpad);
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
template<size_t MEM>
|
||||||
|
void cn_explode_scratchpad_gpu(const uint8_t *input, uint8_t *output)
|
||||||
|
{
|
||||||
|
constexpr size_t hash_size = 200; // 25x8 bytes
|
||||||
|
alignas(16) uint64_t hash[25];
|
||||||
|
|
||||||
|
for (uint64_t i = 0; i < MEM / 512; i++) {
|
||||||
|
memcpy(hash, input, hash_size);
|
||||||
|
hash[0] ^= i;
|
||||||
|
|
||||||
|
xmrig::keccakf(hash, 24);
|
||||||
|
memcpy(output, hash, 160);
|
||||||
|
output += 160;
|
||||||
|
|
||||||
|
xmrig::keccakf(hash, 24);
|
||||||
|
memcpy(output, hash, 176);
|
||||||
|
output += 176;
|
||||||
|
|
||||||
|
xmrig::keccakf(hash, 24);
|
||||||
|
memcpy(output, hash, 176);
|
||||||
|
output += 176;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<xmrig::Algorithm::Id ALGO, bool SOFT_AES>
|
||||||
|
inline void cryptonight_single_hash_gpu(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx **__restrict__ ctx, uint64_t height)
|
||||||
|
{
|
||||||
|
constexpr CnAlgo<ALGO> props;
|
||||||
|
|
||||||
|
keccak(input, size, ctx[0]->state);
|
||||||
|
cn_explode_scratchpad_gpu<props.memory()>(ctx[0]->state, ctx[0]->memory);
|
||||||
|
|
||||||
|
fesetround(FE_TONEAREST);
|
||||||
|
|
||||||
|
cn_gpu_inner_arm<props.iterations(), props.mask()>(ctx[0]->state, ctx[0]->memory);
|
||||||
|
|
||||||
|
cn_implode_scratchpad<ALGO, SOFT_AES>(reinterpret_cast<const __m128i *>(ctx[0]->memory), reinterpret_cast<__m128i *>(ctx[0]->state));
|
||||||
|
keccakf(reinterpret_cast<uint64_t*>(ctx[0]->state), 24);
|
||||||
|
memcpy(output, ctx[0]->state, 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace xmrig */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
template<Algorithm::Id ALGO, bool SOFT_AES>
|
template<Algorithm::Id ALGO, bool SOFT_AES>
|
||||||
inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, struct cryptonight_ctx **__restrict__ ctx, uint64_t height)
|
inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, struct cryptonight_ctx **__restrict__ ctx, uint64_t height)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -387,6 +387,23 @@ const static uint8_t test_output_femto_upx2[256] = {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
// "cn/gpu"
|
||||||
|
const static uint8_t test_output_gpu[160] = {
|
||||||
|
0xE5, 0x5C, 0xB2, 0x3E, 0x51, 0x64, 0x9A, 0x59, 0xB1, 0x27, 0xB9, 0x6B, 0x51, 0x5F, 0x2B, 0xF7,
|
||||||
|
0xBF, 0xEA, 0x19, 0x97, 0x41, 0xA0, 0x21, 0x6C, 0xF8, 0x38, 0xDE, 0xD0, 0x6E, 0xFF, 0x82, 0xDF,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef XMRIG_ALGO_ARGON2
|
#ifdef XMRIG_ALGO_ARGON2
|
||||||
// "argon2/chukwa"
|
// "argon2/chukwa"
|
||||||
const static uint8_t argon2_chukwa_test_out[256] = {
|
const static uint8_t argon2_chukwa_test_out[256] = {
|
||||||
@@ -452,6 +469,11 @@ const static uint8_t test_output_gr[256] = {
|
|||||||
0xC4, 0xA7, 0xC7, 0x77, 0xAD, 0xF8, 0x09, 0x61, 0x16, 0xBB, 0xAA, 0x7E, 0xAB, 0xC3, 0x00, 0x25,
|
0xC4, 0xA7, 0xC7, 0x77, 0xAD, 0xF8, 0x09, 0x61, 0x16, 0xBB, 0xAA, 0x7E, 0xAB, 0xC3, 0x00, 0x25,
|
||||||
0xBA, 0xA8, 0x97, 0xC7, 0x7D, 0x38, 0x46, 0x0E, 0x59, 0xAC, 0xCB, 0xAE, 0xFE, 0x3C, 0x6F, 0x01
|
0xBA, 0xA8, 0x97, 0xC7, 0x7D, 0x38, 0x46, 0x0E, 0x59, 0xAC, 0xCB, 0xAE, 0xFE, 0x3C, 0x6F, 0x01
|
||||||
};
|
};
|
||||||
|
// "Flex"
|
||||||
|
const static uint8_t test_output_flex[32] = {
|
||||||
|
0x2e, 0x4f, 0x85, 0x7a, 0xa8, 0x10, 0x08, 0xc4, 0xd1, 0xfe, 0x9a, 0xcd, 0x74, 0x89, 0xe8, 0x4d,
|
||||||
|
0x3b, 0xc5, 0x5b, 0x70, 0x54, 0xe6, 0xc0, 0x2b, 0x2c, 0x0e, 0x1b, 0x76, 0xcc, 0xa0, 0xda, 0x7b
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -294,8 +294,14 @@ static NOINLINE void cn_explode_scratchpad(cryptonight_ctx *ctx)
|
|||||||
{
|
{
|
||||||
constexpr CnAlgo<ALGO> props;
|
constexpr CnAlgo<ALGO> props;
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
constexpr bool IS_HEAVY = props.isHeavy() || ALGO == Algorithm::CN_GPU;
|
||||||
|
# else
|
||||||
|
constexpr bool IS_HEAVY = props.isHeavy();
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_VAES
|
# ifdef XMRIG_VAES
|
||||||
if (!SOFT_AES && !props.isHeavy() && cn_vaes_enabled) {
|
if (!SOFT_AES && !IS_HEAVY && cn_vaes_enabled) {
|
||||||
cn_explode_scratchpad_vaes(ctx, props.memory(), props.half_mem());
|
cn_explode_scratchpad_vaes(ctx, props.memory(), props.half_mem());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -408,14 +414,19 @@ static NOINLINE void cn_implode_scratchpad(cryptonight_ctx *ctx)
|
|||||||
{
|
{
|
||||||
constexpr CnAlgo<ALGO> props;
|
constexpr CnAlgo<ALGO> props;
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
constexpr bool IS_HEAVY = props.isHeavy() || ALGO == Algorithm::CN_GPU;
|
||||||
|
# else
|
||||||
|
constexpr bool IS_HEAVY = props.isHeavy();
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_VAES
|
# ifdef XMRIG_VAES
|
||||||
if (!SOFT_AES && !props.isHeavy() && cn_vaes_enabled) {
|
if (!SOFT_AES && !IS_HEAVY && cn_vaes_enabled) {
|
||||||
cn_implode_scratchpad_vaes(ctx, props.memory(), props.half_mem());
|
cn_implode_scratchpad_vaes(ctx, props.memory(), props.half_mem());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
constexpr bool IS_HEAVY = props.isHeavy();
|
|
||||||
constexpr size_t N = (props.memory() / sizeof(__m128i)) / (props.half_mem() ? 2 : 1);
|
constexpr size_t N = (props.memory() / sizeof(__m128i)) / (props.half_mem() ? 2 : 1);
|
||||||
|
|
||||||
__m128i xout0, xout1, xout2, xout3, xout4, xout5, xout6, xout7;
|
__m128i xout0, xout1, xout2, xout3, xout4, xout5, xout6, xout7;
|
||||||
@@ -578,8 +589,10 @@ static inline __m128i int_sqrt_v2(const uint64_t n0)
|
|||||||
r >>= 19;
|
r >>= 19;
|
||||||
|
|
||||||
uint64_t x2 = (s - (1022ULL << 32)) * (r - s - (1022ULL << 32) + 1);
|
uint64_t x2 = (s - (1022ULL << 32)) * (r - s - (1022ULL << 32) + 1);
|
||||||
# if (defined(_MSC_VER) || __GNUC__ > 7 || (__GNUC__ == 7 && __GNUC_MINOR__ > 1)) && (defined(__x86_64__) || defined(_M_AMD64))
|
# if (defined(_MSC_VER) || __GNUC__ > 7 || (__GNUC__ == 7 && __GNUC_MINOR__ > 1)) && (defined(__x86_64__) || defined(_M_AMD64)) && !defined(__INTEL_COMPILER)
|
||||||
_addcarry_u64(_subborrow_u64(0, x2, n0, (unsigned long long int*)&x2), r, 0, (unsigned long long int*)&r);
|
_addcarry_u64(_subborrow_u64(0, x2, n0, (unsigned long long int*)&x2), r, 0, (unsigned long long int*)&r);
|
||||||
|
# elif defined(__INTEL_COMPILER)
|
||||||
|
_addcarry_u64(_subborrow_u64(0, x2, n0, (unsigned long int*)&x2), r, 0, (unsigned long int*)&r);
|
||||||
# else
|
# else
|
||||||
if (x2 < n0) ++r;
|
if (x2 < n0) ++r;
|
||||||
# endif
|
# endif
|
||||||
@@ -847,6 +860,76 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
|
|||||||
} /* namespace xmrig */
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
template<size_t ITER, uint32_t MASK>
|
||||||
|
void cn_gpu_inner_avx(const uint8_t *spad, uint8_t *lpad);
|
||||||
|
|
||||||
|
|
||||||
|
template<size_t ITER, uint32_t MASK>
|
||||||
|
void cn_gpu_inner_ssse3(const uint8_t *spad, uint8_t *lpad);
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
template<size_t MEM>
|
||||||
|
static NOINLINE void cn_explode_scratchpad_gpu(cryptonight_ctx *ctx)
|
||||||
|
{
|
||||||
|
const uint8_t* input = reinterpret_cast<const uint8_t*>(ctx->state);
|
||||||
|
uint8_t* output = reinterpret_cast<uint8_t*>(ctx->memory);
|
||||||
|
|
||||||
|
constexpr size_t hash_size = 200; // 25x8 bytes
|
||||||
|
alignas(16) uint64_t hash[25];
|
||||||
|
|
||||||
|
for (uint64_t i = 0; i < MEM / 512; i++) {
|
||||||
|
memcpy(hash, input, hash_size);
|
||||||
|
hash[0] ^= i;
|
||||||
|
|
||||||
|
xmrig::keccakf(hash, 24);
|
||||||
|
memcpy(output, hash, 160);
|
||||||
|
output += 160;
|
||||||
|
|
||||||
|
xmrig::keccakf(hash, 24);
|
||||||
|
memcpy(output, hash, 176);
|
||||||
|
output += 176;
|
||||||
|
|
||||||
|
xmrig::keccakf(hash, 24);
|
||||||
|
memcpy(output, hash, 176);
|
||||||
|
output += 176;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<Algorithm::Id ALGO, bool SOFT_AES>
|
||||||
|
inline void cryptonight_single_hash_gpu(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx **__restrict__ ctx, uint64_t height)
|
||||||
|
{
|
||||||
|
constexpr CnAlgo<ALGO> props;
|
||||||
|
|
||||||
|
keccak(input, size, ctx[0]->state);
|
||||||
|
cn_explode_scratchpad_gpu<props.memory()>(ctx[0]);
|
||||||
|
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
_control87(RC_NEAR, MCW_RC);
|
||||||
|
# else
|
||||||
|
fesetround(FE_TONEAREST);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
if (xmrig::Cpu::info()->hasAVX2()) {
|
||||||
|
cn_gpu_inner_avx<props.iterations(), props.mask()>(ctx[0]->state, ctx[0]->memory);
|
||||||
|
} else {
|
||||||
|
cn_gpu_inner_ssse3<props.iterations(), props.mask()>(ctx[0]->state, ctx[0]->memory);
|
||||||
|
}
|
||||||
|
|
||||||
|
cn_implode_scratchpad<ALGO, SOFT_AES, 0>(ctx[0]);
|
||||||
|
keccakf(reinterpret_cast<uint64_t*>(ctx[0]->state), 24);
|
||||||
|
memcpy(output, ctx[0]->state, 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} /* namespace xmrig */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef XMRIG_FEATURE_ASM
|
#ifdef XMRIG_FEATURE_ASM
|
||||||
extern "C" void cnv1_single_mainloop_asm(cryptonight_ctx * *ctx);
|
extern "C" void cnv1_single_mainloop_asm(cryptonight_ctx * *ctx);
|
||||||
extern "C" void cnv1_double_mainloop_asm(cryptonight_ctx **ctx);
|
extern "C" void cnv1_double_mainloop_asm(cryptonight_ctx **ctx);
|
||||||
@@ -1155,9 +1238,7 @@ static NOINLINE void cryptonight_single_hash_gr_sse41(const uint8_t* __restrict_
|
|||||||
|
|
||||||
keccak(input, size, ctx[0]->state);
|
keccak(input, size, ctx[0]->state);
|
||||||
|
|
||||||
if (props.half_mem()) {
|
if (props.half_mem()) ctx[0]->first_half = true;
|
||||||
ctx[0]->first_half = true;
|
|
||||||
}
|
|
||||||
cn_explode_scratchpad<ALGO, false, 0>(ctx[0]);
|
cn_explode_scratchpad<ALGO, false, 0>(ctx[0]);
|
||||||
|
|
||||||
VARIANT1_INIT(0);
|
VARIANT1_INIT(0);
|
||||||
|
|||||||
240
src/crypto/cn/gpu/cn_gpu_arm.cpp
Normal file
240
src/crypto/cn/gpu/cn_gpu_arm.cpp
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <arm_neon.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "crypto/cn/CnAlgo.h"
|
||||||
|
|
||||||
|
|
||||||
|
inline void vandq_f32(float32x4_t &v, uint32_t v2)
|
||||||
|
{
|
||||||
|
uint32x4_t vc = vdupq_n_u32(v2);
|
||||||
|
v = (float32x4_t)vandq_u32((uint32x4_t)v, vc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void vorq_f32(float32x4_t &v, uint32_t v2)
|
||||||
|
{
|
||||||
|
uint32x4_t vc = vdupq_n_u32(v2);
|
||||||
|
v = (float32x4_t)vorrq_u32((uint32x4_t)v, vc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <size_t v>
|
||||||
|
inline void vrot_si32(int32x4_t &r)
|
||||||
|
{
|
||||||
|
r = (int32x4_t)vextq_s8((int8x16_t)r, (int8x16_t)r, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline void vrot_si32<0>(int32x4_t &r)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline uint32_t vheor_s32(const int32x4_t &v)
|
||||||
|
{
|
||||||
|
int32x4_t v0 = veorq_s32(v, vrev64q_s32(v));
|
||||||
|
int32x2_t vf = veor_s32(vget_high_s32(v0), vget_low_s32(v0));
|
||||||
|
return (uint32_t)vget_lane_s32(vf, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void prep_dv(int32_t *idx, int32x4_t &v, float32x4_t &n)
|
||||||
|
{
|
||||||
|
v = vld1q_s32(idx);
|
||||||
|
n = vcvtq_f32_s32(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void sub_round(const float32x4_t &n0, const float32x4_t &n1, const float32x4_t &n2, const float32x4_t &n3, const float32x4_t &rnd_c, float32x4_t &n, float32x4_t &d, float32x4_t &c)
|
||||||
|
{
|
||||||
|
float32x4_t ln1 = vaddq_f32(n1, c);
|
||||||
|
float32x4_t nn = vmulq_f32(n0, c);
|
||||||
|
nn = vmulq_f32(ln1, vmulq_f32(nn, nn));
|
||||||
|
vandq_f32(nn, 0xFEFFFFFF);
|
||||||
|
vorq_f32(nn, 0x00800000);
|
||||||
|
n = vaddq_f32(n, nn);
|
||||||
|
|
||||||
|
float32x4_t ln3 = vsubq_f32(n3, c);
|
||||||
|
float32x4_t dd = vmulq_f32(n2, c);
|
||||||
|
dd = vmulq_f32(ln3, vmulq_f32(dd, dd));
|
||||||
|
vandq_f32(dd, 0xFEFFFFFF);
|
||||||
|
vorq_f32(dd, 0x00800000);
|
||||||
|
d = vaddq_f32(d, dd);
|
||||||
|
|
||||||
|
//Constant feedback
|
||||||
|
c = vaddq_f32(c, rnd_c);
|
||||||
|
c = vaddq_f32(c, vdupq_n_f32(0.734375f));
|
||||||
|
float32x4_t r = vaddq_f32(nn, dd);
|
||||||
|
vandq_f32(r, 0x807FFFFF);
|
||||||
|
vorq_f32(r, 0x40000000);
|
||||||
|
c = vaddq_f32(c, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void round_compute(const float32x4_t &n0, const float32x4_t &n1, const float32x4_t &n2, const float32x4_t &n3, const float32x4_t &rnd_c, float32x4_t &c, float32x4_t &r)
|
||||||
|
{
|
||||||
|
float32x4_t n = vdupq_n_f32(0.0f), d = vdupq_n_f32(0.0f);
|
||||||
|
|
||||||
|
sub_round(n0, n1, n2, n3, rnd_c, n, d, c);
|
||||||
|
sub_round(n1, n2, n3, n0, rnd_c, n, d, c);
|
||||||
|
sub_round(n2, n3, n0, n1, rnd_c, n, d, c);
|
||||||
|
sub_round(n3, n0, n1, n2, rnd_c, n, d, c);
|
||||||
|
sub_round(n3, n2, n1, n0, rnd_c, n, d, c);
|
||||||
|
sub_round(n2, n1, n0, n3, rnd_c, n, d, c);
|
||||||
|
sub_round(n1, n0, n3, n2, rnd_c, n, d, c);
|
||||||
|
sub_round(n0, n3, n2, n1, rnd_c, n, d, c);
|
||||||
|
|
||||||
|
// Make sure abs(d) > 2.0 - this prevents division by zero and accidental overflows by division by < 1.0
|
||||||
|
vandq_f32(d, 0xFF7FFFFF);
|
||||||
|
vorq_f32(d, 0x40000000);
|
||||||
|
r = vaddq_f32(r, vdivq_f32(n, d));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 112×4 = 448
|
||||||
|
template <bool add>
|
||||||
|
inline int32x4_t single_compute(const float32x4_t &n0, const float32x4_t &n1, const float32x4_t &n2, const float32x4_t &n3, float cnt, const float32x4_t &rnd_c, float32x4_t &sum)
|
||||||
|
{
|
||||||
|
float32x4_t c = vdupq_n_f32(cnt);
|
||||||
|
float32x4_t r = vdupq_n_f32(0.0f);
|
||||||
|
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
|
||||||
|
// do a quick fmod by setting exp to 2
|
||||||
|
vandq_f32(r, 0x807FFFFF);
|
||||||
|
vorq_f32(r, 0x40000000);
|
||||||
|
|
||||||
|
if (add) {
|
||||||
|
sum = vaddq_f32(sum, r);
|
||||||
|
} else {
|
||||||
|
sum = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float32x4_t cc2 = vdupq_n_f32(536870880.0f);
|
||||||
|
r = vmulq_f32(r, cc2); // 35
|
||||||
|
return vcvtq_s32_f32(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<size_t rot>
|
||||||
|
inline void single_compute_wrap(const float32x4_t &n0, const float32x4_t &n1, const float32x4_t &n2, const float32x4_t &n3, float cnt, const float32x4_t &rnd_c, float32x4_t &sum, int32x4_t &out)
|
||||||
|
{
|
||||||
|
int32x4_t r = single_compute<rot % 2 != 0>(n0, n1, n2, n3, cnt, rnd_c, sum);
|
||||||
|
vrot_si32<rot>(r);
|
||||||
|
out = veorq_s32(out, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<uint32_t MASK>
|
||||||
|
inline int32_t *scratchpad_ptr(uint8_t* lpad, uint32_t idx, size_t n) { return reinterpret_cast<int32_t *>(lpad + (idx & MASK) + n * 16); }
|
||||||
|
|
||||||
|
|
||||||
|
template<size_t ITER, uint32_t MASK>
|
||||||
|
void cn_gpu_inner_arm(const uint8_t *spad, uint8_t *lpad)
|
||||||
|
{
|
||||||
|
uint32_t s = reinterpret_cast<const uint32_t*>(spad)[0] >> 8;
|
||||||
|
int32_t *idx0 = scratchpad_ptr<MASK>(lpad, s, 0);
|
||||||
|
int32_t *idx1 = scratchpad_ptr<MASK>(lpad, s, 1);
|
||||||
|
int32_t *idx2 = scratchpad_ptr<MASK>(lpad, s, 2);
|
||||||
|
int32_t *idx3 = scratchpad_ptr<MASK>(lpad, s, 3);
|
||||||
|
float32x4_t sum0 = vdupq_n_f32(0.0f);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < ITER; i++) {
|
||||||
|
float32x4_t n0, n1, n2, n3;
|
||||||
|
int32x4_t v0, v1, v2, v3;
|
||||||
|
float32x4_t suma, sumb, sum1, sum2, sum3;
|
||||||
|
|
||||||
|
prep_dv(idx0, v0, n0);
|
||||||
|
prep_dv(idx1, v1, n1);
|
||||||
|
prep_dv(idx2, v2, n2);
|
||||||
|
prep_dv(idx3, v3, n3);
|
||||||
|
float32x4_t rc = sum0;
|
||||||
|
|
||||||
|
int32x4_t out, out2;
|
||||||
|
out = vdupq_n_s32(0);
|
||||||
|
single_compute_wrap<0>(n0, n1, n2, n3, 1.3437500f, rc, suma, out);
|
||||||
|
single_compute_wrap<1>(n0, n2, n3, n1, 1.2812500f, rc, suma, out);
|
||||||
|
single_compute_wrap<2>(n0, n3, n1, n2, 1.3593750f, rc, sumb, out);
|
||||||
|
single_compute_wrap<3>(n0, n3, n2, n1, 1.3671875f, rc, sumb, out);
|
||||||
|
sum0 = vaddq_f32(suma, sumb);
|
||||||
|
vst1q_s32(idx0, veorq_s32(v0, out));
|
||||||
|
out2 = out;
|
||||||
|
|
||||||
|
out = vdupq_n_s32(0);
|
||||||
|
single_compute_wrap<0>(n1, n0, n2, n3, 1.4296875f, rc, suma, out);
|
||||||
|
single_compute_wrap<1>(n1, n2, n3, n0, 1.3984375f, rc, suma, out);
|
||||||
|
single_compute_wrap<2>(n1, n3, n0, n2, 1.3828125f, rc, sumb, out);
|
||||||
|
single_compute_wrap<3>(n1, n3, n2, n0, 1.3046875f, rc, sumb, out);
|
||||||
|
sum1 = vaddq_f32(suma, sumb);
|
||||||
|
vst1q_s32(idx1, veorq_s32(v1, out));
|
||||||
|
out2 = veorq_s32(out2, out);
|
||||||
|
|
||||||
|
out = vdupq_n_s32(0);
|
||||||
|
single_compute_wrap<0>(n2, n1, n0, n3, 1.4140625f, rc, suma, out);
|
||||||
|
single_compute_wrap<1>(n2, n0, n3, n1, 1.2734375f, rc, suma, out);
|
||||||
|
single_compute_wrap<2>(n2, n3, n1, n0, 1.2578125f, rc, sumb, out);
|
||||||
|
single_compute_wrap<3>(n2, n3, n0, n1, 1.2890625f, rc, sumb, out);
|
||||||
|
sum2 = vaddq_f32(suma, sumb);
|
||||||
|
vst1q_s32(idx2, veorq_s32(v2, out));
|
||||||
|
out2 = veorq_s32(out2, out);
|
||||||
|
|
||||||
|
out = vdupq_n_s32(0);
|
||||||
|
single_compute_wrap<0>(n3, n1, n2, n0, 1.3203125f, rc, suma, out);
|
||||||
|
single_compute_wrap<1>(n3, n2, n0, n1, 1.3515625f, rc, suma, out);
|
||||||
|
single_compute_wrap<2>(n3, n0, n1, n2, 1.3359375f, rc, sumb, out);
|
||||||
|
single_compute_wrap<3>(n3, n0, n2, n1, 1.4609375f, rc, sumb, out);
|
||||||
|
sum3 = vaddq_f32(suma, sumb);
|
||||||
|
vst1q_s32(idx3, veorq_s32(v3, out));
|
||||||
|
out2 = veorq_s32(out2, out);
|
||||||
|
|
||||||
|
sum0 = vaddq_f32(sum0, sum1);
|
||||||
|
sum2 = vaddq_f32(sum2, sum3);
|
||||||
|
sum0 = vaddq_f32(sum0, sum2);
|
||||||
|
|
||||||
|
const float32x4_t cc1 = vdupq_n_f32(16777216.0f);
|
||||||
|
const float32x4_t cc2 = vdupq_n_f32(64.0f);
|
||||||
|
vandq_f32(sum0, 0x7fffffff); // take abs(va) by masking the float sign bit
|
||||||
|
// vs range 0 - 64
|
||||||
|
n0 = vmulq_f32(sum0, cc1);
|
||||||
|
v0 = vcvtq_s32_f32(n0);
|
||||||
|
v0 = veorq_s32(v0, out2);
|
||||||
|
uint32_t n = vheor_s32(v0);
|
||||||
|
|
||||||
|
// vs is now between 0 and 1
|
||||||
|
sum0 = vdivq_f32(sum0, cc2);
|
||||||
|
idx0 = scratchpad_ptr<MASK>(lpad, n, 0);
|
||||||
|
idx1 = scratchpad_ptr<MASK>(lpad, n, 1);
|
||||||
|
idx2 = scratchpad_ptr<MASK>(lpad, n, 2);
|
||||||
|
idx3 = scratchpad_ptr<MASK>(lpad, n, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template void cn_gpu_inner_arm<xmrig::CnAlgo<xmrig::Algorithm::CN_GPU>().iterations(), xmrig::CnAlgo<xmrig::Algorithm::CN_GPU>().mask()>(const uint8_t* spad, uint8_t* lpad);
|
||||||
211
src/crypto/cn/gpu/cn_gpu_avx.cpp
Normal file
211
src/crypto/cn/gpu/cn_gpu_avx.cpp
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2020 XMRig <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "crypto/cn/CnAlgo.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# include <x86intrin.h>
|
||||||
|
#else
|
||||||
|
# include <intrin.h>
|
||||||
|
# define __restrict__ __restrict
|
||||||
|
#endif
|
||||||
|
#ifndef _mm256_bslli_epi128
|
||||||
|
#define _mm256_bslli_epi128(a, count) _mm256_slli_si256((a), (count))
|
||||||
|
#endif
|
||||||
|
#ifndef _mm256_bsrli_epi128
|
||||||
|
#define _mm256_bsrli_epi128(a, count) _mm256_srli_si256((a), (count))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
inline void prep_dv_avx(__m256i* idx, __m256i& v, __m256& n01)
|
||||||
|
{
|
||||||
|
v = _mm256_load_si256(idx);
|
||||||
|
n01 = _mm256_cvtepi32_ps(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline __m256 fma_break(const __m256& x)
|
||||||
|
{
|
||||||
|
// Break the dependency chain by setting the exp to ?????01
|
||||||
|
__m256 xx = _mm256_and_ps(_mm256_castsi256_ps(_mm256_set1_epi32(0xFEFFFFFF)), x);
|
||||||
|
return _mm256_or_ps(_mm256_castsi256_ps(_mm256_set1_epi32(0x00800000)), xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 14
|
||||||
|
inline void sub_round(const __m256& n0, const __m256& n1, const __m256& n2, const __m256& n3, const __m256& rnd_c, __m256& n, __m256& d, __m256& c)
|
||||||
|
{
|
||||||
|
__m256 nn = _mm256_mul_ps(n0, c);
|
||||||
|
nn = _mm256_mul_ps(_mm256_add_ps(n1, c), _mm256_mul_ps(nn, nn));
|
||||||
|
nn = fma_break(nn);
|
||||||
|
n = _mm256_add_ps(n, nn);
|
||||||
|
|
||||||
|
__m256 dd = _mm256_mul_ps(n2, c);
|
||||||
|
dd = _mm256_mul_ps(_mm256_sub_ps(n3, c), _mm256_mul_ps(dd, dd));
|
||||||
|
dd = fma_break(dd);
|
||||||
|
d = _mm256_add_ps(d, dd);
|
||||||
|
|
||||||
|
//Constant feedback
|
||||||
|
c = _mm256_add_ps(c, rnd_c);
|
||||||
|
c = _mm256_add_ps(c, _mm256_set1_ps(0.734375f));
|
||||||
|
__m256 r = _mm256_add_ps(nn, dd);
|
||||||
|
r = _mm256_and_ps(_mm256_castsi256_ps(_mm256_set1_epi32(0x807FFFFF)), r);
|
||||||
|
r = _mm256_or_ps(_mm256_castsi256_ps(_mm256_set1_epi32(0x40000000)), r);
|
||||||
|
c = _mm256_add_ps(c, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 14*8 + 2 = 112
|
||||||
|
inline void round_compute(const __m256& n0, const __m256& n1, const __m256& n2, const __m256& n3, const __m256& rnd_c, __m256& c, __m256& r)
|
||||||
|
{
|
||||||
|
__m256 n = _mm256_setzero_ps(), d = _mm256_setzero_ps();
|
||||||
|
|
||||||
|
sub_round(n0, n1, n2, n3, rnd_c, n, d, c);
|
||||||
|
sub_round(n1, n2, n3, n0, rnd_c, n, d, c);
|
||||||
|
sub_round(n2, n3, n0, n1, rnd_c, n, d, c);
|
||||||
|
sub_round(n3, n0, n1, n2, rnd_c, n, d, c);
|
||||||
|
sub_round(n3, n2, n1, n0, rnd_c, n, d, c);
|
||||||
|
sub_round(n2, n1, n0, n3, rnd_c, n, d, c);
|
||||||
|
sub_round(n1, n0, n3, n2, rnd_c, n, d, c);
|
||||||
|
sub_round(n0, n3, n2, n1, rnd_c, n, d, c);
|
||||||
|
|
||||||
|
// Make sure abs(d) > 2.0 - this prevents division by zero and accidental overflows by division by < 1.0
|
||||||
|
d = _mm256_and_ps(_mm256_castsi256_ps(_mm256_set1_epi32(0xFF7FFFFF)), d);
|
||||||
|
d = _mm256_or_ps(_mm256_castsi256_ps(_mm256_set1_epi32(0x40000000)), d);
|
||||||
|
r = _mm256_add_ps(r, _mm256_div_ps(n, d));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 112×4 = 448
|
||||||
|
template <bool add>
|
||||||
|
inline __m256i double_compute(const __m256& n0, const __m256& n1, const __m256& n2, const __m256& n3,
|
||||||
|
float lcnt, float hcnt, const __m256& rnd_c, __m256& sum)
|
||||||
|
{
|
||||||
|
__m256 c = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_set1_ps(lcnt)), _mm_set1_ps(hcnt), 1);
|
||||||
|
__m256 r = _mm256_setzero_ps();
|
||||||
|
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
|
||||||
|
// do a quick fmod by setting exp to 2
|
||||||
|
r = _mm256_and_ps(_mm256_castsi256_ps(_mm256_set1_epi32(0x807FFFFF)), r);
|
||||||
|
r = _mm256_or_ps(_mm256_castsi256_ps(_mm256_set1_epi32(0x40000000)), r);
|
||||||
|
|
||||||
|
if(add)
|
||||||
|
sum = _mm256_add_ps(sum, r);
|
||||||
|
else
|
||||||
|
sum = r;
|
||||||
|
|
||||||
|
r = _mm256_mul_ps(r, _mm256_set1_ps(536870880.0f)); // 35
|
||||||
|
return _mm256_cvttps_epi32(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <size_t rot>
|
||||||
|
inline void double_compute_wrap(const __m256& n0, const __m256& n1, const __m256& n2, const __m256& n3,
|
||||||
|
float lcnt, float hcnt, const __m256& rnd_c, __m256& sum, __m256i& out)
|
||||||
|
{
|
||||||
|
__m256i r = double_compute<rot % 2 != 0>(n0, n1, n2, n3, lcnt, hcnt, rnd_c, sum);
|
||||||
|
if(rot != 0)
|
||||||
|
r = _mm256_or_si256(_mm256_bslli_epi128(r, 16 - rot), _mm256_bsrli_epi128(r, rot));
|
||||||
|
|
||||||
|
out = _mm256_xor_si256(out, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<uint32_t MASK>
|
||||||
|
inline __m256i* scratchpad_ptr(uint8_t* lpad, uint32_t idx, size_t n) { return reinterpret_cast<__m256i*>(lpad + (idx & MASK) + n*16); }
|
||||||
|
|
||||||
|
template<size_t ITER, uint32_t MASK>
|
||||||
|
void cn_gpu_inner_avx(const uint8_t* spad, uint8_t* lpad)
|
||||||
|
{
|
||||||
|
uint32_t s = reinterpret_cast<const uint32_t*>(spad)[0] >> 8;
|
||||||
|
__m256i* idx0 = scratchpad_ptr<MASK>(lpad, s, 0);
|
||||||
|
__m256i* idx2 = scratchpad_ptr<MASK>(lpad, s, 2);
|
||||||
|
__m256 sum0 = _mm256_setzero_ps();
|
||||||
|
|
||||||
|
for(size_t i = 0; i < ITER; i++)
|
||||||
|
{
|
||||||
|
__m256i v01, v23;
|
||||||
|
__m256 suma, sumb, sum1;
|
||||||
|
__m256 rc = sum0;
|
||||||
|
|
||||||
|
__m256 n01, n23;
|
||||||
|
prep_dv_avx(idx0, v01, n01);
|
||||||
|
prep_dv_avx(idx2, v23, n23);
|
||||||
|
|
||||||
|
__m256i out, out2;
|
||||||
|
__m256 n10, n22, n33;
|
||||||
|
n10 = _mm256_permute2f128_ps(n01, n01, 0x01);
|
||||||
|
n22 = _mm256_permute2f128_ps(n23, n23, 0x00);
|
||||||
|
n33 = _mm256_permute2f128_ps(n23, n23, 0x11);
|
||||||
|
|
||||||
|
out = _mm256_setzero_si256();
|
||||||
|
double_compute_wrap<0>(n01, n10, n22, n33, 1.3437500f, 1.4296875f, rc, suma, out);
|
||||||
|
double_compute_wrap<1>(n01, n22, n33, n10, 1.2812500f, 1.3984375f, rc, suma, out);
|
||||||
|
double_compute_wrap<2>(n01, n33, n10, n22, 1.3593750f, 1.3828125f, rc, sumb, out);
|
||||||
|
double_compute_wrap<3>(n01, n33, n22, n10, 1.3671875f, 1.3046875f, rc, sumb, out);
|
||||||
|
_mm256_store_si256(idx0, _mm256_xor_si256(v01, out));
|
||||||
|
sum0 = _mm256_add_ps(suma, sumb);
|
||||||
|
out2 = out;
|
||||||
|
|
||||||
|
__m256 n11, n02, n30;
|
||||||
|
n11 = _mm256_permute2f128_ps(n01, n01, 0x11);
|
||||||
|
n02 = _mm256_permute2f128_ps(n01, n23, 0x20);
|
||||||
|
n30 = _mm256_permute2f128_ps(n01, n23, 0x03);
|
||||||
|
|
||||||
|
out = _mm256_setzero_si256();
|
||||||
|
double_compute_wrap<0>(n23, n11, n02, n30, 1.4140625f, 1.3203125f, rc, suma, out);
|
||||||
|
double_compute_wrap<1>(n23, n02, n30, n11, 1.2734375f, 1.3515625f, rc, suma, out);
|
||||||
|
double_compute_wrap<2>(n23, n30, n11, n02, 1.2578125f, 1.3359375f, rc, sumb, out);
|
||||||
|
double_compute_wrap<3>(n23, n30, n02, n11, 1.2890625f, 1.4609375f, rc, sumb, out);
|
||||||
|
_mm256_store_si256(idx2, _mm256_xor_si256(v23, out));
|
||||||
|
sum1 = _mm256_add_ps(suma, sumb);
|
||||||
|
|
||||||
|
out2 = _mm256_xor_si256(out2, out);
|
||||||
|
out2 = _mm256_xor_si256(_mm256_permute2x128_si256(out2,out2,0x41), out2);
|
||||||
|
suma = _mm256_permute2f128_ps(sum0, sum1, 0x30);
|
||||||
|
sumb = _mm256_permute2f128_ps(sum0, sum1, 0x21);
|
||||||
|
sum0 = _mm256_add_ps(suma, sumb);
|
||||||
|
sum0 = _mm256_add_ps(sum0, _mm256_permute2f128_ps(sum0, sum0, 0x41));
|
||||||
|
|
||||||
|
// Clear the high 128 bits
|
||||||
|
__m128 sum = _mm256_castps256_ps128(sum0);
|
||||||
|
|
||||||
|
sum = _mm_and_ps(_mm_castsi128_ps(_mm_set1_epi32(0x7fffffff)), sum); // take abs(va) by masking the float sign bit
|
||||||
|
// vs range 0 - 64
|
||||||
|
__m128i v0 = _mm_cvttps_epi32(_mm_mul_ps(sum, _mm_set1_ps(16777216.0f)));
|
||||||
|
v0 = _mm_xor_si128(v0, _mm256_castsi256_si128(out2));
|
||||||
|
__m128i v1 = _mm_shuffle_epi32(v0, _MM_SHUFFLE(0, 1, 2, 3));
|
||||||
|
v0 = _mm_xor_si128(v0, v1);
|
||||||
|
v1 = _mm_shuffle_epi32(v0, _MM_SHUFFLE(0, 1, 0, 1));
|
||||||
|
v0 = _mm_xor_si128(v0, v1);
|
||||||
|
|
||||||
|
// vs is now between 0 and 1
|
||||||
|
sum = _mm_div_ps(sum, _mm_set1_ps(64.0f));
|
||||||
|
sum0 = _mm256_insertf128_ps(_mm256_castps128_ps256(sum), sum, 1);
|
||||||
|
uint32_t n = _mm_cvtsi128_si32(v0);
|
||||||
|
idx0 = scratchpad_ptr<MASK>(lpad, n, 0);
|
||||||
|
idx2 = scratchpad_ptr<MASK>(lpad, n, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template void cn_gpu_inner_avx<xmrig::CnAlgo<xmrig::Algorithm::CN_GPU>().iterations(), xmrig::CnAlgo<xmrig::Algorithm::CN_GPU>().mask()>(const uint8_t* spad, uint8_t* lpad);
|
||||||
212
src/crypto/cn/gpu/cn_gpu_ssse3.cpp
Normal file
212
src/crypto/cn/gpu/cn_gpu_ssse3.cpp
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2020 XMRig <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "crypto/cn/CnAlgo.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# include <x86intrin.h>
|
||||||
|
#else
|
||||||
|
# include <intrin.h>
|
||||||
|
# define __restrict__ __restrict
|
||||||
|
#endif
|
||||||
|
|
||||||
|
inline void prep_dv(__m128i* idx, __m128i& v, __m128& n)
|
||||||
|
{
|
||||||
|
v = _mm_load_si128(idx);
|
||||||
|
n = _mm_cvtepi32_ps(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline __m128 fma_break(__m128 x)
|
||||||
|
{
|
||||||
|
// Break the dependency chain by setting the exp to ?????01
|
||||||
|
x = _mm_and_ps(_mm_castsi128_ps(_mm_set1_epi32(0xFEFFFFFF)), x);
|
||||||
|
return _mm_or_ps(_mm_castsi128_ps(_mm_set1_epi32(0x00800000)), x);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 14
|
||||||
|
inline void sub_round(__m128 n0, __m128 n1, __m128 n2, __m128 n3, __m128 rnd_c, __m128& n, __m128& d, __m128& c)
|
||||||
|
{
|
||||||
|
n1 = _mm_add_ps(n1, c);
|
||||||
|
__m128 nn = _mm_mul_ps(n0, c);
|
||||||
|
nn = _mm_mul_ps(n1, _mm_mul_ps(nn,nn));
|
||||||
|
nn = fma_break(nn);
|
||||||
|
n = _mm_add_ps(n, nn);
|
||||||
|
|
||||||
|
n3 = _mm_sub_ps(n3, c);
|
||||||
|
__m128 dd = _mm_mul_ps(n2, c);
|
||||||
|
dd = _mm_mul_ps(n3, _mm_mul_ps(dd,dd));
|
||||||
|
dd = fma_break(dd);
|
||||||
|
d = _mm_add_ps(d, dd);
|
||||||
|
|
||||||
|
//Constant feedback
|
||||||
|
c = _mm_add_ps(c, rnd_c);
|
||||||
|
c = _mm_add_ps(c, _mm_set1_ps(0.734375f));
|
||||||
|
__m128 r = _mm_add_ps(nn, dd);
|
||||||
|
r = _mm_and_ps(_mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF)), r);
|
||||||
|
r = _mm_or_ps(_mm_castsi128_ps(_mm_set1_epi32(0x40000000)), r);
|
||||||
|
c = _mm_add_ps(c, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 14*8 + 2 = 112
|
||||||
|
inline void round_compute(__m128 n0, __m128 n1, __m128 n2, __m128 n3, __m128 rnd_c, __m128& c, __m128& r)
|
||||||
|
{
|
||||||
|
__m128 n = _mm_setzero_ps(), d = _mm_setzero_ps();
|
||||||
|
|
||||||
|
sub_round(n0, n1, n2, n3, rnd_c, n, d, c);
|
||||||
|
sub_round(n1, n2, n3, n0, rnd_c, n, d, c);
|
||||||
|
sub_round(n2, n3, n0, n1, rnd_c, n, d, c);
|
||||||
|
sub_round(n3, n0, n1, n2, rnd_c, n, d, c);
|
||||||
|
sub_round(n3, n2, n1, n0, rnd_c, n, d, c);
|
||||||
|
sub_round(n2, n1, n0, n3, rnd_c, n, d, c);
|
||||||
|
sub_round(n1, n0, n3, n2, rnd_c, n, d, c);
|
||||||
|
sub_round(n0, n3, n2, n1, rnd_c, n, d, c);
|
||||||
|
|
||||||
|
// Make sure abs(d) > 2.0 - this prevents division by zero and accidental overflows by division by < 1.0
|
||||||
|
d = _mm_and_ps(_mm_castsi128_ps(_mm_set1_epi32(0xFF7FFFFF)), d);
|
||||||
|
d = _mm_or_ps(_mm_castsi128_ps(_mm_set1_epi32(0x40000000)), d);
|
||||||
|
r =_mm_add_ps(r, _mm_div_ps(n,d));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 112×4 = 448
|
||||||
|
template<bool add>
|
||||||
|
inline __m128i single_compute(__m128 n0, __m128 n1, __m128 n2, __m128 n3, float cnt, __m128 rnd_c, __m128& sum)
|
||||||
|
{
|
||||||
|
__m128 c = _mm_set1_ps(cnt);
|
||||||
|
__m128 r = _mm_setzero_ps();
|
||||||
|
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
round_compute(n0, n1, n2, n3, rnd_c, c, r);
|
||||||
|
|
||||||
|
// do a quick fmod by setting exp to 2
|
||||||
|
r = _mm_and_ps(_mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF)), r);
|
||||||
|
r = _mm_or_ps(_mm_castsi128_ps(_mm_set1_epi32(0x40000000)), r);
|
||||||
|
|
||||||
|
if(add)
|
||||||
|
sum = _mm_add_ps(sum, r);
|
||||||
|
else
|
||||||
|
sum = r;
|
||||||
|
|
||||||
|
r = _mm_mul_ps(r, _mm_set1_ps(536870880.0f)); // 35
|
||||||
|
return _mm_cvttps_epi32(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<size_t rot>
|
||||||
|
inline void single_compute_wrap(__m128 n0, __m128 n1, __m128 n2, __m128 n3, float cnt, __m128 rnd_c, __m128& sum, __m128i& out)
|
||||||
|
{
|
||||||
|
__m128i r = single_compute<rot % 2 != 0>(n0, n1, n2, n3, cnt, rnd_c, sum);
|
||||||
|
if(rot != 0)
|
||||||
|
r = _mm_or_si128(_mm_slli_si128(r, 16 - rot), _mm_srli_si128(r, rot));
|
||||||
|
out = _mm_xor_si128(out, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<uint32_t MASK>
|
||||||
|
inline __m128i* scratchpad_ptr(uint8_t* lpad, uint32_t idx, size_t n) { return reinterpret_cast<__m128i*>(lpad + (idx & MASK) + n*16); }
|
||||||
|
|
||||||
|
template<size_t ITER, uint32_t MASK>
|
||||||
|
void cn_gpu_inner_ssse3(const uint8_t* spad, uint8_t* lpad)
|
||||||
|
{
|
||||||
|
uint32_t s = reinterpret_cast<const uint32_t*>(spad)[0] >> 8;
|
||||||
|
__m128i* idx0 = scratchpad_ptr<MASK>(lpad, s, 0);
|
||||||
|
__m128i* idx1 = scratchpad_ptr<MASK>(lpad, s, 1);
|
||||||
|
__m128i* idx2 = scratchpad_ptr<MASK>(lpad, s, 2);
|
||||||
|
__m128i* idx3 = scratchpad_ptr<MASK>(lpad, s, 3);
|
||||||
|
__m128 sum0 = _mm_setzero_ps();
|
||||||
|
|
||||||
|
for(size_t i = 0; i < ITER; i++)
|
||||||
|
{
|
||||||
|
__m128 n0, n1, n2, n3;
|
||||||
|
__m128i v0, v1, v2, v3;
|
||||||
|
__m128 suma, sumb, sum1, sum2, sum3;
|
||||||
|
|
||||||
|
prep_dv(idx0, v0, n0);
|
||||||
|
prep_dv(idx1, v1, n1);
|
||||||
|
prep_dv(idx2, v2, n2);
|
||||||
|
prep_dv(idx3, v3, n3);
|
||||||
|
__m128 rc = sum0;
|
||||||
|
|
||||||
|
__m128i out, out2;
|
||||||
|
out = _mm_setzero_si128();
|
||||||
|
single_compute_wrap<0>(n0, n1, n2, n3, 1.3437500f, rc, suma, out);
|
||||||
|
single_compute_wrap<1>(n0, n2, n3, n1, 1.2812500f, rc, suma, out);
|
||||||
|
single_compute_wrap<2>(n0, n3, n1, n2, 1.3593750f, rc, sumb, out);
|
||||||
|
single_compute_wrap<3>(n0, n3, n2, n1, 1.3671875f, rc, sumb, out);
|
||||||
|
sum0 = _mm_add_ps(suma, sumb);
|
||||||
|
_mm_store_si128(idx0, _mm_xor_si128(v0, out));
|
||||||
|
out2 = out;
|
||||||
|
|
||||||
|
out = _mm_setzero_si128();
|
||||||
|
single_compute_wrap<0>(n1, n0, n2, n3, 1.4296875f, rc, suma, out);
|
||||||
|
single_compute_wrap<1>(n1, n2, n3, n0, 1.3984375f, rc, suma, out);
|
||||||
|
single_compute_wrap<2>(n1, n3, n0, n2, 1.3828125f, rc, sumb, out);
|
||||||
|
single_compute_wrap<3>(n1, n3, n2, n0, 1.3046875f, rc, sumb, out);
|
||||||
|
sum1 = _mm_add_ps(suma, sumb);
|
||||||
|
_mm_store_si128(idx1, _mm_xor_si128(v1, out));
|
||||||
|
out2 = _mm_xor_si128(out2, out);
|
||||||
|
|
||||||
|
out = _mm_setzero_si128();
|
||||||
|
single_compute_wrap<0>(n2, n1, n0, n3, 1.4140625f, rc, suma, out);
|
||||||
|
single_compute_wrap<1>(n2, n0, n3, n1, 1.2734375f, rc, suma, out);
|
||||||
|
single_compute_wrap<2>(n2, n3, n1, n0, 1.2578125f, rc, sumb, out);
|
||||||
|
single_compute_wrap<3>(n2, n3, n0, n1, 1.2890625f, rc, sumb, out);
|
||||||
|
sum2 = _mm_add_ps(suma, sumb);
|
||||||
|
_mm_store_si128(idx2, _mm_xor_si128(v2, out));
|
||||||
|
out2 = _mm_xor_si128(out2, out);
|
||||||
|
|
||||||
|
out = _mm_setzero_si128();
|
||||||
|
single_compute_wrap<0>(n3, n1, n2, n0, 1.3203125f, rc, suma, out);
|
||||||
|
single_compute_wrap<1>(n3, n2, n0, n1, 1.3515625f, rc, suma, out);
|
||||||
|
single_compute_wrap<2>(n3, n0, n1, n2, 1.3359375f, rc, sumb, out);
|
||||||
|
single_compute_wrap<3>(n3, n0, n2, n1, 1.4609375f, rc, sumb, out);
|
||||||
|
sum3 = _mm_add_ps(suma, sumb);
|
||||||
|
_mm_store_si128(idx3, _mm_xor_si128(v3, out));
|
||||||
|
out2 = _mm_xor_si128(out2, out);
|
||||||
|
sum0 = _mm_add_ps(sum0, sum1);
|
||||||
|
sum2 = _mm_add_ps(sum2, sum3);
|
||||||
|
sum0 = _mm_add_ps(sum0, sum2);
|
||||||
|
|
||||||
|
sum0 = _mm_and_ps(_mm_castsi128_ps(_mm_set1_epi32(0x7fffffff)), sum0); // take abs(va) by masking the float sign bit
|
||||||
|
// vs range 0 - 64
|
||||||
|
n0 = _mm_mul_ps(sum0, _mm_set1_ps(16777216.0f));
|
||||||
|
v0 = _mm_cvttps_epi32(n0);
|
||||||
|
v0 = _mm_xor_si128(v0, out2);
|
||||||
|
v1 = _mm_shuffle_epi32(v0, _MM_SHUFFLE(0, 1, 2, 3));
|
||||||
|
v0 = _mm_xor_si128(v0, v1);
|
||||||
|
v1 = _mm_shuffle_epi32(v0, _MM_SHUFFLE(0, 1, 0, 1));
|
||||||
|
v0 = _mm_xor_si128(v0, v1);
|
||||||
|
|
||||||
|
// vs is now between 0 and 1
|
||||||
|
sum0 = _mm_div_ps(sum0, _mm_set1_ps(64.0f));
|
||||||
|
uint32_t n = _mm_cvtsi128_si32(v0);
|
||||||
|
idx0 = scratchpad_ptr<MASK>(lpad, n, 0);
|
||||||
|
idx1 = scratchpad_ptr<MASK>(lpad, n, 1);
|
||||||
|
idx2 = scratchpad_ptr<MASK>(lpad, n, 2);
|
||||||
|
idx3 = scratchpad_ptr<MASK>(lpad, n, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template void cn_gpu_inner_ssse3<xmrig::CnAlgo<xmrig::Algorithm::CN_GPU>().iterations(), xmrig::CnAlgo<xmrig::Algorithm::CN_GPU>().mask()>(const uint8_t* spad, uint8_t* lpad);
|
||||||
@@ -47,11 +47,11 @@ xmrig::MemoryPool::MemoryPool(size_t size, bool hugePages, uint32_t node)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr size_t alignment = 1 << 24;
|
constexpr size_t alignment = 0; //1 << 24;
|
||||||
|
|
||||||
m_memory = new VirtualMemory(size * pageSize + alignment, hugePages, false, false, node);
|
m_memory = new VirtualMemory(size * pageSize + alignment, hugePages, false, false, node);
|
||||||
|
|
||||||
m_alignOffset = (alignment - (((size_t)m_memory->scratchpad()) % alignment)) % alignment;
|
//m_alignOffset = (alignment - (((size_t)m_memory->scratchpad()) % alignment)) % alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
177
src/crypto/flex/cryptonote/crypto/aesb.c
Normal file
177
src/crypto/flex/cryptonote/crypto/aesb.c
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Copyright (c) 1998-2013, Brian Gladman, Worcester, UK. All rights reserved.
|
||||||
|
|
||||||
|
The redistribution and use of this software (with or without changes)
|
||||||
|
is allowed without the payment of fees or royalties provided that:
|
||||||
|
|
||||||
|
source code distributions include the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer;
|
||||||
|
|
||||||
|
binary distributions include the above copyright notice, this list
|
||||||
|
of conditions and the following disclaimer in their documentation.
|
||||||
|
|
||||||
|
This software is provided 'as is' with no explicit or implied warranties
|
||||||
|
in respect of its operation, including, but not limited to, correctness
|
||||||
|
and fitness for purpose.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Issue Date: 20/12/2007
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TABLE_ALIGN 32
|
||||||
|
#define WPOLY 0x011b
|
||||||
|
#define N_COLS 4
|
||||||
|
#define AES_BLOCK_SIZE 16
|
||||||
|
#define RC_LENGTH (5 * (AES_BLOCK_SIZE / 4 - 2))
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define ALIGN __declspec(align(TABLE_ALIGN))
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define ALIGN __attribute__ ((aligned(16)))
|
||||||
|
#else
|
||||||
|
#define ALIGN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define rf1(r,c) (r)
|
||||||
|
#define word_in(x,c) (*((uint32_t*)(x)+(c)))
|
||||||
|
#define word_out(x,c,v) (*((uint32_t*)(x)+(c)) = (v))
|
||||||
|
|
||||||
|
#define s(x,c) x[c]
|
||||||
|
#define si(y,x,c) (s(y,c) = word_in(x, c))
|
||||||
|
#define so(y,x,c) word_out(y, c, s(x,c))
|
||||||
|
#define state_in(y,x) si(y,x,0); si(y,x,1); si(y,x,2); si(y,x,3)
|
||||||
|
#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3)
|
||||||
|
#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3)
|
||||||
|
#define to_byte(x) ((x) & 0xff)
|
||||||
|
#define bval(x,n) to_byte((x) >> (8 * (n)))
|
||||||
|
|
||||||
|
#define fwd_var(x,r,c)\
|
||||||
|
( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\
|
||||||
|
: r == 1 ? ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))\
|
||||||
|
: r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\
|
||||||
|
: ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2)))
|
||||||
|
|
||||||
|
#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,n),fwd_var,rf1,c))
|
||||||
|
|
||||||
|
#define sb_data(w) {\
|
||||||
|
w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\
|
||||||
|
w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\
|
||||||
|
w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\
|
||||||
|
w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\
|
||||||
|
w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\
|
||||||
|
w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\
|
||||||
|
w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\
|
||||||
|
w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\
|
||||||
|
w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\
|
||||||
|
w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\
|
||||||
|
w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\
|
||||||
|
w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\
|
||||||
|
w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\
|
||||||
|
w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\
|
||||||
|
w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\
|
||||||
|
w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\
|
||||||
|
w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\
|
||||||
|
w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\
|
||||||
|
w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\
|
||||||
|
w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\
|
||||||
|
w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\
|
||||||
|
w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\
|
||||||
|
w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\
|
||||||
|
w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\
|
||||||
|
w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\
|
||||||
|
w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\
|
||||||
|
w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\
|
||||||
|
w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\
|
||||||
|
w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\
|
||||||
|
w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\
|
||||||
|
w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\
|
||||||
|
w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16) }
|
||||||
|
|
||||||
|
#define rc_data(w) {\
|
||||||
|
w(0x01), w(0x02), w(0x04), w(0x08), w(0x10),w(0x20), w(0x40), w(0x80),\
|
||||||
|
w(0x1b), w(0x36) }
|
||||||
|
|
||||||
|
#define bytes2word(b0, b1, b2, b3) (((uint32_t)(b3) << 24) | \
|
||||||
|
((uint32_t)(b2) << 16) | ((uint32_t)(b1) << 8) | (b0))
|
||||||
|
|
||||||
|
#define h0(x) (x)
|
||||||
|
#define w0(p) bytes2word(p, 0, 0, 0)
|
||||||
|
#define w1(p) bytes2word(0, p, 0, 0)
|
||||||
|
#define w2(p) bytes2word(0, 0, p, 0)
|
||||||
|
#define w3(p) bytes2word(0, 0, 0, p)
|
||||||
|
|
||||||
|
#define u0(p) bytes2word(f2(p), p, p, f3(p))
|
||||||
|
#define u1(p) bytes2word(f3(p), f2(p), p, p)
|
||||||
|
#define u2(p) bytes2word(p, f3(p), f2(p), p)
|
||||||
|
#define u3(p) bytes2word(p, p, f3(p), f2(p))
|
||||||
|
|
||||||
|
#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p))
|
||||||
|
#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p))
|
||||||
|
#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p))
|
||||||
|
#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p))
|
||||||
|
|
||||||
|
#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY))
|
||||||
|
#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY))
|
||||||
|
#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) ^ (((x>>5) & 4) * WPOLY))
|
||||||
|
#define f3(x) (f2(x) ^ x)
|
||||||
|
#define f9(x) (f8(x) ^ x)
|
||||||
|
#define fb(x) (f8(x) ^ f2(x) ^ x)
|
||||||
|
#define fd(x) (f8(x) ^ f4(x) ^ x)
|
||||||
|
#define fe(x) (f8(x) ^ f4(x) ^ f2(x))
|
||||||
|
|
||||||
|
#define t_dec(m,n) t_##m##n
|
||||||
|
#define t_set(m,n) t_##m##n
|
||||||
|
#define t_use(m,n) t_##m##n
|
||||||
|
|
||||||
|
#define d_4(t,n,b,e,f,g,h) ALIGN const t n[4][256] = { b(e), b(f), b(g), b(h) }
|
||||||
|
|
||||||
|
#define four_tables(x,tab,vf,rf,c) \
|
||||||
|
(tab[0][bval(vf(x,0,c),rf(0,c))] \
|
||||||
|
^ tab[1][bval(vf(x,1,c),rf(1,c))] \
|
||||||
|
^ tab[2][bval(vf(x,2,c),rf(2,c))] \
|
||||||
|
^ tab[3][bval(vf(x,3,c),rf(3,c))])
|
||||||
|
|
||||||
|
d_4(uint32_t, t_dec(f,n), sb_data, u0, u1, u2, u3);
|
||||||
|
|
||||||
|
void aesb_single_round(const uint8_t *in, uint8_t *out, uint8_t *expandedKey)
|
||||||
|
{
|
||||||
|
uint32_t b0[4], b1[4];
|
||||||
|
const uint32_t *kp = (uint32_t *) expandedKey;
|
||||||
|
state_in(b0, in);
|
||||||
|
|
||||||
|
round(fwd_rnd, b1, b0, kp);
|
||||||
|
|
||||||
|
state_out(out, b1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void aesb_pseudo_round(const uint8_t *in, uint8_t *out, uint8_t *expandedKey)
|
||||||
|
{
|
||||||
|
uint32_t b0[4], b1[4];
|
||||||
|
const uint32_t *kp = (uint32_t *) expandedKey;
|
||||||
|
state_in(b0, in);
|
||||||
|
|
||||||
|
round(fwd_rnd, b1, b0, kp);
|
||||||
|
round(fwd_rnd, b0, b1, kp + 1 * N_COLS);
|
||||||
|
round(fwd_rnd, b1, b0, kp + 2 * N_COLS);
|
||||||
|
round(fwd_rnd, b0, b1, kp + 3 * N_COLS);
|
||||||
|
round(fwd_rnd, b1, b0, kp + 4 * N_COLS);
|
||||||
|
round(fwd_rnd, b0, b1, kp + 5 * N_COLS);
|
||||||
|
round(fwd_rnd, b1, b0, kp + 6 * N_COLS);
|
||||||
|
round(fwd_rnd, b0, b1, kp + 7 * N_COLS);
|
||||||
|
round(fwd_rnd, b1, b0, kp + 8 * N_COLS);
|
||||||
|
round(fwd_rnd, b0, b1, kp + 9 * N_COLS);
|
||||||
|
|
||||||
|
state_out(out, b0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
43
src/crypto/flex/cryptonote/crypto/c_blake256.h
Normal file
43
src/crypto/flex/cryptonote/crypto/c_blake256.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#ifndef _BLAKE256_H_
|
||||||
|
#define _BLAKE256_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t h[8], s[4], t[2];
|
||||||
|
int buflen, nullt;
|
||||||
|
uint8_t buf[64];
|
||||||
|
} state;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
state inner;
|
||||||
|
state outer;
|
||||||
|
} hmac_state;
|
||||||
|
|
||||||
|
void blake256_init(state *);
|
||||||
|
void blake224_init(state *);
|
||||||
|
|
||||||
|
void blake256_update(state *, const uint8_t *, uint64_t);
|
||||||
|
void blake224_update(state *, const uint8_t *, uint64_t);
|
||||||
|
|
||||||
|
void blake256_final(state *, uint8_t *);
|
||||||
|
void blake224_final(state *, uint8_t *);
|
||||||
|
|
||||||
|
void blake256_hash(uint8_t *, const uint8_t *, uint64_t);
|
||||||
|
void blake224_hash(uint8_t *, const uint8_t *, uint64_t);
|
||||||
|
|
||||||
|
/* HMAC functions: */
|
||||||
|
|
||||||
|
void hmac_blake256_init(hmac_state *, const uint8_t *, uint64_t);
|
||||||
|
void hmac_blake224_init(hmac_state *, const uint8_t *, uint64_t);
|
||||||
|
|
||||||
|
void hmac_blake256_update(hmac_state *, const uint8_t *, uint64_t);
|
||||||
|
void hmac_blake224_update(hmac_state *, const uint8_t *, uint64_t);
|
||||||
|
|
||||||
|
void hmac_blake256_final(hmac_state *, uint8_t *);
|
||||||
|
void hmac_blake224_final(hmac_state *, uint8_t *);
|
||||||
|
|
||||||
|
void hmac_blake256_hash(uint8_t *, const uint8_t *, uint64_t, const uint8_t *, uint64_t);
|
||||||
|
void hmac_blake224_hash(uint8_t *, const uint8_t *, uint64_t, const uint8_t *, uint64_t);
|
||||||
|
|
||||||
|
#endif /* _BLAKE256_H_ */
|
||||||
56
src/crypto/flex/cryptonote/crypto/c_groestl.h
Normal file
56
src/crypto/flex/cryptonote/crypto/c_groestl.h
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#pragma once
|
||||||
|
/*
|
||||||
|
#include "crypto_uint8.h"
|
||||||
|
#include "crypto_uint32.h"
|
||||||
|
#include "crypto_uint64.h"
|
||||||
|
#include "crypto_hash.h"
|
||||||
|
|
||||||
|
typedef crypto_uint8 uint8_t;
|
||||||
|
typedef crypto_uint32 uint32_t;
|
||||||
|
typedef crypto_uint64 uint64_t;
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "hash.h"
|
||||||
|
|
||||||
|
/* some sizes (number of bytes) */
|
||||||
|
#define ROWS 8
|
||||||
|
#define LENGTHFIELDLEN ROWS
|
||||||
|
#define COLS512 8
|
||||||
|
|
||||||
|
#define SIZE512 (ROWS*COLS512)
|
||||||
|
|
||||||
|
#define ROUNDS512 10
|
||||||
|
#define HASH_BIT_LEN 256
|
||||||
|
|
||||||
|
#define ROTL32(v, n) ((((v)<<(n))|((v)>>(32-(n))))&li_32(ffffffff))
|
||||||
|
|
||||||
|
|
||||||
|
#define li_32(h) 0x##h##u
|
||||||
|
#define EXT_BYTE(var,n) ((uint8_t)((uint32_t)(var) >> (8*n)))
|
||||||
|
#define u32BIG(a) \
|
||||||
|
((ROTL32(a,8) & li_32(00FF00FF)) | \
|
||||||
|
(ROTL32(a,24) & li_32(FF00FF00)))
|
||||||
|
|
||||||
|
|
||||||
|
/* NIST API begin */
|
||||||
|
typedef struct {
|
||||||
|
uint32_t chaining[SIZE512/sizeof(uint32_t)]; /* actual state */
|
||||||
|
uint32_t block_counter1,
|
||||||
|
block_counter2; /* message block counter(s) */
|
||||||
|
BitSequence buffer[SIZE512]; /* data buffer */
|
||||||
|
int buf_ptr; /* data buffer pointer */
|
||||||
|
int bits_in_last_byte; /* no. of message bits in last byte of
|
||||||
|
data buffer */
|
||||||
|
} hashState;
|
||||||
|
|
||||||
|
/*void Init(hashState*);
|
||||||
|
void Update(hashState*, const BitSequence*, DataLength);
|
||||||
|
void Final(hashState*, BitSequence*); */
|
||||||
|
void groestl(const BitSequence*, DataLength, BitSequence*);
|
||||||
|
/* NIST API end */
|
||||||
|
|
||||||
|
/*
|
||||||
|
int crypto_hash(unsigned char *out,
|
||||||
|
const unsigned char *in,
|
||||||
|
unsigned long long len);
|
||||||
|
*/
|
||||||
20
src/crypto/flex/cryptonote/crypto/c_jh.h
Normal file
20
src/crypto/flex/cryptonote/crypto/c_jh.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*This program gives the 64-bit optimized bitslice implementation of JH using ANSI C
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
Performance
|
||||||
|
|
||||||
|
Microprocessor: Intel CORE 2 processor (Core 2 Duo Mobile T6600 2.2GHz)
|
||||||
|
Operating System: 64-bit Ubuntu 10.04 (Linux kernel 2.6.32-22-generic)
|
||||||
|
Speed for long message:
|
||||||
|
1) 45.8 cycles/byte compiler: Intel C++ Compiler 11.1 compilation option: icc -O2
|
||||||
|
2) 56.8 cycles/byte compiler: gcc 4.4.3 compilation option: gcc -O3
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
Last Modified: January 16, 2011
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include "hash.h"
|
||||||
|
|
||||||
|
typedef enum {SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2} HashReturn;
|
||||||
|
|
||||||
|
HashReturn jh_hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval);
|
||||||
112
src/crypto/flex/cryptonote/crypto/c_keccak.c
Normal file
112
src/crypto/flex/cryptonote/crypto/c_keccak.c
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
// keccak.c
|
||||||
|
// 19-Nov-11 Markku-Juhani O. Saarinen <mjos@iki.fi>
|
||||||
|
// A baseline Keccak (3rd round) implementation.
|
||||||
|
|
||||||
|
#include "hash-ops.h"
|
||||||
|
#include "c_keccak.h"
|
||||||
|
|
||||||
|
const uint64_t keccakf_rndc[24] =
|
||||||
|
{
|
||||||
|
0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
|
||||||
|
0x8000000080008000, 0x000000000000808b, 0x0000000080000001,
|
||||||
|
0x8000000080008081, 0x8000000000008009, 0x000000000000008a,
|
||||||
|
0x0000000000000088, 0x0000000080008009, 0x000000008000000a,
|
||||||
|
0x000000008000808b, 0x800000000000008b, 0x8000000000008089,
|
||||||
|
0x8000000000008003, 0x8000000000008002, 0x8000000000000080,
|
||||||
|
0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
|
||||||
|
0x8000000000008080, 0x0000000080000001, 0x8000000080008008
|
||||||
|
};
|
||||||
|
|
||||||
|
const int keccakf_rotc[24] =
|
||||||
|
{
|
||||||
|
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14,
|
||||||
|
27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44
|
||||||
|
};
|
||||||
|
|
||||||
|
const int keccakf_piln[24] =
|
||||||
|
{
|
||||||
|
10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4,
|
||||||
|
15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1
|
||||||
|
};
|
||||||
|
|
||||||
|
// update the state with given number of rounds
|
||||||
|
|
||||||
|
void keccakf(uint64_t st[25], int rounds)
|
||||||
|
{
|
||||||
|
int i, j, round;
|
||||||
|
uint64_t t, bc[5];
|
||||||
|
|
||||||
|
for (round = 0; round < rounds; round++) {
|
||||||
|
|
||||||
|
// Theta
|
||||||
|
for (i = 0; i < 5; i++)
|
||||||
|
bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20];
|
||||||
|
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
|
t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1);
|
||||||
|
for (j = 0; j < 25; j += 5)
|
||||||
|
st[j + i] ^= t;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rho Pi
|
||||||
|
t = st[1];
|
||||||
|
for (i = 0; i < 24; i++) {
|
||||||
|
j = keccakf_piln[i];
|
||||||
|
bc[0] = st[j];
|
||||||
|
st[j] = ROTL64(t, keccakf_rotc[i]);
|
||||||
|
t = bc[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chi
|
||||||
|
for (j = 0; j < 25; j += 5) {
|
||||||
|
for (i = 0; i < 5; i++)
|
||||||
|
bc[i] = st[j + i];
|
||||||
|
for (i = 0; i < 5; i++)
|
||||||
|
st[j + i] ^= (~bc[(i + 1) % 5]) & bc[(i + 2) % 5];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iota
|
||||||
|
st[0] ^= keccakf_rndc[round];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// compute a keccak hash (md) of given byte length from "in"
|
||||||
|
typedef uint64_t state_t[25];
|
||||||
|
|
||||||
|
int keccak(const uint8_t *in, int inlen, uint8_t *md, int mdlen)
|
||||||
|
{
|
||||||
|
state_t st;
|
||||||
|
uint8_t temp[144];
|
||||||
|
int i, rsiz, rsizw;
|
||||||
|
|
||||||
|
rsiz = sizeof(state_t) == mdlen ? HASH_DATA_AREA : 200 - 2 * mdlen;
|
||||||
|
rsizw = rsiz / 8;
|
||||||
|
|
||||||
|
memset(st, 0, sizeof(st));
|
||||||
|
|
||||||
|
for ( ; inlen >= rsiz; inlen -= rsiz, in += rsiz) {
|
||||||
|
for (i = 0; i < rsizw; i++)
|
||||||
|
st[i] ^= ((uint64_t *) in)[i];
|
||||||
|
keccakf(st, KECCAK_ROUNDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// last block and padding
|
||||||
|
memcpy(temp, in, inlen);
|
||||||
|
temp[inlen++] = 1;
|
||||||
|
memset(temp + inlen, 0, rsiz - inlen);
|
||||||
|
temp[rsiz - 1] |= 0x80;
|
||||||
|
|
||||||
|
for (i = 0; i < rsizw; i++)
|
||||||
|
st[i] ^= ((uint64_t *) temp)[i];
|
||||||
|
|
||||||
|
keccakf(st, KECCAK_ROUNDS);
|
||||||
|
|
||||||
|
memcpy(md, st, mdlen);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void keccak1600(const uint8_t *in, int inlen, uint8_t *md)
|
||||||
|
{
|
||||||
|
keccak(in, inlen, md, sizeof(state_t));
|
||||||
|
}
|
||||||
26
src/crypto/flex/cryptonote/crypto/c_keccak.h
Normal file
26
src/crypto/flex/cryptonote/crypto/c_keccak.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// keccak.h
|
||||||
|
// 19-Nov-11 Markku-Juhani O. Saarinen <mjos@iki.fi>
|
||||||
|
|
||||||
|
#ifndef KECCAK_H
|
||||||
|
#define KECCAK_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef KECCAK_ROUNDS
|
||||||
|
#define KECCAK_ROUNDS 24
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ROTL64
|
||||||
|
#define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y))))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// compute a keccak hash (md) of given byte length from "in"
|
||||||
|
int keccak(const uint8_t *in, int inlen, uint8_t *md, int mdlen);
|
||||||
|
|
||||||
|
// update the state
|
||||||
|
void keccakf(uint64_t st[25], int norounds);
|
||||||
|
|
||||||
|
void keccak1600(const uint8_t *in, int inlen, uint8_t *md);
|
||||||
|
|
||||||
|
#endif
|
||||||
186
src/crypto/flex/cryptonote/crypto/crypto.h
Normal file
186
src/crypto/flex/cryptonote/crypto/crypto.h
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <mutex>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "common/pod-class.h"
|
||||||
|
#include "generic-ops.h"
|
||||||
|
#include "hash.h"
|
||||||
|
|
||||||
|
namespace crypto {
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "random.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
extern std::mutex random_lock;
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
POD_CLASS ec_point {
|
||||||
|
char data[32];
|
||||||
|
};
|
||||||
|
|
||||||
|
POD_CLASS ec_scalar {
|
||||||
|
char data[32];
|
||||||
|
};
|
||||||
|
|
||||||
|
POD_CLASS public_key: ec_point {
|
||||||
|
friend class crypto_ops;
|
||||||
|
};
|
||||||
|
|
||||||
|
POD_CLASS secret_key: ec_scalar {
|
||||||
|
friend class crypto_ops;
|
||||||
|
};
|
||||||
|
|
||||||
|
POD_CLASS key_derivation: ec_point {
|
||||||
|
friend class crypto_ops;
|
||||||
|
};
|
||||||
|
|
||||||
|
POD_CLASS key_image: ec_point {
|
||||||
|
friend class crypto_ops;
|
||||||
|
};
|
||||||
|
|
||||||
|
POD_CLASS signature {
|
||||||
|
ec_scalar c, r;
|
||||||
|
friend class crypto_ops;
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
static_assert(sizeof(ec_point) == 32 && sizeof(ec_scalar) == 32 &&
|
||||||
|
sizeof(public_key) == 32 && sizeof(secret_key) == 32 &&
|
||||||
|
sizeof(key_derivation) == 32 && sizeof(key_image) == 32 &&
|
||||||
|
sizeof(signature) == 64, "Invalid structure size");
|
||||||
|
|
||||||
|
class crypto_ops {
|
||||||
|
crypto_ops();
|
||||||
|
crypto_ops(const crypto_ops &);
|
||||||
|
void operator=(const crypto_ops &);
|
||||||
|
~crypto_ops();
|
||||||
|
|
||||||
|
static void generate_keys(public_key &, secret_key &);
|
||||||
|
friend void generate_keys(public_key &, secret_key &);
|
||||||
|
static bool check_key(const public_key &);
|
||||||
|
friend bool check_key(const public_key &);
|
||||||
|
static bool secret_key_to_public_key(const secret_key &, public_key &);
|
||||||
|
friend bool secret_key_to_public_key(const secret_key &, public_key &);
|
||||||
|
static bool generate_key_derivation(const public_key &, const secret_key &, key_derivation &);
|
||||||
|
friend bool generate_key_derivation(const public_key &, const secret_key &, key_derivation &);
|
||||||
|
static bool derive_public_key(const key_derivation &, std::size_t, const public_key &, public_key &);
|
||||||
|
friend bool derive_public_key(const key_derivation &, std::size_t, const public_key &, public_key &);
|
||||||
|
static void derive_secret_key(const key_derivation &, std::size_t, const secret_key &, secret_key &);
|
||||||
|
friend void derive_secret_key(const key_derivation &, std::size_t, const secret_key &, secret_key &);
|
||||||
|
static void generate_signature(const hash &, const public_key &, const secret_key &, signature &);
|
||||||
|
friend void generate_signature(const hash &, const public_key &, const secret_key &, signature &);
|
||||||
|
static bool check_signature(const hash &, const public_key &, const signature &);
|
||||||
|
friend bool check_signature(const hash &, const public_key &, const signature &);
|
||||||
|
static void generate_key_image(const public_key &, const secret_key &, key_image &);
|
||||||
|
friend void generate_key_image(const public_key &, const secret_key &, key_image &);
|
||||||
|
static void generate_ring_signature(const hash &, const key_image &,
|
||||||
|
const public_key *const *, std::size_t, const secret_key &, std::size_t, signature *);
|
||||||
|
friend void generate_ring_signature(const hash &, const key_image &,
|
||||||
|
const public_key *const *, std::size_t, const secret_key &, std::size_t, signature *);
|
||||||
|
static bool check_ring_signature(const hash &, const key_image &,
|
||||||
|
const public_key *const *, std::size_t, const signature *);
|
||||||
|
friend bool check_ring_signature(const hash &, const key_image &,
|
||||||
|
const public_key *const *, std::size_t, const signature *);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Generate a value filled with random bytes.
|
||||||
|
*/
|
||||||
|
template<typename T>
|
||||||
|
typename std::enable_if<std::is_pod<T>::value, T>::type rand() {
|
||||||
|
typename std::remove_cv<T>::type res;
|
||||||
|
std::lock_guard<std::mutex> lock(random_lock);
|
||||||
|
generate_random_bytes(sizeof(T), &res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Generate a new key pair
|
||||||
|
*/
|
||||||
|
inline void generate_keys(public_key &pub, secret_key &sec) {
|
||||||
|
crypto_ops::generate_keys(pub, sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check a public key. Returns true if it is valid, false otherwise.
|
||||||
|
*/
|
||||||
|
inline bool check_key(const public_key &key) {
|
||||||
|
return crypto_ops::check_key(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Checks a private key and computes the corresponding public key.
|
||||||
|
*/
|
||||||
|
inline bool secret_key_to_public_key(const secret_key &sec, public_key &pub) {
|
||||||
|
return crypto_ops::secret_key_to_public_key(sec, pub);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* To generate an ephemeral key used to send money to:
|
||||||
|
* * The sender generates a new key pair, which becomes the transaction key. The public transaction key is included in "extra" field.
|
||||||
|
* * Both the sender and the receiver generate key derivation from the transaction key, the receivers' "view" key and the output index.
|
||||||
|
* * The sender uses key derivation and the receivers' "spend" key to derive an ephemeral public key.
|
||||||
|
* * The receiver can either derive the public key (to check that the transaction is addressed to him) or the private key (to spend the money).
|
||||||
|
*/
|
||||||
|
inline bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation) {
|
||||||
|
return crypto_ops::generate_key_derivation(key1, key2, derivation);
|
||||||
|
}
|
||||||
|
inline bool derive_public_key(const key_derivation &derivation, std::size_t output_index,
|
||||||
|
const public_key &base, public_key &derived_key) {
|
||||||
|
return crypto_ops::derive_public_key(derivation, output_index, base, derived_key);
|
||||||
|
}
|
||||||
|
inline void derive_secret_key(const key_derivation &derivation, std::size_t output_index,
|
||||||
|
const secret_key &base, secret_key &derived_key) {
|
||||||
|
crypto_ops::derive_secret_key(derivation, output_index, base, derived_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Generation and checking of a standard signature.
|
||||||
|
*/
|
||||||
|
inline void generate_signature(const hash &prefix_hash, const public_key &pub, const secret_key &sec, signature &sig) {
|
||||||
|
crypto_ops::generate_signature(prefix_hash, pub, sec, sig);
|
||||||
|
}
|
||||||
|
inline bool check_signature(const hash &prefix_hash, const public_key &pub, const signature &sig) {
|
||||||
|
return crypto_ops::check_signature(prefix_hash, pub, sig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* To send money to a key:
|
||||||
|
* * The sender generates an ephemeral key and includes it in transaction output.
|
||||||
|
* * To spend the money, the receiver generates a key image from it.
|
||||||
|
* * Then he selects a bunch of outputs, including the one he spends, and uses them to generate a ring signature.
|
||||||
|
* To check the signature, it is necessary to collect all the keys that were used to generate it. To detect double spends, it is necessary to check that each key image is used at most once.
|
||||||
|
*/
|
||||||
|
inline void generate_key_image(const public_key &pub, const secret_key &sec, key_image &image) {
|
||||||
|
crypto_ops::generate_key_image(pub, sec, image);
|
||||||
|
}
|
||||||
|
inline void generate_ring_signature(const hash &prefix_hash, const key_image &image,
|
||||||
|
const public_key *const *pubs, std::size_t pubs_count,
|
||||||
|
const secret_key &sec, std::size_t sec_index,
|
||||||
|
signature *sig) {
|
||||||
|
crypto_ops::generate_ring_signature(prefix_hash, image, pubs, pubs_count, sec, sec_index, sig);
|
||||||
|
}
|
||||||
|
inline bool check_ring_signature(const hash &prefix_hash, const key_image &image,
|
||||||
|
const public_key *const *pubs, std::size_t pubs_count,
|
||||||
|
const signature *sig) {
|
||||||
|
return crypto_ops::check_ring_signature(prefix_hash, image, pubs, pubs_count, sig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Variants with vector<const public_key *> parameters.
|
||||||
|
*/
|
||||||
|
inline void generate_ring_signature(const hash &prefix_hash, const key_image &image,
|
||||||
|
const std::vector<const public_key *> &pubs,
|
||||||
|
const secret_key &sec, std::size_t sec_index,
|
||||||
|
signature *sig) {
|
||||||
|
generate_ring_signature(prefix_hash, image, pubs.data(), pubs.size(), sec, sec_index, sig);
|
||||||
|
}
|
||||||
|
inline bool check_ring_signature(const hash &prefix_hash, const key_image &image,
|
||||||
|
const std::vector<const public_key *> &pubs,
|
||||||
|
const signature *sig) {
|
||||||
|
return check_ring_signature(prefix_hash, image, pubs.data(), pubs.size(), sig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CRYPTO_MAKE_COMPARABLE(public_key)
|
||||||
|
CRYPTO_MAKE_HASHABLE(key_image)
|
||||||
|
CRYPTO_MAKE_COMPARABLE(signature)
|
||||||
57
src/crypto/flex/cryptonote/crypto/hash-ops.h
Normal file
57
src/crypto/flex/cryptonote/crypto/hash-ops.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(__cplusplus)
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "int-util.h"
|
||||||
|
|
||||||
|
static inline void *padd(void *p, size_t i) {
|
||||||
|
return (char *) p + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline const void *cpadd(const void *p, size_t i) {
|
||||||
|
return (const char *) p + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void place_length(uint8_t *buffer, size_t bufsize, size_t length) {
|
||||||
|
if (sizeof(size_t) == 4) {
|
||||||
|
*(uint32_t *) padd(buffer, bufsize - 4) = swap32be(length);
|
||||||
|
} else {
|
||||||
|
*(uint64_t *) padd(buffer, bufsize - 8) = swap64be(length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
union hash_state {
|
||||||
|
uint8_t b[200];
|
||||||
|
uint64_t w[25];
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
void hash_permutation(union hash_state *state);
|
||||||
|
void hash_process(union hash_state *state, const uint8_t *buf, size_t count);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum {
|
||||||
|
HASH_SIZE = 64,
|
||||||
|
HASH_DATA_AREA = 136
|
||||||
|
};
|
||||||
|
|
||||||
|
void cn_fast_hash(const void *data, size_t length, char *hash);
|
||||||
|
void cn_slow_hash(const void *data, size_t length, char *hash);
|
||||||
|
|
||||||
|
void hash_extra_blake(const void *data, size_t length, char *hash);
|
||||||
|
void hash_extra_groestl(const void *data, size_t length, char *hash);
|
||||||
|
void hash_extra_jh(const void *data, size_t length, char *hash);
|
||||||
|
void hash_extra_skein(const void *data, size_t length, char *hash);
|
||||||
|
|
||||||
|
void tree_hash(const char (*hashes)[HASH_SIZE], size_t count, char *root_hash);
|
||||||
24
src/crypto/flex/cryptonote/crypto/hash.c
Normal file
24
src/crypto/flex/cryptonote/crypto/hash.c
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "hash-ops.h"
|
||||||
|
#include "c_keccak.h"
|
||||||
|
|
||||||
|
void hash_permutation(union hash_state *state) {
|
||||||
|
keccakf((uint64_t*)state, 24);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hash_process(union hash_state *state, const uint8_t *buf, size_t count) {
|
||||||
|
keccak1600(buf, count, (uint8_t*)state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cn_fast_hash(const void *data, size_t length, char *hash) {
|
||||||
|
union hash_state state;
|
||||||
|
hash_process(&state, data, length);
|
||||||
|
memcpy(hash, &state, HASH_SIZE);
|
||||||
|
}
|
||||||
22
src/crypto/flex/cryptonote/crypto/hash.h
Normal file
22
src/crypto/flex/cryptonote/crypto/hash.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "hash-ops.h"
|
||||||
|
|
||||||
|
typedef unsigned char BitSequence;
|
||||||
|
typedef unsigned long long DataLength;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
typedef std::string blobdata;
|
||||||
|
|
||||||
|
namespace crypto {
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
class hash {
|
||||||
|
char data[HASH_SIZE];
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
230
src/crypto/flex/cryptonote/crypto/int-util.h
Normal file
230
src/crypto/flex/cryptonote/crypto/int-util.h
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create GNU compatible endian macros. We use the values for __LITTLE_ENDIAN
|
||||||
|
* and __BIG_ENDIAN based on endian.h.
|
||||||
|
*/
|
||||||
|
#ifdef __sun
|
||||||
|
#include <sys/byteorder.h>
|
||||||
|
#define LITTLE_ENDIAN 1234
|
||||||
|
#define BIG_ENDIAN 4321
|
||||||
|
#ifdef _LITTLE_ENDIAN
|
||||||
|
#define BYTE_ORDER LITTLE_ENDIAN
|
||||||
|
#else
|
||||||
|
#define BYTE_ORDER BIG_ENDIAN
|
||||||
|
#endif /* _LITTLE_ENDIAN */
|
||||||
|
#endif /* __sun */
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
//instead of #include <sys/param.h>
|
||||||
|
// assume little-endian on Windows
|
||||||
|
#define LITTLE_ENDIAN 1234
|
||||||
|
#define BIG_ENDIAN 4321
|
||||||
|
#define BYTE_ORDER LITTLE_ENDIAN
|
||||||
|
|
||||||
|
static inline uint32_t rol32(uint32_t x, int r) {
|
||||||
|
static_assert(sizeof(uint32_t) == sizeof(unsigned int), "this code assumes 32-bit integers");
|
||||||
|
return _rotl(x, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t rol64(uint64_t x, int r) {
|
||||||
|
return _rotl64(x, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
#include <sys/param.h>
|
||||||
|
|
||||||
|
static inline uint32_t rol32(uint32_t x, int r) {
|
||||||
|
return (x << (r & 31)) | (x >> (-r & 31));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t rol64(uint64_t x, int r) {
|
||||||
|
return (x << (r & 63)) | (x >> (-r & 63));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline uint64_t hi_dword(uint64_t val) {
|
||||||
|
return val >> 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t lo_dword(uint64_t val) {
|
||||||
|
return val & 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t mul128(uint64_t multiplier, uint64_t multiplicand, uint64_t* product_hi) {
|
||||||
|
// multiplier = ab = a * 2^32 + b
|
||||||
|
// multiplicand = cd = c * 2^32 + d
|
||||||
|
// ab * cd = a * c * 2^64 + (a * d + b * c) * 2^32 + b * d
|
||||||
|
uint64_t a = hi_dword(multiplier);
|
||||||
|
uint64_t b = lo_dword(multiplier);
|
||||||
|
uint64_t c = hi_dword(multiplicand);
|
||||||
|
uint64_t d = lo_dword(multiplicand);
|
||||||
|
|
||||||
|
uint64_t ac = a * c;
|
||||||
|
uint64_t ad = a * d;
|
||||||
|
uint64_t bc = b * c;
|
||||||
|
uint64_t bd = b * d;
|
||||||
|
|
||||||
|
uint64_t adbc = ad + bc;
|
||||||
|
uint64_t adbc_carry = adbc < ad ? 1 : 0;
|
||||||
|
|
||||||
|
// multiplier * multiplicand = product_hi * 2^64 + product_lo
|
||||||
|
uint64_t product_lo = bd + (adbc << 32);
|
||||||
|
uint64_t product_lo_carry = product_lo < bd ? 1 : 0;
|
||||||
|
*product_hi = ac + (adbc >> 32) + (adbc_carry << 32) + product_lo_carry;
|
||||||
|
assert(ac <= *product_hi);
|
||||||
|
|
||||||
|
return product_lo;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t div_with_reminder(uint64_t dividend, uint32_t divisor, uint32_t* remainder) {
|
||||||
|
dividend |= ((uint64_t)*remainder) << 32;
|
||||||
|
*remainder = dividend % divisor;
|
||||||
|
return dividend / divisor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Long division with 2^32 base
|
||||||
|
static inline uint32_t div128_32(uint64_t dividend_hi, uint64_t dividend_lo, uint32_t divisor, uint64_t* quotient_hi, uint64_t* quotient_lo) {
|
||||||
|
uint64_t dividend_dwords[4];
|
||||||
|
uint32_t remainder = 0;
|
||||||
|
|
||||||
|
dividend_dwords[3] = hi_dword(dividend_hi);
|
||||||
|
dividend_dwords[2] = lo_dword(dividend_hi);
|
||||||
|
dividend_dwords[1] = hi_dword(dividend_lo);
|
||||||
|
dividend_dwords[0] = lo_dword(dividend_lo);
|
||||||
|
|
||||||
|
*quotient_hi = div_with_reminder(dividend_dwords[3], divisor, &remainder) << 32;
|
||||||
|
*quotient_hi |= div_with_reminder(dividend_dwords[2], divisor, &remainder);
|
||||||
|
*quotient_lo = div_with_reminder(dividend_dwords[1], divisor, &remainder) << 32;
|
||||||
|
*quotient_lo |= div_with_reminder(dividend_dwords[0], divisor, &remainder);
|
||||||
|
|
||||||
|
return remainder;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define IDENT32(x) ((uint32_t) (x))
|
||||||
|
#define IDENT64(x) ((uint64_t) (x))
|
||||||
|
|
||||||
|
#define SWAP32(x) ((((uint32_t) (x) & 0x000000ff) << 24) | \
|
||||||
|
(((uint32_t) (x) & 0x0000ff00) << 8) | \
|
||||||
|
(((uint32_t) (x) & 0x00ff0000) >> 8) | \
|
||||||
|
(((uint32_t) (x) & 0xff000000) >> 24))
|
||||||
|
#define SWAP64(x) ((((uint64_t) (x) & 0x00000000000000ff) << 56) | \
|
||||||
|
(((uint64_t) (x) & 0x000000000000ff00) << 40) | \
|
||||||
|
(((uint64_t) (x) & 0x0000000000ff0000) << 24) | \
|
||||||
|
(((uint64_t) (x) & 0x00000000ff000000) << 8) | \
|
||||||
|
(((uint64_t) (x) & 0x000000ff00000000) >> 8) | \
|
||||||
|
(((uint64_t) (x) & 0x0000ff0000000000) >> 24) | \
|
||||||
|
(((uint64_t) (x) & 0x00ff000000000000) >> 40) | \
|
||||||
|
(((uint64_t) (x) & 0xff00000000000000) >> 56))
|
||||||
|
|
||||||
|
static inline uint32_t ident32(uint32_t x) { return x; }
|
||||||
|
static inline uint64_t ident64(uint64_t x) { return x; }
|
||||||
|
|
||||||
|
static inline uint32_t swap32(uint32_t x) {
|
||||||
|
x = ((x & 0x00ff00ff) << 8) | ((x & 0xff00ff00) >> 8);
|
||||||
|
return (x << 16) | (x >> 16);
|
||||||
|
}
|
||||||
|
static inline uint64_t swap64(uint64_t x) {
|
||||||
|
x = ((x & 0x00ff00ff00ff00ff) << 8) | ((x & 0xff00ff00ff00ff00) >> 8);
|
||||||
|
x = ((x & 0x0000ffff0000ffff) << 16) | ((x & 0xffff0000ffff0000) >> 16);
|
||||||
|
return (x << 32) | (x >> 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define UNUSED __attribute__((unused))
|
||||||
|
#else
|
||||||
|
#define UNUSED
|
||||||
|
#endif
|
||||||
|
static inline void mem_inplace_ident(void *mem UNUSED, size_t n UNUSED) { }
|
||||||
|
#undef UNUSED
|
||||||
|
|
||||||
|
static inline void mem_inplace_swap32(void *mem, size_t n) {
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
((uint32_t *) mem)[i] = swap32(((const uint32_t *) mem)[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static inline void mem_inplace_swap64(void *mem, size_t n) {
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
((uint64_t *) mem)[i] = swap64(((const uint64_t *) mem)[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void memcpy_ident32(void *dst, const void *src, size_t n) {
|
||||||
|
memcpy(dst, src, 4 * n);
|
||||||
|
}
|
||||||
|
static inline void memcpy_ident64(void *dst, const void *src, size_t n) {
|
||||||
|
memcpy(dst, src, 8 * n);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void memcpy_swap32(void *dst, const void *src, size_t n) {
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
((uint32_t *) dst)[i] = swap32(((const uint32_t *) src)[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static inline void memcpy_swap64(void *dst, const void *src, size_t n) {
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
((uint64_t *) dst)[i] = swap64(((const uint64_t *) src)[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN)
|
||||||
|
#if __STDC_VERSION__ - 0 >= 201112L
|
||||||
|
static_assert(false, "BYTE_ORDER is undefined. Perhaps, GNU extensions are not enabled");
|
||||||
|
#else
|
||||||
|
#error "BYTE_ORDER is undefined. Perhaps, GNU extensions are not enabled"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
|
#define SWAP32LE IDENT32
|
||||||
|
#define SWAP32BE SWAP32
|
||||||
|
#define swap32le ident32
|
||||||
|
#define swap32be swap32
|
||||||
|
#define mem_inplace_swap32le mem_inplace_ident
|
||||||
|
#define mem_inplace_swap32be mem_inplace_swap32
|
||||||
|
#define memcpy_swap32le memcpy_ident32
|
||||||
|
#define memcpy_swap32be memcpy_swap32
|
||||||
|
#define SWAP64LE IDENT64
|
||||||
|
#define SWAP64BE SWAP64
|
||||||
|
#define swap64le ident64
|
||||||
|
#define swap64be swap64
|
||||||
|
#define mem_inplace_swap64le mem_inplace_ident
|
||||||
|
#define mem_inplace_swap64be mem_inplace_swap64
|
||||||
|
#define memcpy_swap64le memcpy_ident64
|
||||||
|
#define memcpy_swap64be memcpy_swap64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BYTE_ORDER == BIG_ENDIAN
|
||||||
|
#define SWAP32BE IDENT32
|
||||||
|
#define SWAP32LE SWAP32
|
||||||
|
#define swap32be ident32
|
||||||
|
#define swap32le swap32
|
||||||
|
#define mem_inplace_swap32be mem_inplace_ident
|
||||||
|
#define mem_inplace_swap32le mem_inplace_swap32
|
||||||
|
#define memcpy_swap32be memcpy_ident32
|
||||||
|
#define memcpy_swap32le memcpy_swap32
|
||||||
|
#define SWAP64BE IDENT64
|
||||||
|
#define SWAP64LE SWAP64
|
||||||
|
#define swap64be ident64
|
||||||
|
#define swap64le swap64
|
||||||
|
#define mem_inplace_swap64be mem_inplace_ident
|
||||||
|
#define mem_inplace_swap64le mem_inplace_swap64
|
||||||
|
#define memcpy_swap64be memcpy_ident64
|
||||||
|
#define memcpy_swap64le memcpy_swap64
|
||||||
|
#endif
|
||||||
50
src/crypto/flex/cryptonote/crypto/oaes_config.h
Normal file
50
src/crypto/flex/cryptonote/crypto/oaes_config.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* ---------------------------------------------------------------------------
|
||||||
|
* OpenAES License
|
||||||
|
* ---------------------------------------------------------------------------
|
||||||
|
* Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OAES_CONFIG_H
|
||||||
|
#define _OAES_CONFIG_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#ifndef OAES_HAVE_ISAAC
|
||||||
|
//#define OAES_HAVE_ISAAC 1
|
||||||
|
//#endif // OAES_HAVE_ISAAC
|
||||||
|
|
||||||
|
//#ifndef OAES_DEBUG
|
||||||
|
//#define OAES_DEBUG 0
|
||||||
|
//#endif // OAES_DEBUG
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _OAES_CONFIG_H
|
||||||
1468
src/crypto/flex/cryptonote/crypto/oaes_lib.c
Normal file
1468
src/crypto/flex/cryptonote/crypto/oaes_lib.c
Normal file
File diff suppressed because it is too large
Load Diff
215
src/crypto/flex/cryptonote/crypto/oaes_lib.h
Normal file
215
src/crypto/flex/cryptonote/crypto/oaes_lib.h
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
/*
|
||||||
|
* ---------------------------------------------------------------------------
|
||||||
|
* OpenAES License
|
||||||
|
* ---------------------------------------------------------------------------
|
||||||
|
* Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OAES_LIB_H
|
||||||
|
#define _OAES_LIB_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# ifdef OAES_SHARED
|
||||||
|
# ifdef oaes_lib_EXPORTS
|
||||||
|
# define OAES_API __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define OAES_API __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define OAES_API
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define OAES_API
|
||||||
|
#endif // WIN32
|
||||||
|
|
||||||
|
#define OAES_VERSION "0.8.1"
|
||||||
|
#define OAES_BLOCK_SIZE 16
|
||||||
|
|
||||||
|
typedef void OAES_CTX;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
OAES_RET_FIRST = 0,
|
||||||
|
OAES_RET_SUCCESS = 0,
|
||||||
|
OAES_RET_UNKNOWN,
|
||||||
|
OAES_RET_ARG1,
|
||||||
|
OAES_RET_ARG2,
|
||||||
|
OAES_RET_ARG3,
|
||||||
|
OAES_RET_ARG4,
|
||||||
|
OAES_RET_ARG5,
|
||||||
|
OAES_RET_NOKEY,
|
||||||
|
OAES_RET_MEM,
|
||||||
|
OAES_RET_BUF,
|
||||||
|
OAES_RET_HEADER,
|
||||||
|
OAES_RET_COUNT
|
||||||
|
} OAES_RET;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* oaes_set_option() takes one of these values for its [option] parameter
|
||||||
|
* some options accept either an optional or a required [value] parameter
|
||||||
|
*/
|
||||||
|
// no option
|
||||||
|
#define OAES_OPTION_NONE 0
|
||||||
|
// enable ECB mode, disable CBC mode
|
||||||
|
#define OAES_OPTION_ECB 1
|
||||||
|
// enable CBC mode, disable ECB mode
|
||||||
|
// value is optional, may pass uint8_t iv[OAES_BLOCK_SIZE] to specify
|
||||||
|
// the value of the initialization vector, iv
|
||||||
|
#define OAES_OPTION_CBC 2
|
||||||
|
|
||||||
|
#ifdef OAES_DEBUG
|
||||||
|
typedef int ( * oaes_step_cb ) (
|
||||||
|
const uint8_t state[OAES_BLOCK_SIZE],
|
||||||
|
const char * step_name,
|
||||||
|
int step_count,
|
||||||
|
void * user_data );
|
||||||
|
// enable state stepping mode
|
||||||
|
// value is required, must pass oaes_step_cb to receive the state at each step
|
||||||
|
#define OAES_OPTION_STEP_ON 4
|
||||||
|
// disable state stepping mode
|
||||||
|
#define OAES_OPTION_STEP_OFF 8
|
||||||
|
#endif // OAES_DEBUG
|
||||||
|
|
||||||
|
typedef uint16_t OAES_OPTION;
|
||||||
|
|
||||||
|
typedef struct _oaes_key
|
||||||
|
{
|
||||||
|
size_t data_len;
|
||||||
|
uint8_t *data;
|
||||||
|
size_t exp_data_len;
|
||||||
|
uint8_t *exp_data;
|
||||||
|
size_t num_keys;
|
||||||
|
size_t key_base;
|
||||||
|
} oaes_key;
|
||||||
|
|
||||||
|
typedef struct _oaes_ctx
|
||||||
|
{
|
||||||
|
#ifdef OAES_HAVE_ISAAC
|
||||||
|
randctx * rctx;
|
||||||
|
#endif // OAES_HAVE_ISAAC
|
||||||
|
|
||||||
|
#ifdef OAES_DEBUG
|
||||||
|
oaes_step_cb step_cb;
|
||||||
|
#endif // OAES_DEBUG
|
||||||
|
|
||||||
|
oaes_key * key;
|
||||||
|
OAES_OPTION options;
|
||||||
|
uint8_t iv[OAES_BLOCK_SIZE];
|
||||||
|
} oaes_ctx;
|
||||||
|
/*
|
||||||
|
* // usage:
|
||||||
|
*
|
||||||
|
* OAES_CTX * ctx = oaes_alloc();
|
||||||
|
* .
|
||||||
|
* .
|
||||||
|
* .
|
||||||
|
* {
|
||||||
|
* oaes_gen_key_xxx( ctx );
|
||||||
|
* {
|
||||||
|
* oaes_key_export( ctx, _buf, &_buf_len );
|
||||||
|
* // or
|
||||||
|
* oaes_key_export_data( ctx, _buf, &_buf_len );\
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* // or
|
||||||
|
* {
|
||||||
|
* oaes_key_import( ctx, _buf, _buf_len );
|
||||||
|
* // or
|
||||||
|
* oaes_key_import_data( ctx, _buf, _buf_len );
|
||||||
|
* }
|
||||||
|
* .
|
||||||
|
* .
|
||||||
|
* .
|
||||||
|
* oaes_encrypt( ctx, m, m_len, c, &c_len );
|
||||||
|
* .
|
||||||
|
* .
|
||||||
|
* .
|
||||||
|
* oaes_decrypt( ctx, c, c_len, m, &m_len );
|
||||||
|
* .
|
||||||
|
* .
|
||||||
|
* .
|
||||||
|
* oaes_free( &ctx );
|
||||||
|
*/
|
||||||
|
|
||||||
|
OAES_API OAES_CTX * oaes_alloc(void);
|
||||||
|
|
||||||
|
OAES_API OAES_RET oaes_free( OAES_CTX ** ctx );
|
||||||
|
|
||||||
|
OAES_API OAES_RET oaes_set_option( OAES_CTX * ctx,
|
||||||
|
OAES_OPTION option, const void * value );
|
||||||
|
|
||||||
|
OAES_API OAES_RET oaes_key_gen_128( OAES_CTX * ctx );
|
||||||
|
|
||||||
|
OAES_API OAES_RET oaes_key_gen_192( OAES_CTX * ctx );
|
||||||
|
|
||||||
|
OAES_API OAES_RET oaes_key_gen_256( OAES_CTX * ctx );
|
||||||
|
|
||||||
|
// export key with header information
|
||||||
|
// set data == NULL to get the required data_len
|
||||||
|
OAES_API OAES_RET oaes_key_export( OAES_CTX * ctx,
|
||||||
|
uint8_t * data, size_t * data_len );
|
||||||
|
|
||||||
|
// directly export the data from key
|
||||||
|
// set data == NULL to get the required data_len
|
||||||
|
OAES_API OAES_RET oaes_key_export_data( OAES_CTX * ctx,
|
||||||
|
uint8_t * data, size_t * data_len );
|
||||||
|
|
||||||
|
// import key with header information
|
||||||
|
OAES_API OAES_RET oaes_key_import( OAES_CTX * ctx,
|
||||||
|
const uint8_t * data, size_t data_len );
|
||||||
|
|
||||||
|
// directly import data into key
|
||||||
|
OAES_API OAES_RET oaes_key_import_data( OAES_CTX * ctx,
|
||||||
|
const uint8_t * data, size_t data_len );
|
||||||
|
|
||||||
|
// set c == NULL to get the required c_len
|
||||||
|
OAES_API OAES_RET oaes_encrypt( OAES_CTX * ctx,
|
||||||
|
const uint8_t * m, size_t m_len, uint8_t * c, size_t * c_len );
|
||||||
|
|
||||||
|
// set m == NULL to get the required m_len
|
||||||
|
OAES_API OAES_RET oaes_decrypt( OAES_CTX * ctx,
|
||||||
|
const uint8_t * c, size_t c_len, uint8_t * m, size_t * m_len );
|
||||||
|
|
||||||
|
// set buf == NULL to get the required buf_len
|
||||||
|
OAES_API OAES_RET oaes_sprintf(
|
||||||
|
char * buf, size_t * buf_len, const uint8_t * data, size_t data_len );
|
||||||
|
|
||||||
|
OAES_API OAES_RET oaes_encryption_round( const uint8_t * key, uint8_t * c );
|
||||||
|
|
||||||
|
OAES_API OAES_RET oaes_pseudo_encrypt_ecb( OAES_CTX * ctx, uint8_t * c );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _OAES_LIB_H
|
||||||
168
src/crypto/flex/cryptonote/crypto/variant2_int_sqrt.h
Normal file
168
src/crypto/flex/cryptonote/crypto/variant2_int_sqrt.h
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
#ifndef VARIANT2_INT_SQRT_H
|
||||||
|
#define VARIANT2_INT_SQRT_H
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
|
#define VARIANT2_INTEGER_MATH_SQRT_STEP_SSE2() \
|
||||||
|
do { \
|
||||||
|
const __m128i exp_double_bias = _mm_set_epi64x(0, 1023ULL << 52); \
|
||||||
|
__m128d x = _mm_castsi128_pd(_mm_add_epi64(_mm_cvtsi64_si128(sqrt_input >> 12), exp_double_bias)); \
|
||||||
|
x = _mm_sqrt_sd(_mm_setzero_pd(), x); \
|
||||||
|
sqrt_result = (uint64_t)(_mm_cvtsi128_si64(_mm_sub_epi64(_mm_castpd_si128(x), exp_double_bias))) >> 19; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define VARIANT2_INTEGER_MATH_SQRT_STEP_FP64() \
|
||||||
|
do { \
|
||||||
|
sqrt_result = sqrt(sqrt_input + 18446744073709551616.0) * 2.0 - 8589934592.0; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
//#define VARIANT2_INTEGER_MATH_SQRT_STEP_REF() \
|
||||||
|
// sqrt_result = integer_square_root_v2(sqrt_input)
|
||||||
|
|
||||||
|
// Reference implementation of the integer square root for Cryptonight variant 2
|
||||||
|
// Computes integer part of "sqrt(2^64 + n) * 2 - 2^33"
|
||||||
|
//
|
||||||
|
// In other words, given 64-bit unsigned integer n:
|
||||||
|
// 1) Write it as x = 1.NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN000... in binary (1 <= x < 2, all 64 bits of n are used)
|
||||||
|
// 2) Calculate sqrt(x) = 1.0RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR... (1 <= sqrt(x) < sqrt(2), so it will always start with "1.0" in binary)
|
||||||
|
// 3) Take 32 bits that come after "1.0" and return them as a 32-bit unsigned integer, discard all remaining bits
|
||||||
|
//
|
||||||
|
// Some sample inputs and outputs:
|
||||||
|
//
|
||||||
|
// Input | Output | Exact value of "sqrt(2^64 + n) * 2 - 2^33"
|
||||||
|
// -----------------|------------|-------------------------------------------
|
||||||
|
// 0 | 0 | 0
|
||||||
|
// 2^32 | 0 | 0.99999999994179233909330885695244...
|
||||||
|
// 2^32 + 1 | 1 | 1.0000000001746229827200734316305...
|
||||||
|
// 2^50 | 262140 | 262140.00012206565608606978175873...
|
||||||
|
// 2^55 + 20963331 | 8384515 | 8384515.9999999997673963974959744...
|
||||||
|
// 2^55 + 20963332 | 8384516 | 8384516
|
||||||
|
// 2^62 + 26599786 | 1013904242 | 1013904242.9999999999479374853545...
|
||||||
|
// 2^62 + 26599787 | 1013904243 | 1013904243.0000000001561875439364...
|
||||||
|
// 2^64 - 1 | 3558067407 | 3558067407.9041987696409179931096...
|
||||||
|
|
||||||
|
// The reference implementation as it is now uses only unsigned int64 arithmetic, so it can't have undefined behavior
|
||||||
|
// It was tested once for all edge cases and confirmed correct
|
||||||
|
//
|
||||||
|
// !!! Note: if you're modifying this code, uncomment the test in monero/tests/hash/main.cpp !!!
|
||||||
|
//
|
||||||
|
/*
|
||||||
|
static inline uint64_t integer_square_root_v2(uint64_t n)
|
||||||
|
{
|
||||||
|
uint64_t r = 1ULL << 63;
|
||||||
|
|
||||||
|
for (uint64_t bit = 1ULL << 60; bit; bit >>= 2)
|
||||||
|
{
|
||||||
|
const bool b = (n < r + bit);
|
||||||
|
const uint64_t n_next = n - (r + bit);
|
||||||
|
const uint64_t r_next = r + bit * 2;
|
||||||
|
n = b ? n : n_next;
|
||||||
|
r = b ? r : r_next;
|
||||||
|
r >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r * 2 + ((n > r) ? 1 : 0);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
VARIANT2_INTEGER_MATH_SQRT_FIXUP checks that "r" is an integer part of "sqrt(2^64 + sqrt_input) * 2 - 2^33" and adds or subtracts 1 if needed
|
||||||
|
It's hard to understand how it works, so here is a full calculation of formulas used in VARIANT2_INTEGER_MATH_SQRT_FIXUP
|
||||||
|
|
||||||
|
The following inequalities must hold for r if it's an integer part of "sqrt(2^64 + sqrt_input) * 2 - 2^33":
|
||||||
|
1) r <= sqrt(2^64 + sqrt_input) * 2 - 2^33
|
||||||
|
2) r + 1 > sqrt(2^64 + sqrt_input) * 2 - 2^33
|
||||||
|
|
||||||
|
We need to check them using only unsigned integer arithmetic to avoid rounding errors and undefined behavior
|
||||||
|
|
||||||
|
First inequality: r <= sqrt(2^64 + sqrt_input) * 2 - 2^33
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
r <= sqrt(2^64 + sqrt_input) * 2 - 2^33
|
||||||
|
r + 2^33 <= sqrt(2^64 + sqrt_input) * 2
|
||||||
|
r/2 + 2^32 <= sqrt(2^64 + sqrt_input)
|
||||||
|
(r/2 + 2^32)^2 <= 2^64 + sqrt_input
|
||||||
|
|
||||||
|
Rewrite r as r = s * 2 + b (s = trunc(r/2), b is 0 or 1)
|
||||||
|
|
||||||
|
((s*2+b)/2 + 2^32)^2 <= 2^64 + sqrt_input
|
||||||
|
(s*2+b)^2/4 + 2*2^32*(s*2+b)/2 + 2^64 <= 2^64 + sqrt_input
|
||||||
|
(s*2+b)^2/4 + 2*2^32*(s*2+b)/2 <= sqrt_input
|
||||||
|
(s*2+b)^2/4 + 2^32*r <= sqrt_input
|
||||||
|
(s^2*4+2*s*2*b+b^2)/4 + 2^32*r <= sqrt_input
|
||||||
|
s^2+s*b+b^2/4 + 2^32*r <= sqrt_input
|
||||||
|
s*(s+b) + b^2/4 + 2^32*r <= sqrt_input
|
||||||
|
|
||||||
|
Let r2 = s*(s+b) + r*2^32
|
||||||
|
r2 + b^2/4 <= sqrt_input
|
||||||
|
|
||||||
|
If this inequality doesn't hold, then we must decrement r: IF "r2 + b^2/4 > sqrt_input" THEN r = r - 1
|
||||||
|
|
||||||
|
b can be 0 or 1
|
||||||
|
If b is 0 then we need to compare "r2 > sqrt_input"
|
||||||
|
If b is 1 then b^2/4 = 0.25, so we need to compare "r2 + 0.25 > sqrt_input"
|
||||||
|
Since both r2 and sqrt_input are integers, we can safely replace it with "r2 + 1 > sqrt_input"
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
Both cases can be merged to a single expression "r2 + b > sqrt_input"
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
There will be no overflow when calculating "r2 + b", so it's safe to compare with sqrt_input:
|
||||||
|
r2 + b = s*(s+b) + r*2^32 + b
|
||||||
|
The largest value s, b and r can have is s = 1779033703, b = 1, r = 3558067407 when sqrt_input = 2^64 - 1
|
||||||
|
r2 + b <= 1779033703*1779033704 + 3558067407*2^32 + 1 = 18446744068217447385 < 2^64
|
||||||
|
|
||||||
|
Second inequality: r + 1 > sqrt(2^64 + sqrt_input) * 2 - 2^33
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
r + 1 > sqrt(2^64 + sqrt_input) * 2 - 2^33
|
||||||
|
r + 1 + 2^33 > sqrt(2^64 + sqrt_input) * 2
|
||||||
|
((r+1)/2 + 2^32)^2 > 2^64 + sqrt_input
|
||||||
|
|
||||||
|
Rewrite r as r = s * 2 + b (s = trunc(r/2), b is 0 or 1)
|
||||||
|
|
||||||
|
((s*2+b+1)/2 + 2^32)^2 > 2^64 + sqrt_input
|
||||||
|
(s*2+b+1)^2/4 + 2*(s*2+b+1)/2*2^32 + 2^64 > 2^64 + sqrt_input
|
||||||
|
(s*2+b+1)^2/4 + (s*2+b+1)*2^32 > sqrt_input
|
||||||
|
(s*2+b+1)^2/4 + (r+1)*2^32 > sqrt_input
|
||||||
|
(s*2+(b+1))^2/4 + r*2^32 + 2^32 > sqrt_input
|
||||||
|
(s^2*4+2*s*2*(b+1)+(b+1)^2)/4 + r*2^32 + 2^32 > sqrt_input
|
||||||
|
s^2+s*(b+1)+(b+1)^2/4 + r*2^32 + 2^32 > sqrt_input
|
||||||
|
s*(s+b) + s + (b+1)^2/4 + r*2^32 + 2^32 > sqrt_input
|
||||||
|
|
||||||
|
Let r2 = s*(s+b) + r*2^32
|
||||||
|
|
||||||
|
r2 + s + (b+1)^2/4 + 2^32 > sqrt_input
|
||||||
|
r2 + 2^32 + (b+1)^2/4 > sqrt_input - s
|
||||||
|
|
||||||
|
If this inequality doesn't hold, then we must decrement r: IF "r2 + 2^32 + (b+1)^2/4 <= sqrt_input - s" THEN r = r - 1
|
||||||
|
b can be 0 or 1
|
||||||
|
If b is 0 then we need to compare "r2 + 2^32 + 1/4 <= sqrt_input - s" which is equal to "r2 + 2^32 < sqrt_input - s" because all numbers here are integers
|
||||||
|
If b is 1 then (b+1)^2/4 = 1, so we need to compare "r2 + 2^32 + 1 <= sqrt_input - s" which is also equal to "r2 + 2^32 < sqrt_input - s"
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
Both cases can be merged to a single expression "r2 + 2^32 < sqrt_input - s"
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
There will be no overflow when calculating "r2 + 2^32":
|
||||||
|
r2 + 2^32 = s*(s+b) + r*2^32 + 2^32 = s*(s+b) + (r+1)*2^32
|
||||||
|
The largest value s, b and r can have is s = 1779033703, b = 1, r = 3558067407 when sqrt_input = 2^64 - 1
|
||||||
|
r2 + b <= 1779033703*1779033704 + 3558067408*2^32 = 18446744072512414680 < 2^64
|
||||||
|
|
||||||
|
There will be no integer overflow when calculating "sqrt_input - s", i.e. "sqrt_input >= s" at all times:
|
||||||
|
s = trunc(r/2) = trunc(sqrt(2^64 + sqrt_input) - 2^32) < sqrt(2^64 + sqrt_input) - 2^32 + 1
|
||||||
|
sqrt_input > sqrt(2^64 + sqrt_input) - 2^32 + 1
|
||||||
|
sqrt_input + 2^32 - 1 > sqrt(2^64 + sqrt_input)
|
||||||
|
(sqrt_input + 2^32 - 1)^2 > sqrt_input + 2^64
|
||||||
|
sqrt_input^2 + 2*sqrt_input*(2^32 - 1) + (2^32-1)^2 > sqrt_input + 2^64
|
||||||
|
sqrt_input^2 + sqrt_input*(2^33 - 2) + (2^32-1)^2 > sqrt_input + 2^64
|
||||||
|
sqrt_input^2 + sqrt_input*(2^33 - 3) + (2^32-1)^2 > 2^64
|
||||||
|
sqrt_input^2 + sqrt_input*(2^33 - 3) + 2^64-2^33+1 > 2^64
|
||||||
|
sqrt_input^2 + sqrt_input*(2^33 - 3) - 2^33 + 1 > 0
|
||||||
|
This inequality is true if sqrt_input > 1 and it's easy to check that s = 0 if sqrt_input is 0 or 1, so there will be no integer overflow
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define VARIANT2_INTEGER_MATH_SQRT_FIXUP(r) \
|
||||||
|
do { \
|
||||||
|
const uint64_t s = r >> 1; \
|
||||||
|
const uint64_t b = r & 1; \
|
||||||
|
const uint64_t r2 = (uint64_t)(s) * (s + b) + (r << 32); \
|
||||||
|
r += ((r2 + b > sqrt_input) ? -1 : 0) + ((r2 + (1ULL << 32) < sqrt_input - s) ? 1 : 0); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#endif
|
||||||
301
src/crypto/flex/cryptonote/cryptonight_dark.c
Normal file
301
src/crypto/flex/cryptonote/cryptonight_dark.c
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
// Portions Copyright (c) 2018 The Monero developers
|
||||||
|
// Portions Copyright (c) 2018 The TurtleCoin Developers
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "crypto/oaes_lib.h"
|
||||||
|
#include "crypto/c_keccak.h"
|
||||||
|
#include "crypto/c_groestl.h"
|
||||||
|
#include "crypto/c_blake256.h"
|
||||||
|
#include "crypto/c_jh.h"
|
||||||
|
#include "../../cn/c_skein.h"
|
||||||
|
#include "crypto/int-util.h"
|
||||||
|
#include "crypto/hash-ops.h"
|
||||||
|
#include "crypto/variant2_int_sqrt.h"
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MEMORY 524288 /* 512KB - 2^19 */
|
||||||
|
#define ITER 262144 /* 2^18 */
|
||||||
|
#define ITER_DIV 131072 /* 2^17 */
|
||||||
|
#define AES_BLOCK_SIZE 16
|
||||||
|
#define AES_KEY_SIZE 32 /*16*/
|
||||||
|
#define INIT_SIZE_BLK 8
|
||||||
|
#define INIT_SIZE_BYTE (INIT_SIZE_BLK * AES_BLOCK_SIZE)
|
||||||
|
#define CN_INIT (MEMORY / INIT_SIZE_BYTE)
|
||||||
|
#define CN_AES_INIT (MEMORY / AES_BLOCK_SIZE)
|
||||||
|
|
||||||
|
#define VARIANT1_1(p) \
|
||||||
|
do if (variant == 1) \
|
||||||
|
{ \
|
||||||
|
const uint8_t tmp = ((const uint8_t*)(p))[11]; \
|
||||||
|
static const uint32_t table = 0x75310; \
|
||||||
|
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1; \
|
||||||
|
((uint8_t*)(p))[11] = tmp ^ ((table >> index) & 0x30); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define VARIANT1_2(p) \
|
||||||
|
do if (variant == 1) \
|
||||||
|
{ \
|
||||||
|
((uint64_t*)p)[1] ^= tweak1_2; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define VARIANT1_INIT() \
|
||||||
|
if (variant == 1 && len < 43) \
|
||||||
|
{ \
|
||||||
|
fprintf(stderr, "Cryptonight variant 1 needs at least 43 bytes of data"); \
|
||||||
|
_exit(1); \
|
||||||
|
} \
|
||||||
|
const uint64_t tweak1_2 = (variant == 1) ? *(const uint64_t*)(((const uint8_t*)input)+35) ^ ctx->state.hs.w[24] : 0
|
||||||
|
|
||||||
|
#define U64(p) ((uint64_t*)(p))
|
||||||
|
|
||||||
|
#define VARIANT2_INIT(b, state) \
|
||||||
|
uint64_t division_result; \
|
||||||
|
uint64_t sqrt_result; \
|
||||||
|
do if (variant >= 2) \
|
||||||
|
{ \
|
||||||
|
U64(b)[2] = state.hs.w[8] ^ state.hs.w[10]; \
|
||||||
|
U64(b)[3] = state.hs.w[9] ^ state.hs.w[11]; \
|
||||||
|
division_result = state.hs.w[12]; \
|
||||||
|
sqrt_result = state.hs.w[13]; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define VARIANT2_SHUFFLE_ADD(base_ptr, offset, a, b) \
|
||||||
|
do if (variant >= 2) \
|
||||||
|
{ \
|
||||||
|
uint64_t* chunk1 = U64((base_ptr) + ((offset) ^ 0x10)); \
|
||||||
|
uint64_t* chunk2 = U64((base_ptr) + ((offset) ^ 0x20)); \
|
||||||
|
uint64_t* chunk3 = U64((base_ptr) + ((offset) ^ 0x30)); \
|
||||||
|
\
|
||||||
|
const uint64_t chunk1_old[2] = { chunk1[0], chunk1[1] }; \
|
||||||
|
\
|
||||||
|
chunk1[0] = chunk3[0] + U64(b + 16)[0]; \
|
||||||
|
chunk1[1] = chunk3[1] + U64(b + 16)[1]; \
|
||||||
|
\
|
||||||
|
chunk3[0] = chunk2[0] + U64(a)[0]; \
|
||||||
|
chunk3[1] = chunk2[1] + U64(a)[1]; \
|
||||||
|
\
|
||||||
|
chunk2[0] = chunk1_old[0] + U64(b)[0]; \
|
||||||
|
chunk2[1] = chunk1_old[1] + U64(b)[1]; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define VARIANT2_INTEGER_MATH_DIVISION_STEP(b, ptr) \
|
||||||
|
((uint64_t*)(b))[0] ^= division_result ^ (sqrt_result << 32); \
|
||||||
|
{ \
|
||||||
|
const uint64_t dividend = ((uint64_t*)(ptr))[1]; \
|
||||||
|
const uint32_t divisor = (((uint32_t*)(ptr))[0] + (uint32_t)(sqrt_result << 1)) | 0x80000001UL; \
|
||||||
|
division_result = ((uint32_t)(dividend / divisor)) + \
|
||||||
|
(((uint64_t)(dividend % divisor)) << 32); \
|
||||||
|
} \
|
||||||
|
const uint64_t sqrt_input = ((uint64_t*)(ptr))[0] + division_result
|
||||||
|
|
||||||
|
#define VARIANT2_INTEGER_MATH(b, ptr) \
|
||||||
|
do if (variant >= 2) \
|
||||||
|
{ \
|
||||||
|
VARIANT2_INTEGER_MATH_DIVISION_STEP(b, ptr); \
|
||||||
|
VARIANT2_INTEGER_MATH_SQRT_STEP_FP64(); \
|
||||||
|
VARIANT2_INTEGER_MATH_SQRT_FIXUP(sqrt_result); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define VARIANT2_2() \
|
||||||
|
do if (variant >= 2) { \
|
||||||
|
((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x10)))[0] ^= hi; \
|
||||||
|
((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x10)))[1] ^= lo; \
|
||||||
|
hi ^= ((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x20)))[0]; \
|
||||||
|
lo ^= ((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x20)))[1]; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
union cn_slow_hash_state {
|
||||||
|
union hash_state hs;
|
||||||
|
struct {
|
||||||
|
uint8_t k[64];
|
||||||
|
uint8_t init[INIT_SIZE_BYTE];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
static void do_dark_blake_hash(const void* input, size_t len, char* output) {
|
||||||
|
blake256_hash((uint8_t*)output, input, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_dark_groestl_hash(const void* input, size_t len, char* output) {
|
||||||
|
groestl(input, len * 8, (uint8_t*)output);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void do_dark_jh_hash(const void* input, size_t len, char* output) {
|
||||||
|
int r = jh_hash(HASH_SIZE * 8, input, 8 * len, (uint8_t*)output);
|
||||||
|
assert(SUCCESS == r);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void do_dark_skein_hash(const void* input, size_t len, char* output) {
|
||||||
|
int r = skein_hash(8 * HASH_SIZE, input, 8 * len, (uint8_t*)output);
|
||||||
|
assert(SKEIN_SUCCESS == r);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void (* const extra_hashes[3])(const void *, size_t, char *) = {
|
||||||
|
do_dark_blake_hash, do_dark_groestl_hash, do_dark_skein_hash
|
||||||
|
};
|
||||||
|
|
||||||
|
extern int aesb_single_round(const uint8_t *in, uint8_t*out, const uint8_t *expandedKey);
|
||||||
|
extern int aesb_pseudo_round(const uint8_t *in, uint8_t *out, const uint8_t *expandedKey);
|
||||||
|
|
||||||
|
static inline size_t e2i(const uint8_t* a) {
|
||||||
|
return (*((uint64_t*) a) / AES_BLOCK_SIZE) & (CN_AES_INIT - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mul(const uint8_t* a, const uint8_t* b, uint8_t* res) {
|
||||||
|
((uint64_t*) res)[1] = mul128(((uint64_t*) a)[0], ((uint64_t*) b)[0], (uint64_t*) res);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sum_half_blocks(uint8_t* a, const uint8_t* b) {
|
||||||
|
uint64_t a0, a1, b0, b1;
|
||||||
|
|
||||||
|
a0 = SWAP64LE(((uint64_t*) a)[0]);
|
||||||
|
a1 = SWAP64LE(((uint64_t*) a)[1]);
|
||||||
|
b0 = SWAP64LE(((uint64_t*) b)[0]);
|
||||||
|
b1 = SWAP64LE(((uint64_t*) b)[1]);
|
||||||
|
a0 += b0;
|
||||||
|
a1 += b1;
|
||||||
|
((uint64_t*) a)[0] = SWAP64LE(a0);
|
||||||
|
((uint64_t*) a)[1] = SWAP64LE(a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void copy_block(uint8_t* dst, const uint8_t* src) {
|
||||||
|
((uint64_t*) dst)[0] = ((uint64_t*) src)[0];
|
||||||
|
((uint64_t*) dst)[1] = ((uint64_t*) src)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void swap_blocks(uint8_t* a, uint8_t* b) {
|
||||||
|
size_t i;
|
||||||
|
uint8_t t;
|
||||||
|
for (i = 0; i < AES_BLOCK_SIZE; i++) {
|
||||||
|
t = a[i];
|
||||||
|
a[i] = b[i];
|
||||||
|
b[i] = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void xor_blocks(uint8_t* a, const uint8_t* b) {
|
||||||
|
((uint64_t*) a)[0] ^= ((uint64_t*) b)[0];
|
||||||
|
((uint64_t*) a)[1] ^= ((uint64_t*) b)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void xor_blocks_dst(const uint8_t* a, const uint8_t* b, uint8_t* dst) {
|
||||||
|
((uint64_t*) dst)[0] = ((uint64_t*) a)[0] ^ ((uint64_t*) b)[0];
|
||||||
|
((uint64_t*) dst)[1] = ((uint64_t*) a)[1] ^ ((uint64_t*) b)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
struct cryptonightdark_ctx {
|
||||||
|
uint8_t long_state[MEMORY];
|
||||||
|
union cn_slow_hash_state state;
|
||||||
|
uint8_t text[INIT_SIZE_BYTE];
|
||||||
|
uint8_t a[AES_BLOCK_SIZE];
|
||||||
|
uint8_t b[AES_BLOCK_SIZE * 2];
|
||||||
|
uint8_t c[AES_BLOCK_SIZE];
|
||||||
|
uint8_t aes_key[AES_KEY_SIZE];
|
||||||
|
oaes_ctx* aes_ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
void cryptonightdark_hash(const char* input, char* output, uint32_t len, int variant) {
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
struct cryptonightdark_ctx *ctx = _malloca(sizeof(struct cryptonightdark_ctx));
|
||||||
|
#else
|
||||||
|
struct cryptonightdark_ctx *ctx = alloca(sizeof(struct cryptonightdark_ctx));
|
||||||
|
#endif
|
||||||
|
hash_process(&ctx->state.hs, (const uint8_t*) input, len);
|
||||||
|
memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE);
|
||||||
|
memcpy(ctx->aes_key, ctx->state.hs.b, AES_KEY_SIZE);
|
||||||
|
ctx->aes_ctx = (oaes_ctx*) oaes_alloc();
|
||||||
|
size_t i, j;
|
||||||
|
|
||||||
|
VARIANT1_INIT();
|
||||||
|
VARIANT2_INIT(ctx->b, ctx->state);
|
||||||
|
|
||||||
|
oaes_key_import_data(ctx->aes_ctx, ctx->aes_key, AES_KEY_SIZE);
|
||||||
|
for (i = 0; i < CN_INIT; i++) {
|
||||||
|
for (j = 0; j < INIT_SIZE_BLK; j++) {
|
||||||
|
aesb_pseudo_round(&ctx->text[AES_BLOCK_SIZE * j],
|
||||||
|
&ctx->text[AES_BLOCK_SIZE * j],
|
||||||
|
ctx->aes_ctx->key->exp_data);
|
||||||
|
}
|
||||||
|
memcpy(&ctx->long_state[i * INIT_SIZE_BYTE], ctx->text, INIT_SIZE_BYTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 16; i++) {
|
||||||
|
ctx->a[i] = ctx->state.k[i] ^ ctx->state.k[32 + i];
|
||||||
|
ctx->b[i] = ctx->state.k[16 + i] ^ ctx->state.k[48 + i];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < ITER_DIV; i++) {
|
||||||
|
/* Dependency chain: address -> read value ------+
|
||||||
|
* written value <-+ hard function (AES or MUL) <+
|
||||||
|
* next address <-+
|
||||||
|
*/
|
||||||
|
/* Iteration 1 */
|
||||||
|
j = e2i(ctx->a);
|
||||||
|
aesb_single_round(&ctx->long_state[j * AES_BLOCK_SIZE], ctx->c, ctx->a);
|
||||||
|
VARIANT2_SHUFFLE_ADD(ctx->long_state, j * AES_BLOCK_SIZE, ctx->a, ctx->b);
|
||||||
|
xor_blocks_dst(ctx->c, ctx->b, &ctx->long_state[j * AES_BLOCK_SIZE]);
|
||||||
|
VARIANT1_1((uint8_t*)&ctx->long_state[j * AES_BLOCK_SIZE]);
|
||||||
|
/* Iteration 2 */
|
||||||
|
j = e2i(ctx->c);
|
||||||
|
|
||||||
|
uint64_t* dst = (uint64_t*)&ctx->long_state[j * AES_BLOCK_SIZE];
|
||||||
|
|
||||||
|
uint64_t t[2];
|
||||||
|
t[0] = dst[0];
|
||||||
|
t[1] = dst[1];
|
||||||
|
|
||||||
|
VARIANT2_INTEGER_MATH(t, ctx->c);
|
||||||
|
|
||||||
|
uint64_t hi;
|
||||||
|
uint64_t lo = mul128(((uint64_t*)ctx->c)[0], t[0], &hi);
|
||||||
|
|
||||||
|
VARIANT2_2();
|
||||||
|
VARIANT2_SHUFFLE_ADD(ctx->long_state, j * AES_BLOCK_SIZE, ctx->a, ctx->b);
|
||||||
|
|
||||||
|
((uint64_t*)ctx->a)[0] += hi;
|
||||||
|
((uint64_t*)ctx->a)[1] += lo;
|
||||||
|
|
||||||
|
dst[0] = ((uint64_t*)ctx->a)[0];
|
||||||
|
dst[1] = ((uint64_t*)ctx->a)[1];
|
||||||
|
|
||||||
|
((uint64_t*)ctx->a)[0] ^= t[0];
|
||||||
|
((uint64_t*)ctx->a)[1] ^= t[1];
|
||||||
|
|
||||||
|
VARIANT1_2((uint8_t*)&ctx->long_state[j * AES_BLOCK_SIZE]);
|
||||||
|
copy_block(ctx->b + AES_BLOCK_SIZE, ctx->b);
|
||||||
|
copy_block(ctx->b, ctx->c);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE);
|
||||||
|
oaes_key_import_data(ctx->aes_ctx, &ctx->state.hs.b[32], AES_KEY_SIZE);
|
||||||
|
for (i = 0; i < CN_INIT; i++) {
|
||||||
|
for (j = 0; j < INIT_SIZE_BLK; j++) {
|
||||||
|
xor_blocks(&ctx->text[j * AES_BLOCK_SIZE],
|
||||||
|
&ctx->long_state[i * INIT_SIZE_BYTE + j * AES_BLOCK_SIZE]);
|
||||||
|
aesb_pseudo_round(&ctx->text[j * AES_BLOCK_SIZE],
|
||||||
|
&ctx->text[j * AES_BLOCK_SIZE],
|
||||||
|
ctx->aes_ctx->key->exp_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memcpy(ctx->state.init, ctx->text, INIT_SIZE_BYTE);
|
||||||
|
hash_permutation(&ctx->state.hs);
|
||||||
|
/*memcpy(hash, &state, 32);*/
|
||||||
|
extra_hashes[ctx->state.hs.b[0] & 2](&ctx->state, 200, output);
|
||||||
|
oaes_free((OAES_CTX **) &ctx->aes_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cryptonightdark_fast_hash(const char* input, char* output, uint32_t len) {
|
||||||
|
union hash_state state;
|
||||||
|
hash_process(&state, (const uint8_t*) input, len);
|
||||||
|
memcpy(output, &state, HASH_SIZE);
|
||||||
|
}
|
||||||
17
src/crypto/flex/cryptonote/cryptonight_dark.h
Normal file
17
src/crypto/flex/cryptonote/cryptonight_dark.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef CRYPTONIGHTDARK_H
|
||||||
|
#define CRYPTONIGHTDARK_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
void cryptonightdark_hash(const char* input, char* output, uint32_t len, int variant);
|
||||||
|
void cryptonightdark_fast_hash(const char* input, char* output, uint32_t len);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
301
src/crypto/flex/cryptonote/cryptonight_dark_lite.c
Normal file
301
src/crypto/flex/cryptonote/cryptonight_dark_lite.c
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
// Portions Copyright (c) 2018 The Monero developers
|
||||||
|
// Portions Copyright (c) 2018 The darkCoin Developers
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "crypto/oaes_lib.h"
|
||||||
|
#include "crypto/c_keccak.h"
|
||||||
|
#include "crypto/c_groestl.h"
|
||||||
|
#include "crypto/c_blake256.h"
|
||||||
|
#include "crypto/c_jh.h"
|
||||||
|
#include "../../cn/c_skein.h"
|
||||||
|
#include "crypto/int-util.h"
|
||||||
|
#include "crypto/hash-ops.h"
|
||||||
|
#include "crypto/variant2_int_sqrt.h"
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MEMORY 524288 /* 512KB - 2^19 */
|
||||||
|
#define ITER 262144 /* 2^18 */
|
||||||
|
#define ITER_DIV 131072 /* 2^17 */
|
||||||
|
#define AES_BLOCK_SIZE 16
|
||||||
|
#define AES_KEY_SIZE 32 /*16*/
|
||||||
|
#define INIT_SIZE_BLK 8
|
||||||
|
#define INIT_SIZE_BYTE (INIT_SIZE_BLK * AES_BLOCK_SIZE)
|
||||||
|
#define CN_INIT (MEMORY / INIT_SIZE_BYTE)
|
||||||
|
#define CN_AES_INIT (MEMORY / AES_BLOCK_SIZE) / 2
|
||||||
|
|
||||||
|
#define VARIANT1_1(p) \
|
||||||
|
do if (variant == 1) \
|
||||||
|
{ \
|
||||||
|
const uint8_t tmp = ((const uint8_t*)(p))[11]; \
|
||||||
|
static const uint32_t table = 0x75310; \
|
||||||
|
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1; \
|
||||||
|
((uint8_t*)(p))[11] = tmp ^ ((table >> index) & 0x30); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define VARIANT1_2(p) \
|
||||||
|
do if (variant == 1) \
|
||||||
|
{ \
|
||||||
|
((uint64_t*)p)[1] ^= tweak1_2; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define VARIANT1_INIT() \
|
||||||
|
if (variant == 1 && len < 43) \
|
||||||
|
{ \
|
||||||
|
fprintf(stderr, "Cryptonight variant 1 needs at least 43 bytes of data"); \
|
||||||
|
_exit(1); \
|
||||||
|
} \
|
||||||
|
const uint64_t tweak1_2 = (variant == 1) ? *(const uint64_t*)(((const uint8_t*)input)+35) ^ ctx->state.hs.w[24] : 0
|
||||||
|
|
||||||
|
#define U64(p) ((uint64_t*)(p))
|
||||||
|
|
||||||
|
#define VARIANT2_INIT(b, state) \
|
||||||
|
uint64_t division_result; \
|
||||||
|
uint64_t sqrt_result; \
|
||||||
|
do if (variant >= 2) \
|
||||||
|
{ \
|
||||||
|
U64(b)[2] = state.hs.w[8] ^ state.hs.w[10]; \
|
||||||
|
U64(b)[3] = state.hs.w[9] ^ state.hs.w[11]; \
|
||||||
|
division_result = state.hs.w[12]; \
|
||||||
|
sqrt_result = state.hs.w[13]; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define VARIANT2_SHUFFLE_ADD(base_ptr, offset, a, b) \
|
||||||
|
do if (variant >= 2) \
|
||||||
|
{ \
|
||||||
|
uint64_t* chunk1 = U64((base_ptr) + ((offset) ^ 0x10)); \
|
||||||
|
uint64_t* chunk2 = U64((base_ptr) + ((offset) ^ 0x20)); \
|
||||||
|
uint64_t* chunk3 = U64((base_ptr) + ((offset) ^ 0x30)); \
|
||||||
|
\
|
||||||
|
const uint64_t chunk1_old[2] = { chunk1[0], chunk1[1] }; \
|
||||||
|
\
|
||||||
|
chunk1[0] = chunk3[0] + U64(b + 16)[0]; \
|
||||||
|
chunk1[1] = chunk3[1] + U64(b + 16)[1]; \
|
||||||
|
\
|
||||||
|
chunk3[0] = chunk2[0] + U64(a)[0]; \
|
||||||
|
chunk3[1] = chunk2[1] + U64(a)[1]; \
|
||||||
|
\
|
||||||
|
chunk2[0] = chunk1_old[0] + U64(b)[0]; \
|
||||||
|
chunk2[1] = chunk1_old[1] + U64(b)[1]; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define VARIANT2_INTEGER_MATH_DIVISION_STEP(b, ptr) \
|
||||||
|
((uint64_t*)(b))[0] ^= division_result ^ (sqrt_result << 32); \
|
||||||
|
{ \
|
||||||
|
const uint64_t dividend = ((uint64_t*)(ptr))[1]; \
|
||||||
|
const uint32_t divisor = (((uint32_t*)(ptr))[0] + (uint32_t)(sqrt_result << 1)) | 0x80000001UL; \
|
||||||
|
division_result = ((uint32_t)(dividend / divisor)) + \
|
||||||
|
(((uint64_t)(dividend % divisor)) << 32); \
|
||||||
|
} \
|
||||||
|
const uint64_t sqrt_input = ((uint64_t*)(ptr))[0] + division_result
|
||||||
|
|
||||||
|
#define VARIANT2_INTEGER_MATH(b, ptr) \
|
||||||
|
do if (variant >= 2) \
|
||||||
|
{ \
|
||||||
|
VARIANT2_INTEGER_MATH_DIVISION_STEP(b, ptr); \
|
||||||
|
VARIANT2_INTEGER_MATH_SQRT_STEP_FP64(); \
|
||||||
|
VARIANT2_INTEGER_MATH_SQRT_FIXUP(sqrt_result); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define VARIANT2_2() \
|
||||||
|
do if (variant >= 2) { \
|
||||||
|
((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x10)))[0] ^= hi; \
|
||||||
|
((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x10)))[1] ^= lo; \
|
||||||
|
hi ^= ((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x20)))[0]; \
|
||||||
|
lo ^= ((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x20)))[1]; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
union cn_slow_hash_state {
|
||||||
|
union hash_state hs;
|
||||||
|
struct {
|
||||||
|
uint8_t k[64];
|
||||||
|
uint8_t init[INIT_SIZE_BYTE];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
static void do_dark_lite_blake_hash(const void* input, size_t len, char* output) {
|
||||||
|
blake256_hash((uint8_t*)output, input, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_dark_lite_groestl_hash(const void* input, size_t len, char* output) {
|
||||||
|
groestl(input, len * 8, (uint8_t*)output);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void do_dark_lite_jh_hash(const void* input, size_t len, char* output) {
|
||||||
|
int r = jh_hash(HASH_SIZE * 8, input, 8 * len, (uint8_t*)output);
|
||||||
|
assert(SUCCESS == r);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void do_dark_lite_skein_hash(const void* input, size_t len, char* output) {
|
||||||
|
int r = skein_hash(8 * HASH_SIZE, input, 8 * len, (uint8_t*)output);
|
||||||
|
assert(SKEIN_SUCCESS == r);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void (* const extra_hashes[3])(const void *, size_t, char *) = {
|
||||||
|
do_dark_lite_blake_hash, do_dark_lite_groestl_hash, do_dark_lite_skein_hash
|
||||||
|
};
|
||||||
|
|
||||||
|
extern int aesb_single_round(const uint8_t *in, uint8_t*out, const uint8_t *expandedKey);
|
||||||
|
extern int aesb_pseudo_round(const uint8_t *in, uint8_t *out, const uint8_t *expandedKey);
|
||||||
|
|
||||||
|
static inline size_t e2i(const uint8_t* a) {
|
||||||
|
return (*((uint64_t*) a) / AES_BLOCK_SIZE) & (CN_AES_INIT - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mul(const uint8_t* a, const uint8_t* b, uint8_t* res) {
|
||||||
|
((uint64_t*) res)[1] = mul128(((uint64_t*) a)[0], ((uint64_t*) b)[0], (uint64_t*) res);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sum_half_blocks(uint8_t* a, const uint8_t* b) {
|
||||||
|
uint64_t a0, a1, b0, b1;
|
||||||
|
|
||||||
|
a0 = SWAP64LE(((uint64_t*) a)[0]);
|
||||||
|
a1 = SWAP64LE(((uint64_t*) a)[1]);
|
||||||
|
b0 = SWAP64LE(((uint64_t*) b)[0]);
|
||||||
|
b1 = SWAP64LE(((uint64_t*) b)[1]);
|
||||||
|
a0 += b0;
|
||||||
|
a1 += b1;
|
||||||
|
((uint64_t*) a)[0] = SWAP64LE(a0);
|
||||||
|
((uint64_t*) a)[1] = SWAP64LE(a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void copy_block(uint8_t* dst, const uint8_t* src) {
|
||||||
|
((uint64_t*) dst)[0] = ((uint64_t*) src)[0];
|
||||||
|
((uint64_t*) dst)[1] = ((uint64_t*) src)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void swap_blocks(uint8_t* a, uint8_t* b) {
|
||||||
|
size_t i;
|
||||||
|
uint8_t t;
|
||||||
|
for (i = 0; i < AES_BLOCK_SIZE; i++) {
|
||||||
|
t = a[i];
|
||||||
|
a[i] = b[i];
|
||||||
|
b[i] = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void xor_blocks(uint8_t* a, const uint8_t* b) {
|
||||||
|
((uint64_t*) a)[0] ^= ((uint64_t*) b)[0];
|
||||||
|
((uint64_t*) a)[1] ^= ((uint64_t*) b)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void xor_blocks_dst(const uint8_t* a, const uint8_t* b, uint8_t* dst) {
|
||||||
|
((uint64_t*) dst)[0] = ((uint64_t*) a)[0] ^ ((uint64_t*) b)[0];
|
||||||
|
((uint64_t*) dst)[1] = ((uint64_t*) a)[1] ^ ((uint64_t*) b)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
struct cryptonightdarklite_ctx {
|
||||||
|
uint8_t long_state[MEMORY];
|
||||||
|
union cn_slow_hash_state state;
|
||||||
|
uint8_t text[INIT_SIZE_BYTE];
|
||||||
|
uint8_t a[AES_BLOCK_SIZE];
|
||||||
|
uint8_t b[AES_BLOCK_SIZE * 2];
|
||||||
|
uint8_t c[AES_BLOCK_SIZE];
|
||||||
|
uint8_t aes_key[AES_KEY_SIZE];
|
||||||
|
oaes_ctx* aes_ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
void cryptonightdarklite_hash(const char* input, char* output, uint32_t len, int variant) {
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
struct cryptonightdarklite_ctx *ctx = _malloca(sizeof(struct cryptonightdarklite_ctx));
|
||||||
|
#else
|
||||||
|
struct cryptonightdarklite_ctx *ctx = alloca(sizeof(struct cryptonightdarklite_ctx));
|
||||||
|
#endif
|
||||||
|
hash_process(&ctx->state.hs, (const uint8_t*) input, len);
|
||||||
|
memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE);
|
||||||
|
memcpy(ctx->aes_key, ctx->state.hs.b, AES_KEY_SIZE);
|
||||||
|
ctx->aes_ctx = (oaes_ctx*) oaes_alloc();
|
||||||
|
size_t i, j;
|
||||||
|
|
||||||
|
VARIANT1_INIT();
|
||||||
|
VARIANT2_INIT(ctx->b, ctx->state);
|
||||||
|
|
||||||
|
oaes_key_import_data(ctx->aes_ctx, ctx->aes_key, AES_KEY_SIZE);
|
||||||
|
for (i = 0; i < CN_INIT; i++) {
|
||||||
|
for (j = 0; j < INIT_SIZE_BLK; j++) {
|
||||||
|
aesb_pseudo_round(&ctx->text[AES_BLOCK_SIZE * j],
|
||||||
|
&ctx->text[AES_BLOCK_SIZE * j],
|
||||||
|
ctx->aes_ctx->key->exp_data);
|
||||||
|
}
|
||||||
|
memcpy(&ctx->long_state[i * INIT_SIZE_BYTE], ctx->text, INIT_SIZE_BYTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 16; i++) {
|
||||||
|
ctx->a[i] = ctx->state.k[i] ^ ctx->state.k[32 + i];
|
||||||
|
ctx->b[i] = ctx->state.k[16 + i] ^ ctx->state.k[48 + i];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < ITER_DIV; i++) {
|
||||||
|
/* Dependency chain: address -> read value ------+
|
||||||
|
* written value <-+ hard function (AES or MUL) <+
|
||||||
|
* next address <-+
|
||||||
|
*/
|
||||||
|
/* Iteration 1 */
|
||||||
|
j = e2i(ctx->a);
|
||||||
|
aesb_single_round(&ctx->long_state[j * AES_BLOCK_SIZE], ctx->c, ctx->a);
|
||||||
|
VARIANT2_SHUFFLE_ADD(ctx->long_state, j * AES_BLOCK_SIZE, ctx->a, ctx->b);
|
||||||
|
xor_blocks_dst(ctx->c, ctx->b, &ctx->long_state[j * AES_BLOCK_SIZE]);
|
||||||
|
VARIANT1_1((uint8_t*)&ctx->long_state[j * AES_BLOCK_SIZE]);
|
||||||
|
/* Iteration 2 */
|
||||||
|
j = e2i(ctx->c);
|
||||||
|
|
||||||
|
uint64_t* dst = (uint64_t*)&ctx->long_state[j * AES_BLOCK_SIZE];
|
||||||
|
|
||||||
|
uint64_t t[2];
|
||||||
|
t[0] = dst[0];
|
||||||
|
t[1] = dst[1];
|
||||||
|
|
||||||
|
VARIANT2_INTEGER_MATH(t, ctx->c);
|
||||||
|
|
||||||
|
uint64_t hi;
|
||||||
|
uint64_t lo = mul128(((uint64_t*)ctx->c)[0], t[0], &hi);
|
||||||
|
|
||||||
|
VARIANT2_2();
|
||||||
|
VARIANT2_SHUFFLE_ADD(ctx->long_state, j * AES_BLOCK_SIZE, ctx->a, ctx->b);
|
||||||
|
|
||||||
|
((uint64_t*)ctx->a)[0] += hi;
|
||||||
|
((uint64_t*)ctx->a)[1] += lo;
|
||||||
|
|
||||||
|
dst[0] = ((uint64_t*)ctx->a)[0];
|
||||||
|
dst[1] = ((uint64_t*)ctx->a)[1];
|
||||||
|
|
||||||
|
((uint64_t*)ctx->a)[0] ^= t[0];
|
||||||
|
((uint64_t*)ctx->a)[1] ^= t[1];
|
||||||
|
|
||||||
|
VARIANT1_2((uint8_t*)&ctx->long_state[j * AES_BLOCK_SIZE]);
|
||||||
|
copy_block(ctx->b + AES_BLOCK_SIZE, ctx->b);
|
||||||
|
copy_block(ctx->b, ctx->c);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE);
|
||||||
|
oaes_key_import_data(ctx->aes_ctx, &ctx->state.hs.b[32], AES_KEY_SIZE);
|
||||||
|
for (i = 0; i < CN_INIT; i++) {
|
||||||
|
for (j = 0; j < INIT_SIZE_BLK; j++) {
|
||||||
|
xor_blocks(&ctx->text[j * AES_BLOCK_SIZE],
|
||||||
|
&ctx->long_state[i * INIT_SIZE_BYTE + j * AES_BLOCK_SIZE]);
|
||||||
|
aesb_pseudo_round(&ctx->text[j * AES_BLOCK_SIZE],
|
||||||
|
&ctx->text[j * AES_BLOCK_SIZE],
|
||||||
|
ctx->aes_ctx->key->exp_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memcpy(ctx->state.init, ctx->text, INIT_SIZE_BYTE);
|
||||||
|
hash_permutation(&ctx->state.hs);
|
||||||
|
/*memcpy(hash, &state, 32);*/
|
||||||
|
extra_hashes[ctx->state.hs.b[0] & 2](&ctx->state, 200, output);
|
||||||
|
oaes_free((OAES_CTX **) &ctx->aes_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cryptonightdarklite_fast_hash(const char* input, char* output, uint32_t len) {
|
||||||
|
union hash_state state;
|
||||||
|
hash_process(&state, (const uint8_t*) input, len);
|
||||||
|
memcpy(output, &state, HASH_SIZE);
|
||||||
|
}
|
||||||
17
src/crypto/flex/cryptonote/cryptonight_dark_lite.h
Normal file
17
src/crypto/flex/cryptonote/cryptonight_dark_lite.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef CRYPTONIGHTDARKLITE_H
|
||||||
|
#define CRYPTONIGHTDARKLITE_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
void cryptonightdarklite_hash(const char* input, char* output, uint32_t len, int variant);
|
||||||
|
void cryptonightdarklite_fast_hash(const char* input, char* output, uint32_t len);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
298
src/crypto/flex/cryptonote/cryptonight_fast.c
Normal file
298
src/crypto/flex/cryptonote/cryptonight_fast.c
Normal file
@@ -0,0 +1,298 @@
|
|||||||
|
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
// Portions Copyright (c) 2018 The Monero developers
|
||||||
|
// Portions Copyright (c) 2018 The TurtleCoin Developers
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "crypto/oaes_lib.h"
|
||||||
|
#include "crypto/c_keccak.h"
|
||||||
|
#include "crypto/c_groestl.h"
|
||||||
|
#include "crypto/c_blake256.h"
|
||||||
|
#include "crypto/c_jh.h"
|
||||||
|
#include "../../cn/c_skein.h"
|
||||||
|
#include "crypto/int-util.h"
|
||||||
|
#include "crypto/hash-ops.h"
|
||||||
|
#include "crypto/variant2_int_sqrt.h"
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MEMORY 2097152 /* 2 MiB 2^21 */
|
||||||
|
#define ITER 524288 /* 2^19 */
|
||||||
|
#define ITER_DIV 262144 /* 2^18 */
|
||||||
|
#define AES_BLOCK_SIZE 16
|
||||||
|
#define AES_KEY_SIZE 32 /*16*/
|
||||||
|
#define INIT_SIZE_BLK 8
|
||||||
|
#define INIT_SIZE_BYTE (INIT_SIZE_BLK * AES_BLOCK_SIZE)
|
||||||
|
#define CN_INIT (MEMORY / INIT_SIZE_BYTE)
|
||||||
|
#define CN_AES_INIT (MEMORY / AES_BLOCK_SIZE)
|
||||||
|
|
||||||
|
#define VARIANT1_1(p) \
|
||||||
|
do if (variant == 1) \
|
||||||
|
{ \
|
||||||
|
const uint8_t tmp = ((const uint8_t*)(p))[11]; \
|
||||||
|
static const uint32_t table = 0x75310; \
|
||||||
|
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1; \
|
||||||
|
((uint8_t*)(p))[11] = tmp ^ ((table >> index) & 0x30); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define VARIANT1_2(p) \
|
||||||
|
do if (variant == 1) \
|
||||||
|
{ \
|
||||||
|
((uint64_t*)p)[1] ^= tweak1_2; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define VARIANT1_INIT() \
|
||||||
|
if (variant == 1 && len < 43) \
|
||||||
|
{ \
|
||||||
|
fprintf(stderr, "Cryptonight variant 1 needs at least 43 bytes of data"); \
|
||||||
|
_exit(1); \
|
||||||
|
} \
|
||||||
|
const uint64_t tweak1_2 = (variant == 1) ? *(const uint64_t*)(((const uint8_t*)input)+35) ^ ctx->state.hs.w[24] : 0
|
||||||
|
|
||||||
|
#define U64(p) ((uint64_t*)(p))
|
||||||
|
|
||||||
|
#define VARIANT2_INIT(b, state) \
|
||||||
|
uint64_t division_result; \
|
||||||
|
uint64_t sqrt_result; \
|
||||||
|
do if (variant >= 2) \
|
||||||
|
{ \
|
||||||
|
U64(b)[2] = state.hs.w[8] ^ state.hs.w[10]; \
|
||||||
|
U64(b)[3] = state.hs.w[9] ^ state.hs.w[11]; \
|
||||||
|
division_result = state.hs.w[12]; \
|
||||||
|
sqrt_result = state.hs.w[13]; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define VARIANT2_SHUFFLE_ADD(base_ptr, offset, a, b) \
|
||||||
|
do if (variant >= 2) \
|
||||||
|
{ \
|
||||||
|
uint64_t* chunk1 = U64((base_ptr) + ((offset) ^ 0x10)); \
|
||||||
|
uint64_t* chunk2 = U64((base_ptr) + ((offset) ^ 0x20)); \
|
||||||
|
uint64_t* chunk3 = U64((base_ptr) + ((offset) ^ 0x30)); \
|
||||||
|
\
|
||||||
|
const uint64_t chunk1_old[2] = { chunk1[0], chunk1[1] }; \
|
||||||
|
\
|
||||||
|
chunk1[0] = chunk3[0] + U64(b + 16)[0]; \
|
||||||
|
chunk1[1] = chunk3[1] + U64(b + 16)[1]; \
|
||||||
|
\
|
||||||
|
chunk3[0] = chunk2[0] + U64(a)[0]; \
|
||||||
|
chunk3[1] = chunk2[1] + U64(a)[1]; \
|
||||||
|
\
|
||||||
|
chunk2[0] = chunk1_old[0] + U64(b)[0]; \
|
||||||
|
chunk2[1] = chunk1_old[1] + U64(b)[1]; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define VARIANT2_INTEGER_MATH_DIVISION_STEP(b, ptr) \
|
||||||
|
((uint64_t*)(b))[0] ^= division_result ^ (sqrt_result << 32); \
|
||||||
|
{ \
|
||||||
|
const uint64_t dividend = ((uint64_t*)(ptr))[1]; \
|
||||||
|
const uint32_t divisor = (((uint32_t*)(ptr))[0] + (uint32_t)(sqrt_result << 1)) | 0x80000001UL; \
|
||||||
|
division_result = ((uint32_t)(dividend / divisor)) + \
|
||||||
|
(((uint64_t)(dividend % divisor)) << 32); \
|
||||||
|
} \
|
||||||
|
const uint64_t sqrt_input = ((uint64_t*)(ptr))[0] + division_result
|
||||||
|
|
||||||
|
#define VARIANT2_INTEGER_MATH(b, ptr) \
|
||||||
|
do if (variant >= 2) \
|
||||||
|
{ \
|
||||||
|
VARIANT2_INTEGER_MATH_DIVISION_STEP(b, ptr); \
|
||||||
|
VARIANT2_INTEGER_MATH_SQRT_STEP_FP64(); \
|
||||||
|
VARIANT2_INTEGER_MATH_SQRT_FIXUP(sqrt_result); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define VARIANT2_2() \
|
||||||
|
do if (variant >= 2) { \
|
||||||
|
((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x10)))[0] ^= hi; \
|
||||||
|
((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x10)))[1] ^= lo; \
|
||||||
|
hi ^= ((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x20)))[0]; \
|
||||||
|
lo ^= ((uint64_t*)(ctx->long_state + ((j * AES_BLOCK_SIZE) ^ 0x20)))[1]; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
union cn_slow_hash_state {
|
||||||
|
union hash_state hs;
|
||||||
|
struct {
|
||||||
|
uint8_t k[64];
|
||||||
|
uint8_t init[INIT_SIZE_BYTE];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
static void do_fast_blake_hash(const void* input, size_t len, char* output) {
|
||||||
|
blake256_hash((uint8_t*)output, input, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_fast_groestl_hash(const void* input, size_t len, char* output) {
|
||||||
|
groestl(input, len * 8, (uint8_t*)output);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void do_fast_jh_hash(const void* input, size_t len, char* output) {
|
||||||
|
int r = jh_hash(HASH_SIZE * 8, input, 8 * len, (uint8_t*)output);
|
||||||
|
assert(SUCCESS == r);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void do_fast_skein_hash(const void* input, size_t len, char* output) {
|
||||||
|
int r = skein_hash(8 * HASH_SIZE, input, 8 * len, (uint8_t*)output);
|
||||||
|
assert(SKEIN_SUCCESS == r);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void (* const extra_hashes[3])(const void *, size_t, char *) = {
|
||||||
|
do_fast_blake_hash, do_fast_groestl_hash, do_fast_skein_hash
|
||||||
|
};
|
||||||
|
|
||||||
|
extern int aesb_single_round(const uint8_t *in, uint8_t*out, const uint8_t *expandedKey);
|
||||||
|
extern int aesb_pseudo_round(const uint8_t *in, uint8_t *out, const uint8_t *expandedKey);
|
||||||
|
|
||||||
|
static inline size_t e2i(const uint8_t* a) {
|
||||||
|
return (*((uint64_t*) a) / AES_BLOCK_SIZE) & (CN_AES_INIT - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mul(const uint8_t* a, const uint8_t* b, uint8_t* res) {
|
||||||
|
((uint64_t*) res)[1] = mul128(((uint64_t*) a)[0], ((uint64_t*) b)[0], (uint64_t*) res);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sum_half_blocks(uint8_t* a, const uint8_t* b) {
|
||||||
|
uint64_t a0, a1, b0, b1;
|
||||||
|
|
||||||
|
a0 = SWAP64LE(((uint64_t*) a)[0]);
|
||||||
|
a1 = SWAP64LE(((uint64_t*) a)[1]);
|
||||||
|
b0 = SWAP64LE(((uint64_t*) b)[0]);
|
||||||
|
b1 = SWAP64LE(((uint64_t*) b)[1]);
|
||||||
|
a0 += b0;
|
||||||
|
a1 += b1;
|
||||||
|
((uint64_t*) a)[0] = SWAP64LE(a0);
|
||||||
|
((uint64_t*) a)[1] = SWAP64LE(a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void copy_block(uint8_t* dst, const uint8_t* src) {
|
||||||
|
((uint64_t*) dst)[0] = ((uint64_t*) src)[0];
|
||||||
|
((uint64_t*) dst)[1] = ((uint64_t*) src)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void swap_blocks(uint8_t* a, uint8_t* b) {
|
||||||
|
size_t i;
|
||||||
|
uint8_t t;
|
||||||
|
for (i = 0; i < AES_BLOCK_SIZE; i++) {
|
||||||
|
t = a[i];
|
||||||
|
a[i] = b[i];
|
||||||
|
b[i] = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void xor_blocks(uint8_t* a, const uint8_t* b) {
|
||||||
|
((uint64_t*) a)[0] ^= ((uint64_t*) b)[0];
|
||||||
|
((uint64_t*) a)[1] ^= ((uint64_t*) b)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void xor_blocks_dst(const uint8_t* a, const uint8_t* b, uint8_t* dst) {
|
||||||
|
((uint64_t*) dst)[0] = ((uint64_t*) a)[0] ^ ((uint64_t*) b)[0];
|
||||||
|
((uint64_t*) dst)[1] = ((uint64_t*) a)[1] ^ ((uint64_t*) b)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
struct cryptonightfast_ctx {
|
||||||
|
uint8_t long_state[MEMORY];
|
||||||
|
union cn_slow_hash_state state;
|
||||||
|
uint8_t text[INIT_SIZE_BYTE];
|
||||||
|
uint8_t a[AES_BLOCK_SIZE];
|
||||||
|
uint8_t b[AES_BLOCK_SIZE * 2];
|
||||||
|
uint8_t c[AES_BLOCK_SIZE];
|
||||||
|
uint8_t aes_key[AES_KEY_SIZE];
|
||||||
|
oaes_ctx* aes_ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
void cryptonightfast_hash(const char* input, char* output, uint32_t len, int variant) {
|
||||||
|
struct cryptonightfast_ctx *ctx = malloc(sizeof(struct cryptonightfast_ctx));
|
||||||
|
hash_process(&ctx->state.hs, (const uint8_t*) input, len);
|
||||||
|
memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE);
|
||||||
|
memcpy(ctx->aes_key, ctx->state.hs.b, AES_KEY_SIZE);
|
||||||
|
ctx->aes_ctx = (oaes_ctx*) oaes_alloc();
|
||||||
|
size_t i, j;
|
||||||
|
|
||||||
|
VARIANT1_INIT();
|
||||||
|
VARIANT2_INIT(ctx->b, ctx->state);
|
||||||
|
|
||||||
|
oaes_key_import_data(ctx->aes_ctx, ctx->aes_key, AES_KEY_SIZE);
|
||||||
|
for (i = 0; i < CN_INIT; i++) {
|
||||||
|
for (j = 0; j < INIT_SIZE_BLK; j++) {
|
||||||
|
aesb_pseudo_round(&ctx->text[AES_BLOCK_SIZE * j],
|
||||||
|
&ctx->text[AES_BLOCK_SIZE * j],
|
||||||
|
ctx->aes_ctx->key->exp_data);
|
||||||
|
}
|
||||||
|
memcpy(&ctx->long_state[i * INIT_SIZE_BYTE], ctx->text, INIT_SIZE_BYTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 16; i++) {
|
||||||
|
ctx->a[i] = ctx->state.k[i] ^ ctx->state.k[32 + i];
|
||||||
|
ctx->b[i] = ctx->state.k[16 + i] ^ ctx->state.k[48 + i];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < ITER_DIV; i++) {
|
||||||
|
/* Dependency chain: address -> read value ------+
|
||||||
|
* written value <-+ hard function (AES or MUL) <+
|
||||||
|
* next address <-+
|
||||||
|
*/
|
||||||
|
/* Iteration 1 */
|
||||||
|
j = e2i(ctx->a);
|
||||||
|
aesb_single_round(&ctx->long_state[j * AES_BLOCK_SIZE], ctx->c, ctx->a);
|
||||||
|
VARIANT2_SHUFFLE_ADD(ctx->long_state, j * AES_BLOCK_SIZE, ctx->a, ctx->b);
|
||||||
|
xor_blocks_dst(ctx->c, ctx->b, &ctx->long_state[j * AES_BLOCK_SIZE]);
|
||||||
|
VARIANT1_1((uint8_t*)&ctx->long_state[j * AES_BLOCK_SIZE]);
|
||||||
|
/* Iteration 2 */
|
||||||
|
j = e2i(ctx->c);
|
||||||
|
|
||||||
|
uint64_t* dst = (uint64_t*)&ctx->long_state[j * AES_BLOCK_SIZE];
|
||||||
|
|
||||||
|
uint64_t t[2];
|
||||||
|
t[0] = dst[0];
|
||||||
|
t[1] = dst[1];
|
||||||
|
|
||||||
|
VARIANT2_INTEGER_MATH(t, ctx->c);
|
||||||
|
|
||||||
|
uint64_t hi;
|
||||||
|
uint64_t lo = mul128(((uint64_t*)ctx->c)[0], t[0], &hi);
|
||||||
|
|
||||||
|
VARIANT2_2();
|
||||||
|
VARIANT2_SHUFFLE_ADD(ctx->long_state, j * AES_BLOCK_SIZE, ctx->a, ctx->b);
|
||||||
|
|
||||||
|
((uint64_t*)ctx->a)[0] += hi;
|
||||||
|
((uint64_t*)ctx->a)[1] += lo;
|
||||||
|
|
||||||
|
dst[0] = ((uint64_t*)ctx->a)[0];
|
||||||
|
dst[1] = ((uint64_t*)ctx->a)[1];
|
||||||
|
|
||||||
|
((uint64_t*)ctx->a)[0] ^= t[0];
|
||||||
|
((uint64_t*)ctx->a)[1] ^= t[1];
|
||||||
|
|
||||||
|
VARIANT1_2((uint8_t*)&ctx->long_state[j * AES_BLOCK_SIZE]);
|
||||||
|
copy_block(ctx->b + AES_BLOCK_SIZE, ctx->b);
|
||||||
|
copy_block(ctx->b, ctx->c);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE);
|
||||||
|
oaes_key_import_data(ctx->aes_ctx, &ctx->state.hs.b[32], AES_KEY_SIZE);
|
||||||
|
for (i = 0; i < CN_INIT; i++) {
|
||||||
|
for (j = 0; j < INIT_SIZE_BLK; j++) {
|
||||||
|
xor_blocks(&ctx->text[j * AES_BLOCK_SIZE],
|
||||||
|
&ctx->long_state[i * INIT_SIZE_BYTE + j * AES_BLOCK_SIZE]);
|
||||||
|
aesb_pseudo_round(&ctx->text[j * AES_BLOCK_SIZE],
|
||||||
|
&ctx->text[j * AES_BLOCK_SIZE],
|
||||||
|
ctx->aes_ctx->key->exp_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memcpy(ctx->state.init, ctx->text, INIT_SIZE_BYTE);
|
||||||
|
hash_permutation(&ctx->state.hs);
|
||||||
|
/*memcpy(hash, &state, 32);*/
|
||||||
|
extra_hashes[ctx->state.hs.b[0] & 2](&ctx->state, 200, output);
|
||||||
|
oaes_free((OAES_CTX **) &ctx->aes_ctx);
|
||||||
|
free(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cryptonightfast_fast_hash(const char* input, char* output, uint32_t len) {
|
||||||
|
union hash_state state;
|
||||||
|
hash_process(&state, (const uint8_t*) input, len);
|
||||||
|
memcpy(output, &state, HASH_SIZE);
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user