Repository: Diablo-D3/DiabloMiner Branch: master Commit: 822e17e60d43 Files: 20 Total size: 158.8 KB Directory structure: gitextract_40fsf7gu/ ├── .gitignore ├── DiabloMiner-Linux.sh ├── DiabloMiner-OSX.sh ├── DiabloMiner-Solaris.sh ├── DiabloMiner-Windows.l4j.ini ├── LICENSE ├── README.md ├── launch4j.xml ├── pom.xml └── src/ └── main/ ├── java/ │ └── com/ │ └── diablominer/ │ └── DiabloMiner/ │ ├── DeviceState/ │ │ ├── DeviceState.java │ │ ├── GPUDeviceState.java │ │ ├── GPUHardwareType.java │ │ ├── HardwareType.java │ │ └── PlatformVersion.java │ ├── DiabloMiner.java │ ├── DiabloMinerFatalException.java │ └── NetworkState/ │ ├── JSONRPCNetworkState.java │ ├── NetworkState.java │ └── WorkState.java └── resources/ └── DiabloMiner.cl ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ *.*swp .classpath .project .settings/* contrib/lwjgl-*.pom contrib/lwjgl-*.zip contrib/lwjgl/* target/* launch4j/* *exe start ================================================ FILE: DiabloMiner-Linux.sh ================================================ #!/bin/sh export GPU_USE_SYNC_OBJECTS=1 export DISPLAY=`echo $DISPLAY | sed 's/\.[0-9]//'` export COMPUTE=$DISPLAY cd $(dirname ${0}) exec java -Xmx32m -cp target/libs/*:target/DiabloMiner.jar -Djava.library.path=target/libs/natives com.diablominer.DiabloMiner.DiabloMiner $@ ================================================ FILE: DiabloMiner-OSX.sh ================================================ #!/bin/sh export GPU_USE_SYNC_OBJECTS=1 cd $(dirname ${0}) exec java -Xmx32m -cp target/libs/*:target/DiabloMiner.jar -Djava.awt.headless=true -Djava.library.path=target/libs/natives com.diablominer.DiabloMiner.DiabloMiner $@ ================================================ FILE: DiabloMiner-Solaris.sh ================================================ #!/bin/sh export GPU_USE_SYNC_OBJECTS=1 export DISPLAY=`echo $DISPLAY | sed 's/\.[0-9]//'` export COMPUTE=$DISPLAY cd $(dirname ${0}) exec java -Xmx32m -cp target/libs/*:target/DiabloMiner.jar -Djava.library.path=target/libs/natives com.diablominer.DiabloMiner.DiabloMiner $@ ================================================ FILE: DiabloMiner-Windows.l4j.ini ================================================ #lauch4j runtime config -Xmx32m -Djava.library.path=target\libs\natives ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: README.md ================================================ # This program is unmaintained and does not support the current miner protocol. Use cgminer instead. Do not create issues about this program being broken because it will not be fixed by the original developers. If you want to fix it, you're welcome to fork it. # DiabloMiner - OpenCL miner for BitCoin # Copyright (C) 2010 - 2013 Patrick McFarland 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 . # Donations # Bitcoins and Devcoins: __1DbeWKCxnVCt3sRaSAmZLoboqr8pVyFzP1__ # Warning # DiabloMiner is a command line program. This means you need to open a terminal (cmd.exe, Terminal.app/iTerm2, xterm, etc) and run the program with the proper arguments from there. You __require__ hardware that is capable of running OpenCL. # MacOSX Warning # Apple's OpenCL drivers often exhibit strange bugs. If DiabloMiner is displaying warnings about `CL_INVALID_WORK_GROUP_SIZE`, add `-w 64` to your arguments. # How to download # __[Binary download here](http://adterrasperaspera.com/DiabloMiner.zip)__ This download is always kept up to date with the newest version of the source. # How to build # DiabloMiner requires the SDK for Java 6.0 or higher installed, as well as Maven 3.x. Maven will download the rest of the dependencies. DiabloMiner uses launch4j to build Windows binaries. launch4j requires and partially includes a build chain for Win32. launch4j cannot be ran on any 64-bit only version of OSX (10.6 and up) and is difficult to run on Windows. DiabloMiner's git repo does not contain binaries, so if you want to build DiabloMiner from source, heed the above warning and run `mvn package`. # How to use # # Single pool and solo mining # `./DiabloMiner-YourOS.sh -u username -p password -o host -r port` or `./DiabloMiner-YourOS.sh -l http://username:password@host:port` For solo mining, your host is `localhost` your port is `8332`, and your username and password is what you set in your bitcoind's `bitcoin.conf`. See bitcoin documentation for further information on how to enable the RPC API. ## Multiple pools ## `./DiabloMiner-YourOS.sh -u username1,username2 -p password1,password2 -o host1,host2 -r port1,port2` DiabloMiner supports unlimited pools and will switch to the next pool on connection failure and return to the first pool every 60 minutes. # Optimization # ## MacOSX on any hardware ## It is recommended you use the default settings, see also the MacOSX warning above. ## Nvidia hardware on any OS ## It is recommended you use the default settings, however if your desktop is lagging badly try adding `-f 120`, `-f 180`, or `-f 240`. ## Intel hardware on any OS ## DiabloMiner has not been tested on Intel GPUs. Default is most likely correct. ## AMD Radeon VLIW4 ## R7xx * Radeon discrete: 43xx, 45xx, 46xx, 47xx, 48xx * Radeon mobile: 43xxM, 45xxM, 46xxM, 48xxM, 5xxV, 51xxM * FirePro: V3750, V7750, V8700, V8750, 2450, RG220 * FirePro mobile: M7740 * FireStream: 9250, 9270 `-v 2` ## AMD Radeon VLIW5 ## Cedar, Redwood, Juniper, Cypress, Hemlock * Radeon discrete: 54xx, 55xx, 56xx, 57xx, 58xx, 59xx, 63xx, 6750, 6770, 73xx * Radeon mobile: 54xxM, 56xxM, 57xxM, 58xxM, 63xxM, 65xxM, 68xxM, * FirePro: V3800, V4800, V5800, V7800, V8800, V9800, 2270, 2460 * FirePro mobile: M5800, M7820 * FireStream: 9350, 9370 On some cards `-v 2,1` is faster, on others `-v 2`. Try both. ## AMD Radeon VLIW5 Gen2 ## Caicos, Turks, Barts, Wrestler, Ontario, Zacate, WinterPark, BeaverCreek * Radeon discrete: 64xx, 65xx, 66xx, 6790, 68xx, 74xx, 75xx, 76xx * Radeon mobile: 64xxM, 66xxM, 67xxM, 69xxM, 74xxM, 75xxM, 76xxM * Radeon mobile IGP: 63xxG, 64xxG, 65xxG, 66xxG * Fusion APU: 62xx, 63xx, 64xxD, 65xxD, 74xxD, 75xxD, 76xxD * FirePro: V3900, V4900 * FirePro mobile: M5950, M8900, M2000 Use `-v 2` ## AMD Radeon VLIW4 Cayman, Antilles, Devastator * Radeon discrete: 69xx * Radeon mobile: 64xxM, 66xxM, 67xxM * Fusion APU: 74xxD * FirePro: V5900, V7900 Use `-v 2` ## AMD Radeon GCN Cape Verde, Pitcairn, Tahiti, New Zealand, Malta, Bonaire * Radeon discrete: 77xx, 78xx, 79xx * Radeon mobile: 77xxM, 78xxM, 79xxM * FirePro: W600, W5000, W7000, W8000, W9000, S7000, S9000, S10000, R5000 * FirePro mobile: M4000, M6000 * Sky: 500, 700, 900 Use defaults. # Command line arguments # * __-u, -p, -o, -r__ Username, password, host, port * __-l__ Fully fledged URL, ex: http://username:password@host:port/ * __-x__ Proxy, ex: host:port<:username:password> * __-d__ Debug output * __-D__ Use specific devices. Default is all. * __-f__ FPS, controls how many kernel executions a second happen, default is 30 * __-w__ Controls OpenCL workgroup size, default is hardware detected maximum * __-v__: Change manual SIMD parallel alignment. * -v 1: The same as off/single hash, and is the default (`uint`) * -v 2 through 16: Tries more than one hash via SIMD (`uint2` through `uint16`) * -v 1,1, etc: Non-SIMD interleaving on top of SIMD, faster on a very small minority of hardware (`-v 2,1` is faster than `-v 2` on some Radeon VLIW5) ================================================ FILE: launch4j.xml ================================================ console DiabloMiner-Windows.exe target/DiabloMiner.jar DiabloMiner %EXECDIR% com.diablominer.DiabloMiner.DiabloMiner %EXEDIR%\target\libs\* 1.6.0 true ================================================ FILE: pom.xml ================================================ 4.0.0 com.diablominer DiabloMiner 0.0.1-SNAPSHOT UTF-8 2.8.5 3.0.2 3.1.0-beta1 macosx-x86-10.8 ${basedir}/launch4j/launch4j sonatype-public-repository https://oss.sonatype.org/content/groups/public true true org.lwjgl.lwjgl lwjgl ${lwjgl.version} org.lwjgl.lwjgl lwjgl_util ${lwjgl.version} org.codehaus.jackson jackson-mapper-asl 1.9.11 commons-codec commons-codec 1.7 commons-cli commons-cli 1.2 exist-launch4j launch4j/ org.codehaus.mojo wagon-maven-plugin 1.0-beta-4 download-launch4j generate-resources download-single http://downloads.sourceforge.net launch4j/launch4j-3/${launch4j.version}/launch4j-${launch4j.version}-${launch4j.os}.${launch4j.ext} ${basedir}/launch4j download-launch4j-on-osx-10.8 generate-resources download-single http://downloads.sourceforge.net project/launch4j/launch4j-3/${launch4j.x86-64.version}/launch4j-${launch4j.x86-64.version}-${launch4j.x86-64.os}.${launch4j.ext} ${basedir}/launch4j unpack-launch4j-windows Windows win32 zip org.apache.maven.plugins maven-antrun-plugin 1.7 unpack-on-windows process-resources run unpack-launch4j-linux-and-osx !Windows tgz org.apache.maven.plugins maven-antrun-plugin 1.7 unpack-on-unix process-resources run unpack-launch4j-linux Linux linux unpack-launch4j-osx Mac OS X macosx unpack-launch4j-osx-10.8 Mac OS X x86_64 org.apache.maven.plugins maven-antrun-plugin 1.7 unpack-on-osx-10.8 process-resources run org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 com.googlecode.mavennatives maven-nativedependencies-plugin 0.0.7 unpack-natives generate-resources copy ${project.build.directory}/libs/natives org.apache.maven.plugins maven-dependency-plugin copy-dependencies process-resources copy-dependencies ${project.build.directory}/libs false true true org.apache.maven.plugins maven-jar-plugin 2.4 default-jar prepare-package DiabloMiner jar org.apache.maven.plugins maven-antrun-plugin run-launch4j package run ================================================ FILE: src/main/java/com/diablominer/DiabloMiner/DeviceState/DeviceState.java ================================================ /* * DiabloMiner - OpenCL miner for Bitcoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * 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 . */ package com.diablominer.DiabloMiner.DeviceState; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.atomic.AtomicLong; import com.diablominer.DiabloMiner.DiabloMiner; import com.diablominer.DiabloMiner.DiabloMinerFatalException; import com.diablominer.DiabloMiner.NetworkState.WorkState; abstract public class DeviceState { String deviceName; DiabloMiner diabloMiner; double basis; AtomicLong deviceHashCount = new AtomicLong(0); long resetNetworkState; abstract public void checkDevice(); public double getBasis() { return basis; } public long getDeviceHashCount() { return deviceHashCount.get(); } abstract public class ExecutionState implements Runnable { String executionName; WorkState workState; LinkedBlockingDeque incomingQueue = new LinkedBlockingDeque(); public ExecutionState(String executionName) throws DiabloMinerFatalException { this.executionName = executionName; this.workState = null; } public void addIncomingQueue(WorkState workState) { incomingQueue.add(workState); } abstract public void run(); public String getExecutionName() { return executionName; } } } ================================================ FILE: src/main/java/com/diablominer/DiabloMiner/DeviceState/GPUDeviceState.java ================================================ /* * DiabloMiner - OpenCL miner for Bitcoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * 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 . */ package com.diablominer.DiabloMiner.DeviceState; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicLong; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLUtil; import org.lwjgl.PointerBuffer; import org.lwjgl.opencl.CL10; import org.lwjgl.opencl.CL12; import org.lwjgl.opencl.CLCommandQueue; import org.lwjgl.opencl.CLContext; import org.lwjgl.opencl.CLContextCallback; import org.lwjgl.opencl.CLDevice; import org.lwjgl.opencl.CLKernel; import org.lwjgl.opencl.CLMem; import org.lwjgl.opencl.CLPlatform; import org.lwjgl.opencl.CLProgram; import com.diablominer.DiabloMiner.DiabloMiner; import com.diablominer.DiabloMiner.DiabloMinerFatalException; import com.diablominer.DiabloMiner.NetworkState.WorkState; public class GPUDeviceState extends DeviceState { final static int OUTPUTS = 16; final PlatformVersion platform_version; final CLDevice device; final CLContext context; final CLKernel kernel; AtomicLong workSize = new AtomicLong(0); long workSizeBase; boolean hwcheck; final PointerBuffer localWorkSize = BufferUtils.createPointerBuffer(1); final ExecutionState executions[]; AtomicLong runs = new AtomicLong(0); long lastRuns = 0; long startTime = 0; long lastTime = 0; GPUHardwareType hardwareType; GPUDeviceState(GPUHardwareType hardwareType, String deviceName, CLPlatform platform, PlatformVersion platform_version, CLDevice device) throws DiabloMinerFatalException { this.platform_version = platform_version; this.hardwareType = hardwareType; this.diabloMiner = hardwareType.getDiabloMiner(); this.deviceName = deviceName; this.resetNetworkState = DiabloMiner.now(); this.executions = new ExecutionState[GPUHardwareType.EXECUTION_TOTAL]; boolean hasBitAlign; boolean hasBFI_INT = false; CLProgram program; this.device = device; PointerBuffer properties = BufferUtils.createPointerBuffer(3); properties.put(CL10.CL_CONTEXT_PLATFORM).put(platform.getPointer()).put(0).flip(); int err = 0; int deviceCU = device.getInfoInt(CL10.CL_DEVICE_MAX_COMPUTE_UNITS); long deviceWorkSize; int forceWorkSize = diabloMiner.getGPUForceWorkSize(); if(forceWorkSize > 0) deviceWorkSize = forceWorkSize; else if(LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_MACOSX) deviceWorkSize = device.getInfoSize(CL10.CL_DEVICE_MAX_WORK_GROUP_SIZE); else deviceWorkSize = 64; context = CL10.clCreateContext(properties, device, new CLContextCallback() { protected void handleMessage(String errinfo, ByteBuffer private_info) { diabloMiner.error(errinfo); } }, null); ByteBuffer extb = BufferUtils.createByteBuffer(1024); CL10.clGetDeviceInfo(device, CL10.CL_DEVICE_EXTENSIONS, extb, null); byte[] exta = new byte[1024]; extb.get(exta); if(new String(exta).contains("cl_amd_media_ops")) hasBitAlign = true; else hasBitAlign = false; if(hasBitAlign) { if(deviceName.contains("Cedar") || deviceName.contains("Redwood") || deviceName.contains("Juniper") || deviceName.contains("Cypress") || deviceName.contains("Hemlock") || deviceName.contains("Caicos") || deviceName.contains("Turks") || deviceName.contains("Barts") || deviceName.contains("Cayman") || deviceName.contains("Antilles") || deviceName.contains("Palm") || deviceName.contains("Sumo") || deviceName.contains("Wrestler") || deviceName.contains("WinterPark") || deviceName.contains("BeaverCreek")) hasBFI_INT = true; } // String compileOptions = // "-save-temps="+(device.getInfoString(CL10.CL_DEVICE_NAME).trim()); String compileOptions = ""; compileOptions += " -D WORKSIZE=" + deviceWorkSize; if(hasBitAlign) compileOptions += " -D BITALIGN"; if(hasBFI_INT) compileOptions += " -D BFIINT"; program = CL10.clCreateProgramWithSource(context, hardwareType.getSource(), null); err = CL10.clBuildProgram(program, device, compileOptions, null); if(err != CL10.CL_SUCCESS) { ByteBuffer logBuffer = BufferUtils.createByteBuffer(1024); byte[] log = new byte[1024]; CL10.clGetProgramBuildInfo(program, device, CL10.CL_PROGRAM_BUILD_LOG, logBuffer, null); logBuffer.get(log); System.out.println(new String(log)); throw new DiabloMinerFatalException(diabloMiner, "Failed to build program on " + deviceName); } if(hasBFI_INT) { diabloMiner.info("BFI_INT patching enabled, disabling hardware check errors"); hwcheck = false; int binarySize = (int) program.getInfoSizeArray(CL10.CL_PROGRAM_BINARY_SIZES)[0]; ByteBuffer binary = BufferUtils.createByteBuffer(binarySize); program.getInfoBinaries(binary); for(int pos = 0; pos < binarySize - 4; pos++) { if((long) (0xFFFFFFFF & binary.getInt(pos)) == 0x464C457FL && (long) (0xFFFFFFFF & binary.getInt(pos + 4)) == 0x64010101L) { boolean firstText = true; int offset = binary.getInt(pos + 32); short entrySize = binary.getShort(pos + 46); short entryCount = binary.getShort(pos + 48); short index = binary.getShort(pos + 50); int header = pos + offset; int nameTableOffset = binary.getInt(header + index * entrySize + 16); int size = binary.getInt(header + index * entrySize + 20); int entry = header; for(int section = 0; section < entryCount; section++) { int nameIndex = binary.getInt(entry); offset = binary.getInt(entry + 16); size = binary.getInt(entry + 20); int name = pos + nameTableOffset + nameIndex; if((long) (0xFFFFFFFF & binary.getInt(name)) == 0x7865742E) { if(firstText) { firstText = false; } else { int sectionStart = pos + offset; for(int i = 0; i < size / 8; i++) { long instruction1 = (long) (0xFFFFFFFF & binary.getInt(sectionStart + i * 8)); long instruction2 = (long) (0xFFFFFFFF & binary.getInt(sectionStart + i * 8 + 4)); if((instruction1 & 0x02001000L) == 0x00000000L && (instruction2 & 0x9003F000L) == 0x0001A000L) { instruction2 ^= (0x0001A000L ^ 0x0000C000L); binary.putInt(sectionStart + i * 8 + 4, (int) instruction2); } } } } entry += entrySize; } break; } } IntBuffer binaryErr = BufferUtils.createIntBuffer(1); CL10.clReleaseProgram(program); program = CL10.clCreateProgramWithBinary(context, device, binary, binaryErr, null); err = CL10.clBuildProgram(program, device, compileOptions, null); if(err != CL10.CL_SUCCESS) { throw new DiabloMinerFatalException(diabloMiner, "Failed to BFI_INT patch kernel on " + deviceName); } } kernel = CL10.clCreateKernel(program, "search", null); if(kernel == null) { throw new DiabloMinerFatalException(diabloMiner, "Failed to create kernel on " + deviceName); } if(forceWorkSize == 0) { ByteBuffer rkwgs = BufferUtils.createByteBuffer(8); err = CL10.clGetKernelWorkGroupInfo(kernel, device, CL10.CL_KERNEL_WORK_GROUP_SIZE, rkwgs, null); localWorkSize.put(0, rkwgs.getLong(0)); if(!(err == CL10.CL_SUCCESS) || localWorkSize.get(0) == 0) localWorkSize.put(0, deviceWorkSize); } else { localWorkSize.put(0, forceWorkSize); } diabloMiner.info("Added " + deviceName + " (" + deviceCU + " CU, local work size of " + localWorkSize.get(0) + ")"); workSizeBase = 64 * 512; workSize.set(workSizeBase * 16); for(int i = 0; i < GPUHardwareType.EXECUTION_TOTAL; i++) { String executorName = deviceName + "/" + i; executions[i] = this.new GPUExecutionState(executorName); Thread thread = new Thread(executions[i], "DiabloMiner Executor (" + executorName + ")"); thread.start(); diabloMiner.addThread(thread); } } public void checkDevice() { long now = DiabloMiner.now(); long elapsed = now - lastTime; long currentRuns = runs.get(); double targetFPSBasis = hardwareType.getTargetFPSBasis(); int totalVectors = hardwareType.getTotalVectors(); long ws = workSize.get(); if(now > startTime + DiabloMiner.TIME_OFFSET * 2 && currentRuns > lastRuns + diabloMiner.getGPUTargetFPS()) { basis = (double) elapsed / (double) (currentRuns - lastRuns); if(basis < targetFPSBasis / 4) ws += workSizeBase * 16; else if(basis < targetFPSBasis / 2) ws += workSizeBase * 4; else if(basis < targetFPSBasis) ws += workSizeBase; else if(basis > targetFPSBasis * 4) ws -= workSizeBase * 16; else if(basis > targetFPSBasis * 2) ws -= workSizeBase * 4; else if(basis > targetFPSBasis) ws -= workSizeBase; if(ws < workSizeBase) ws = workSizeBase; else if(ws > DiabloMiner.TWO32 / totalVectors - 1) ws = DiabloMiner.TWO32 / totalVectors - 1; lastRuns = currentRuns; lastTime = now; workSize.set(ws); } } public class GPUExecutionState extends ExecutionState { final CLCommandQueue queue; final CLMem output[] = new CLMem[2]; final CLMem blank; ByteBuffer outputBuffer; int outputIndex = 0; final PointerBuffer workBaseBuffer = BufferUtils.createPointerBuffer(1); final PointerBuffer workSizeBuffer = BufferUtils.createPointerBuffer(1); final IntBuffer errBuffer = BufferUtils.createIntBuffer(1); int err; WorkState workState; boolean requestedNewWork; final int[] midstate2 = new int[16]; final MessageDigest digestInside; final MessageDigest digestOutside; final ByteBuffer digestInput = ByteBuffer.allocate(80); byte[] digestOutput; public GPUExecutionState(String executionName) throws DiabloMinerFatalException { super(executionName); try { digestInside = MessageDigest.getInstance("SHA-256"); digestOutside = MessageDigest.getInstance("SHA-256"); } catch(NoSuchAlgorithmException e) { throw new DiabloMinerFatalException(diabloMiner, "Your Java implementation does not have a MessageDigest for SHA-256"); } queue = CL10.clCreateCommandQueue(context, device, 0, errBuffer); if(queue == null || errBuffer.get(0) != CL10.CL_SUCCESS) { throw new DiabloMinerFatalException(diabloMiner, "Failed to allocate queue"); } IntBuffer blankinit = BufferUtils.createIntBuffer(OUTPUTS * 4); for(int i = 0; i < OUTPUTS; i++) blankinit.put(0); blankinit.rewind(); if(platform_version == PlatformVersion.V1_1) blank = CL10.clCreateBuffer(context, CL10.CL_MEM_COPY_HOST_PTR | CL10.CL_MEM_READ_ONLY, blankinit, errBuffer); else blank = CL10.clCreateBuffer(context, CL10.CL_MEM_COPY_HOST_PTR | CL10.CL_MEM_READ_ONLY | CL12.CL_MEM_HOST_NO_ACCESS, blankinit, errBuffer); if(blank == null || errBuffer.get(0) != CL10.CL_SUCCESS) throw new DiabloMinerFatalException(diabloMiner, "Failed to allocate blank buffer"); blankinit.rewind(); for(int i = 0; i < 2; i++) { if(platform_version == PlatformVersion.V1_1) output[i] = CL10.clCreateBuffer(context, CL10.CL_MEM_COPY_HOST_PTR | CL10.CL_MEM_WRITE_ONLY, blankinit, errBuffer); else output[i] = CL10.clCreateBuffer(context, CL10.CL_MEM_COPY_HOST_PTR | CL10.CL_MEM_WRITE_ONLY | CL12.CL_MEM_HOST_READ_ONLY, blankinit, errBuffer); blankinit.rewind(); if(output[i] == null || errBuffer.get(0) != CL10.CL_SUCCESS) { throw new DiabloMinerFatalException(diabloMiner, "Failed to allocate output buffer"); } } outputBuffer = CL10.clEnqueueMapBuffer(queue, output[outputIndex], 1, CL10.CL_MAP_READ, 0, OUTPUTS * 4, null, null, null); diabloMiner.getNetworkStateHead().addGetQueue(this); requestedNewWork = true; } public void run() { boolean submittedBlock; boolean resetBuffer; boolean hwError; boolean skipProcessing; boolean skipUnmap = false; while(diabloMiner.getRunning()) { submittedBlock = false; resetBuffer = false; hwError = false; skipProcessing = false; WorkState workIncoming = null; if(requestedNewWork) { try { workIncoming = incomingQueue.take(); } catch(InterruptedException f) { continue; } } else { workIncoming = incomingQueue.poll(); } if(workIncoming != null) { workState = workIncoming; requestedNewWork = false; resetBuffer = true; skipProcessing = true; } if(!skipProcessing | !skipUnmap) { for(int z = 0; z < OUTPUTS; z++) { int nonce = outputBuffer.getInt(z * 4); if(nonce != 0) { for(int j = 0; j < 19; j++) digestInput.putInt(j * 4, workState.getData(j)); digestInput.putInt(19 * 4, nonce); digestOutput = digestOutside.digest(digestInside.digest(digestInput.array())); long G = ((long) (0xFF & digestOutput[27]) << 24) | ((long) (0xFF & digestOutput[26]) << 16) | ((long) (0xFF & digestOutput[25]) << 8) | ((long) (0xFF & digestOutput[24])); long H = ((long) (0xFF & digestOutput[31]) << 24) | ((long) (0xFF & digestOutput[30]) << 16) | ((long) (0xFF & digestOutput[29]) << 8) | ((long) (0xFF & digestOutput[28])); if(H == 0) { diabloMiner.debug("Attempt " + diabloMiner.incrementAttempts() + " from " + executionName); if(workState.getTarget(7) != 0 || G <= workState.getTarget(6)) { workState.submitNonce(nonce); submittedBlock = true; } } else { hwError = true; } resetBuffer = true; } } if(hwError && submittedBlock == false) { if(hwcheck && !diabloMiner.getDebug()) diabloMiner.error("Invalid solution " + diabloMiner.incrementHWErrors() + " from " + deviceName + ", possible driver or hardware issue"); else diabloMiner.debug("Invalid solution " + diabloMiner.incrementHWErrors() + " from " + executionName + ", possible driver or hardware issue"); } } if(resetBuffer) CL10.clEnqueueCopyBuffer(queue, blank, output[outputIndex], 0, 0, OUTPUTS * 4, null, null); if(!skipUnmap) { CL10.clEnqueueUnmapMemObject(queue, output[outputIndex], outputBuffer, null, null); outputIndex = (outputIndex == 0) ? 1 : 0; } long workBase = workState.getBase(); long increment = workSize.get(); if(DiabloMiner.now() - 3600000 > resetNetworkState) { resetNetworkState = DiabloMiner.now(); diabloMiner.getNetworkStateHead().addGetQueue(this); requestedNewWork = skipUnmap = true; } else { requestedNewWork = skipUnmap = workState.update(increment); } if(!requestedNewWork) { diabloMiner.addAndGetHashCount(increment); deviceHashCount.addAndGet(increment); runs.incrementAndGet(); workSizeBuffer.put(0, increment); workBaseBuffer.put(0, workBase); System.arraycopy(workState.getMidstate(), 0, midstate2, 0, 8); DiabloMiner.sharound(midstate2, 0, 1, 2, 3, 4, 5, 6, 7, workState.getData(16), 0x428A2F98); DiabloMiner.sharound(midstate2, 7, 0, 1, 2, 3, 4, 5, 6, workState.getData(17), 0x71374491); DiabloMiner.sharound(midstate2, 6, 7, 0, 1, 2, 3, 4, 5, workState.getData(18), 0xB5C0FBCF); int W16 = workState.getData(16) + (DiabloMiner.rot(workState.getData(17), 7) ^ DiabloMiner.rot(workState.getData(17), 18) ^ (workState.getData(17) >>> 3)); int W17 = workState.getData(17) + (DiabloMiner.rot(workState.getData(18), 7) ^ DiabloMiner.rot(workState.getData(18), 18) ^ (workState.getData(18) >>> 3)) + 0x01100000; int W18 = workState.getData(18) + (DiabloMiner.rot(W16, 17) ^ DiabloMiner.rot(W16, 19) ^ (W16 >>> 10)); int W19 = 0x11002000 + (DiabloMiner.rot(W17, 17) ^ DiabloMiner.rot(W17, 19) ^ (W17 >>> 10)); int W31 = 0x00000280 + (DiabloMiner.rot(W16, 7) ^ DiabloMiner.rot(W16, 18) ^ (W16 >>> 3)); int W32 = W16 + (DiabloMiner.rot(W17, 7) ^ DiabloMiner.rot(W17, 18) ^ (W17 >>> 3)); int PreVal4 = workState.getMidstate(4) + (DiabloMiner.rot(midstate2[1], 6) ^ DiabloMiner.rot(midstate2[1], 11) ^ DiabloMiner.rot(midstate2[1], 25)) + (midstate2[3] ^ (midstate2[1] & (midstate2[2] ^ midstate2[3]))) + 0xe9b5dba5; int T1 = (DiabloMiner.rot(midstate2[5], 2) ^ DiabloMiner.rot(midstate2[5], 13) ^ DiabloMiner.rot(midstate2[5], 22)) + ((midstate2[5] & midstate2[6]) | (midstate2[7] & (midstate2[5] | midstate2[6]))); int PreVal4_state0 = PreVal4 + workState.getMidstate(0); int PreVal4_state0_k7 = (int) (PreVal4_state0 + 0xAB1C5ED5L); int PreVal4_T1 = PreVal4 + T1; int B1_plus_K6 = (int) (midstate2[1] + 0x923f82a4L); int C1_plus_K5 = (int) (midstate2[2] + 0x59f111f1L); int W16_plus_K16 = (int) (W16 + 0xe49b69c1L); int W17_plus_K17 = (int) (W17 + 0xefbe4786L); kernel.setArg(0, PreVal4_state0).setArg(1, PreVal4_state0_k7).setArg(2, PreVal4_T1).setArg(3, W18).setArg(4, W19).setArg(5, W16).setArg(6, W17).setArg(7, W16_plus_K16).setArg(8, W17_plus_K17).setArg(9, W31).setArg(10, W32).setArg(11, (int) (midstate2[3] + 0xB956c25bL)).setArg(12, midstate2[1]).setArg(13, midstate2[2]).setArg(14, midstate2[7]).setArg(15, midstate2[5]).setArg(16, midstate2[6]).setArg(17, C1_plus_K5).setArg(18, B1_plus_K6).setArg(19, workState.getMidstate(0)).setArg(20, workState.getMidstate(1)).setArg(21, workState.getMidstate(2)).setArg(22, workState.getMidstate(3)).setArg(23, workState.getMidstate(4)).setArg(24, workState.getMidstate(5)).setArg(25, workState.getMidstate(6)).setArg(26, workState.getMidstate(7)).setArg(27, output[outputIndex]); err = CL10.clEnqueueNDRangeKernel(queue, kernel, 1, workBaseBuffer, workSizeBuffer, localWorkSize, null, null); if(err != CL10.CL_SUCCESS && err != CL10.CL_INVALID_KERNEL_ARGS && err != CL10.CL_INVALID_GLOBAL_OFFSET) { try { throw new DiabloMinerFatalException(diabloMiner, "Failed to queue kernel, error " + err); } catch(DiabloMinerFatalException e) { } } else { if(err == CL10.CL_INVALID_KERNEL_ARGS) { diabloMiner.debug("Spurious CL_INVALID_KERNEL_ARGS error, ignoring"); skipUnmap = true; } else if(err == CL10.CL_INVALID_GLOBAL_OFFSET) { diabloMiner.error("Spurious CL_INVALID_GLOBAL_OFFSET error, offset: " + workBase + ", work size: " + increment); skipUnmap = true; } else { outputBuffer = CL10.clEnqueueMapBuffer(queue, output[outputIndex], 1, CL10.CL_MAP_READ, 0, OUTPUTS * 4, null, null, null); } } } } } } } ================================================ FILE: src/main/java/com/diablominer/DiabloMiner/DeviceState/GPUHardwareType.java ================================================ package com.diablominer.DiabloMiner.DeviceState; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Set; import org.lwjgl.opencl.CL; import org.lwjgl.opencl.CL10; import org.lwjgl.opencl.CLDevice; import org.lwjgl.opencl.CLPlatform; import com.diablominer.DiabloMiner.DiabloMiner; import com.diablominer.DiabloMiner.DiabloMinerFatalException; public class GPUHardwareType extends HardwareType { final static int EXECUTION_TOTAL = 2; final static String UPPER[] = { "X", "Y", "Z", "W", "T", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "k" }; final static String LOWER[] = { "x", "y", "z", "w", "t", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k" }; String source; double targetFPSBasis; int totalVectors; List deviceStates = new ArrayList(); public GPUHardwareType(DiabloMiner diabloMiner) throws DiabloMinerFatalException { super(diabloMiner); try { InputStream stream = DiabloMiner.class.getResourceAsStream("/DiabloMiner.cl"); byte[] data = new byte[64 * 1024]; int pos = 0; while(pos < data.length) { int ret = stream.read(data, pos, data.length - pos); if(ret < 1) break; else pos += ret; } if(pos == 0) throw new DiabloMinerFatalException(diabloMiner, "Unable to read DiabloMiner.cl"); source = new String(data).trim(); stream.close(); } catch(IOException e) { throw new DiabloMinerFatalException(diabloMiner, "Unable to read DiabloMiner.cl"); } String sourceLines[] = source.split("\n"); source = ""; long vectorBase = 0; Integer[] vectors = diabloMiner.getGPUVectors(); totalVectors = 0; int totalVectorsPOT; for(Integer vector : vectors) { totalVectors += vector; } if(totalVectors > 16) throw new DiabloMinerFatalException(diabloMiner, "DiabloMiner does not support more than 16 total vectors yet"); int powtwo = 1 << (32 - Integer.numberOfLeadingZeros(totalVectors) - 1); if(totalVectors != powtwo) totalVectorsPOT = 1 << (32 - Integer.numberOfLeadingZeros(totalVectors)); else totalVectorsPOT = totalVectors; for(int x = 0; x < sourceLines.length; x++) { String sourceLine = sourceLines[x]; if(diabloMiner.getGPUNoArray() && !sourceLine.contains("z ZA")) { sourceLine = sourceLine.replaceAll("ZA\\[([0-9]+)\\]", "ZA$1"); } if(sourceLine.contains("zz")) { if(totalVectors > 1) sourceLine = sourceLine.replaceAll("zz", String.valueOf(totalVectorsPOT)); else sourceLine = sourceLine.replaceAll("zz", ""); } if(sourceLine.contains("= (io) ? Znonce")) { int count = 0; String change = "(uintzz)("; for(int z = 0; z < vectors.length; z++) { change += UPPER[z] + "nonce"; count += vectors[z]; if(z != vectors.length - 1) change += ", "; } for(int z = count; z < totalVectorsPOT; z++) change += ", 0"; change += ")"; sourceLine = sourceLine.replace("Znonce", change); if(totalVectors > 1) sourceLine = sourceLine.replaceAll("zz", String.valueOf(totalVectorsPOT)); else sourceLine = sourceLine.replaceAll("zz", ""); source += sourceLine + "\n"; } else if((sourceLine.contains("Z") || sourceLine.contains("z")) && !sourceLine.contains("__")) { for(int y = 0; y < vectors.length; y++) { String replace = sourceLine; if(diabloMiner.getGPUNoArray() && replace.contains("z ZA")) { replace = ""; for(int z = 0; z < 930; z += 5) { replace += " "; for(int w = 0; w < 5; w++) replace += "z ZA" + (z + w) + "; "; replace += "\n"; } } if(vectors[y] > 1 && replace.contains("typedef")) { replace = replace.replace("uint", "uint" + vectors[y]); } else if(replace.contains("z Znonce")) { String vectorGlobal; if(vectors[y] > 1) vectorGlobal = " + (uint" + vectors[y] + ")("; else vectorGlobal = " + (uint)("; for(int i = 0; i < vectors[y]; i++) { vectorGlobal += Long.toString((vectorBase + i)); if(i != vectors[y] - 1) vectorGlobal += ", "; } vectorGlobal += ");"; replace = replace.replace(";", vectorGlobal); vectorBase += vectors[y]; } if(vectors[y] == 1 && replace.contains("bool Zio")) { replace = replace.replace("any(", "("); } source += replace.replaceAll("Z", UPPER[y]).replaceAll("z", LOWER[y]) + "\n"; } } else if(totalVectors == 1 && sourceLine.contains("any(nonce")) { source += sourceLine.replace("any", "") + "\n"; } else if(sourceLine.contains("__global")) { if(totalVectors > 1) source += sourceLine.replaceAll("uint", "uint" + totalVectorsPOT) + "\n"; else source += sourceLine + "\n"; } else { source += sourceLine + "\n"; } } if(diabloMiner.getGPUDebugSource()) { System.out.println("\n---\n" + source); throw new DiabloMinerFatalException(diabloMiner, "Debug kernel source output, quitting"); } targetFPSBasis = 1000.0 / (diabloMiner.getGPUTargetFPS()); List platforms = null; try { CL.create(); platforms = CLPlatform.getPlatforms(); } catch(Exception e) { throw new DiabloMinerFatalException(diabloMiner, "Failed to initialize OpenCL, make sure your environment is setup correctly"); } if(platforms == null || platforms.isEmpty()) throw new DiabloMinerFatalException(diabloMiner, "No OpenCL platforms found"); Set enabledDevices = diabloMiner.getEnabledDevices(); int count = 1; int platformCount = 0; for(CLPlatform platform : platforms) { PlatformVersion version; diabloMiner.info("Using " + platform.getInfoString(CL10.CL_PLATFORM_NAME).trim() + " " + platform.getInfoString(CL10.CL_PLATFORM_VERSION)); String versions = platform.getInfoString(CL10.CL_PLATFORM_VERSION); if(versions.contains("OpenCL 1.0")) version = PlatformVersion.V1_0; else if (versions.contains("OpenCL 1.1")) version = PlatformVersion.V1_1; else version = PlatformVersion.V1_2; if(version == PlatformVersion.V1_0) { diabloMiner.error("OpenCL platform " + platform.getInfoString(CL10.CL_PLATFORM_NAME).trim() + " is not OpenCL 1.1 or later"); continue; } List devices = platform.getDevices(CL10.CL_DEVICE_TYPE_GPU | CL10.CL_DEVICE_TYPE_ACCELERATOR); if(devices == null || devices.isEmpty()) { diabloMiner.error("OpenCL platform " + platform.getInfoString(CL10.CL_PLATFORM_NAME).trim() + " contains no devices"); continue; } if(devices != null) { for(CLDevice device : devices) { if(enabledDevices == null || enabledDevices.contains(platformCount + "." + count) || enabledDevices.contains(Integer.toString(count))) { String deviceName = device.getInfoString(CL10.CL_DEVICE_NAME).trim() + " (#" + count + ")"; deviceStates.add(new GPUDeviceState(this, deviceName, platform, version, device)); } count++; } } platformCount++; } if(deviceStates.size() == 0) throw new DiabloMinerFatalException(diabloMiner, "No OpenCL devices found"); } public String getSource() { return source; } public double getTargetFPSBasis() { return targetFPSBasis; } public int getTotalVectors() { return totalVectors; } public List getDeviceStates() { return deviceStates; } } ================================================ FILE: src/main/java/com/diablominer/DiabloMiner/DeviceState/HardwareType.java ================================================ /* * DiabloMiner - OpenCL miner for Bitcoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * 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 . */ package com.diablominer.DiabloMiner.DeviceState; import java.util.List; import com.diablominer.DiabloMiner.DiabloMiner; import com.diablominer.DiabloMiner.DiabloMinerFatalException; abstract public class HardwareType { DiabloMiner diabloMiner; List deviceStates = null; public HardwareType(DiabloMiner diabloMiner) throws DiabloMinerFatalException { this.diabloMiner = diabloMiner; } abstract public List getDeviceStates(); public DiabloMiner getDiabloMiner() { return diabloMiner; } } ================================================ FILE: src/main/java/com/diablominer/DiabloMiner/DeviceState/PlatformVersion.java ================================================ /* * DiabloMiner - OpenCL miner for Bitcoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * 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 . */ package com.diablominer.DiabloMiner.DeviceState; public enum PlatformVersion { V1_0, V1_1, V1_2 } ================================================ FILE: src/main/java/com/diablominer/DiabloMiner/DiabloMiner.java ================================================ /* * DiabloMiner - OpenCL miner for Bitcoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * 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 . */ package com.diablominer.DiabloMiner; import java.net.Authenticator; import java.net.InetSocketAddress; import java.net.MalformedURLException; import java.net.PasswordAuthentication; import java.net.Proxy; import java.net.Proxy.Type; import java.net.URL; import java.text.DateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.Formatter; import java.util.List; import java.util.Set; import java.util.HashSet; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.apache.commons.cli.PosixParser; import com.diablominer.DiabloMiner.DeviceState.DeviceState; import com.diablominer.DiabloMiner.DeviceState.GPUHardwareType; import com.diablominer.DiabloMiner.NetworkState.JSONRPCNetworkState; import com.diablominer.DiabloMiner.NetworkState.NetworkState; public class DiabloMiner { public final static long TWO32 = 4294967295L; public final static long TIME_OFFSET = 7500; NetworkState networkStateHead = null; NetworkState networkStateTail = null; Proxy proxy = null; int workLifetime = 5000; boolean debug = false; boolean debugtimer = false; double GPUTargetFPS = 30.0; double GPUTargetFPSBasis; int GPUForceWorkSize = 0; Integer GPUVectors[] = null; boolean GPUNoArray = false; boolean GPUDebugSource = false; String source; AtomicBoolean running = new AtomicBoolean(true); List threads = new ArrayList(); long startTime; AtomicLong blocks = new AtomicLong(0); AtomicLong attempts = new AtomicLong(0); AtomicLong rejects = new AtomicLong(0); AtomicLong hwErrors = new AtomicLong(0); Set enabledDevices = null; AtomicLong hashCount = new AtomicLong(0); final static String CLEAR = " "; public static void main(String[] args) throws Exception { DiabloMiner diabloMiner = new DiabloMiner(); try { diabloMiner.execute(args); } catch(DiabloMinerFatalException e) { System.exit(-1); } } void execute(String[] args) throws Exception { threads.add(Thread.currentThread()); Options options = new Options(); options.addOption("u", "user", true, "bitcoin host username"); options.addOption("p", "pass", true, "bitcoin host password"); options.addOption("o", "host", true, "bitcoin host IP"); options.addOption("r", "port", true, "bitcoin host port"); options.addOption("l", "url", true, "bitcoin host url"); options.addOption("x", "proxy", true, "optional proxy settings IP:PORT<:username:password>"); options.addOption("g", "worklifetime", true, "maximum work lifetime in seconds"); options.addOption("d", "debug", false, "enable debug output"); options.addOption("dt", "debugtimer", false, "run for 1 minute and quit"); options.addOption("D", "devices", true, "devices to enable, default all"); options.addOption("f", "fps", true, "target GPU execution timing"); options.addOption("na", "noarray", false, "turn GPU kernel array off"); options.addOption("v", "vectors", true, "vector size in GPU kernel"); options.addOption("w", "worksize", true, "override GPU worksize"); options.addOption("ds", "ksource", false, "output GPU kernel source and quit"); options.addOption("h", "help", false, "this help"); PosixParser parser = new PosixParser(); CommandLine line = null; try { line = parser.parse(options, args); if(line.hasOption("help")) { throw new ParseException(""); } } catch(ParseException e) { System.out.println(e.getLocalizedMessage() + "\n"); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("DiabloMiner -u myuser -p mypassword [args]\n", "", options, "\nRemember to set rpcuser and rpcpassword in your ~/.bitcoin/bitcoin.conf " + "before starting bitcoind or bitcoin --daemon"); return; } String splitUrl[] = null; String splitUser[] = null; String splitPass[] = null; String splitHost[] = null; String splitPort[] = null; if(line.hasOption("url")) splitUrl = line.getOptionValue("url").split(","); if(line.hasOption("user")) splitUser = line.getOptionValue("user").split(","); if(line.hasOption("pass")) splitPass = line.getOptionValue("pass").split(","); if(line.hasOption("host")) splitHost = line.getOptionValue("host").split(","); if(line.hasOption("port")) splitPort = line.getOptionValue("port").split(","); int networkStatesCount = 0; if(splitUrl != null) networkStatesCount = splitUrl.length; if(splitUser != null) networkStatesCount = Math.max(splitUser.length, networkStatesCount); if(splitPass != null) networkStatesCount = Math.max(splitPass.length, networkStatesCount); if(splitHost != null) networkStatesCount = Math.max(splitHost.length, networkStatesCount); if(splitPort != null) networkStatesCount = Math.max(splitPort.length, networkStatesCount); if(networkStatesCount == 0) { error("You forgot to give any bitcoin connection info, please add either -l, or -u -p -o and -r"); System.exit(-1); } int j = 0; for(int i = 0; j < networkStatesCount; i++, j++) { String protocol = "http"; String host = "localhost"; int port = 8332; String path = "/"; String user = "diablominer"; String pass = "diablominer"; byte hostChain = 0; if(splitUrl != null && splitUrl.length > i) { String[] usernameFix = splitUrl[i].split("@", 3); if(usernameFix.length > 2) splitUrl[i] = usernameFix[0] + "+++++" + usernameFix[1] + "@" + usernameFix[2]; URL url = new URL(splitUrl[i]); if(url.getProtocol() != null && url.getProtocol().length() > 1) protocol = url.getProtocol(); if(url.getHost() != null && url.getHost().length() > 1) host = url.getHost(); if(url.getPort() != -1) port = url.getPort(); if(url.getPath() != null && url.getPath().length() > 1) path = url.getPath(); if(url.getUserInfo() != null && url.getUserInfo().length() > 1) { String[] userPassSplit = url.getUserInfo().split(":"); user = userPassSplit[0].replace("+++++", "@"); if(userPassSplit.length > 1 && userPassSplit[1].length() > 1) pass = userPassSplit[1]; } } if(splitUser != null && splitUser.length > i) user = splitUser[i]; if(splitPass != null && splitPass.length > i) pass = splitPass[i]; if(splitHost != null && splitHost.length > i) host = splitHost[i]; if(splitPort != null && splitPort.length > i) port = Integer.parseInt(splitPort[i]); NetworkState networkState; try { networkState = new JSONRPCNetworkState(this, new URL(protocol, host, port, path), user, pass, hostChain); } catch(MalformedURLException e) { throw new DiabloMinerFatalException(this, "Malformed connection parameters"); } if(networkStateHead == null) { networkStateHead = networkStateTail = networkState; } else { networkStateTail.setNetworkStateNext(networkState); networkStateTail = networkState; } } networkStateTail.setNetworkStateNext(networkStateHead); if(line.hasOption("proxy")) { final String[] proxySettings = line.getOptionValue("proxy").split(":"); if(proxySettings.length >= 2) { proxy = new Proxy(Type.HTTP, new InetSocketAddress(proxySettings[0], Integer.valueOf(proxySettings[1]))); } if(proxySettings.length >= 3) { Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(proxySettings[2], proxySettings[3].toCharArray()); } }); } } if(line.hasOption("worklifetime")) workLifetime = Integer.parseInt(line.getOptionValue("worklifetime")) * 1000; if(line.hasOption("debug")) debug = true; if(line.hasOption("debugtimer")) debugtimer = true; if(line.hasOption("devices")) { String devices[] = line.getOptionValue("devices").split(","); enabledDevices = new HashSet(); for(String s : devices) { enabledDevices.add(s); if(Integer.parseInt(s) == 0) { error("Do not use 0 with -D, devices start at 1"); System.exit(-1); } } } if(line.hasOption("fps")) { GPUTargetFPS = Float.parseFloat(line.getOptionValue("fps")); if(GPUTargetFPS < 0.1) { error("--fps argument is too low, adjusting to 0.1"); GPUTargetFPS = 0.1; } } if(line.hasOption("noarray")) GPUNoArray = true; if(line.hasOption("worksize")) GPUForceWorkSize = Integer.parseInt(line.getOptionValue("worksize")); if(line.hasOption("vectors")) { String tempVectors[] = line.getOptionValue("vectors").split(","); GPUVectors = new Integer[tempVectors.length]; try { for(int i = 0; i < GPUVectors.length; i++) { GPUVectors[i] = Integer.parseInt(tempVectors[i]); if(GPUVectors[i] > 16) { error("DiabloMiner now uses comma-separated vector layouts, use those instead"); System.exit(-1); } else if(GPUVectors[i] != 1 && GPUVectors[i] != 2 && GPUVectors[i] != 3 && GPUVectors[i] != 4 && GPUVectors[i] != 8 && GPUVectors[i] != 16) { error(GPUVectors[i] + " is not a vector length of 1, 2, 3, 4, 8, or 16"); System.exit(-1); } } Arrays.sort(GPUVectors, Collections.reverseOrder()); } catch(NumberFormatException e) { error("Cannot parse --vector argument(s)"); System.exit(-1); } } else { GPUVectors = new Integer[1]; GPUVectors[0] = 1; } if(line.hasOption("ds")) GPUDebugSource = true; info("Started"); StringBuilder list = new StringBuilder(networkStateHead.getQueryUrl().toString()); NetworkState networkState = networkStateHead.getNetworkStateNext(); while(networkState != networkStateHead) { list.append(", " + networkState.getQueryUrl()); networkState = networkState.getNetworkStateNext(); } info("Connecting to: " + list); long previousHashCount = 0; double previousAdjustedHashCount = 0.0; long previousAdjustedStartTime = startTime = (now()) - 1; StringBuilder hashMeter = new StringBuilder(80); Formatter hashMeterFormatter = new Formatter(hashMeter); int deviceCount = 0; List> allDeviceStates = new ArrayList>(); List GPUDeviceStates = new GPUHardwareType(this).getDeviceStates(); deviceCount += GPUDeviceStates.size(); allDeviceStates.add(GPUDeviceStates); while(running.get()) { for(List deviceStates : allDeviceStates) { for(DeviceState deviceState : deviceStates) { deviceState.checkDevice(); } } long now = now(); long currentHashCount = hashCount.get(); double adjustedHashCount = (double) (currentHashCount - previousHashCount) / (double) (now - previousAdjustedStartTime); double hashLongCount = (double) currentHashCount / (double) (now - startTime) / 1000.0; if(now - startTime > TIME_OFFSET * 2) { double averageHashCount = (adjustedHashCount + previousAdjustedHashCount) / 2.0 / 1000.0; hashMeter.setLength(0); if(!debug) { hashMeterFormatter.format("\rmhash: %.1f/%.1f | accept: %d | reject: %d | hw error: %d", averageHashCount, hashLongCount, blocks.get(), rejects.get(), hwErrors.get()); } else { hashMeterFormatter.format("\rmh: %.1f/%.1f | a/r/hwe: %d/%d/%d | gh: ", averageHashCount, hashLongCount, blocks.get(), rejects.get(), hwErrors.get()); double basisAverage = 0.0; for(List deviceStates : allDeviceStates) { for(DeviceState deviceState : deviceStates) { hashMeterFormatter.format("%.1f ", deviceState.getDeviceHashCount() / 1000.0 / 1000.0 / 1000.0); basisAverage += deviceState.getBasis(); } } basisAverage = 1000 / (basisAverage / deviceCount); hashMeterFormatter.format("| fps: %.1f", basisAverage); } System.out.print(hashMeter); } else { System.out.print("\rWaiting..."); } if(now() - TIME_OFFSET * 2 > previousAdjustedStartTime) { previousHashCount = currentHashCount; previousAdjustedHashCount = adjustedHashCount; previousAdjustedStartTime = now - 1; } if(debugtimer && now() > startTime + 60 * 1000) { System.out.print("\n"); info("Debug timer is up, quitting..."); System.exit(0); } try { if(now - startTime > TIME_OFFSET) Thread.sleep(1000); else Thread.sleep(1); } catch(InterruptedException e) { } } hashMeterFormatter.close(); } public static int rot(int x, int y) { return (x >>> y) | (x << (32 - y)); } public static void sharound(int out[], int na, int nb, int nc, int nd, int ne, int nf, int ng, int nh, int x, int K) { int a = out[na]; int b = out[nb]; int c = out[nc]; int d = out[nd]; int e = out[ne]; int f = out[nf]; int g = out[ng]; int h = out[nh]; int t1 = h + (rot(e, 6) ^ rot(e, 11) ^ rot(e, 25)) + ((e & f) ^ ((~e) & g)) + K + x; int t2 = (rot(a, 2) ^ rot(a, 13) ^ rot(a, 22)) + ((a & b) ^ (a & c) ^ (b & c)); out[nd] = d + t1; out[nh] = t1 + t2; } public static String dateTime() { return "[" + DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date()) + "]"; } public void info(String msg) { System.out.println("\r" + CLEAR + "\r" + dateTime() + " " + msg); threads.get(0).interrupt(); } public void debug(String msg) { if(debug) { System.out.println("\r" + CLEAR + "\r" + dateTime() + " DEBUG: " + msg); threads.get(0).interrupt(); } } public void error(String msg) { System.err.println("\r" + CLEAR + "\r" + dateTime() + " ERROR: " + msg); threads.get(0).interrupt(); } public void addThread(Thread thread) { threads.add(thread); } public long incrementBlocks() { return blocks.incrementAndGet(); } public long incrementAttempts() { return attempts.incrementAndGet(); } public long incrementRejects() { return rejects.incrementAndGet(); } public long incrementHWErrors() { return hwErrors.incrementAndGet(); } public long addAndGetHashCount(long delta) { return hashCount.addAndGet(delta); } public static long now() { return System.nanoTime() / 1000000; } public void halt() { running.set(false); for(int i = 0; i < threads.size(); i++) { Thread thread = threads.get(i); if(thread != Thread.currentThread()) thread.interrupt(); } } public boolean getDebug() { return debug; } public Set getEnabledDevices() { return enabledDevices; } public NetworkState getNetworkStateHead() { return networkStateHead; } public Proxy getProxy() { return proxy; } public int getWorkLifetime() { return workLifetime; } public boolean getRunning() { return running.get(); } public double getGPUTargetFPS() { return GPUTargetFPS; } public int getGPUForceWorkSize() { return GPUForceWorkSize; } public Integer[] getGPUVectors() { return GPUVectors; } public boolean getGPUNoArray() { return GPUNoArray; } public boolean getGPUDebugSource() { return GPUDebugSource; } } ================================================ FILE: src/main/java/com/diablominer/DiabloMiner/DiabloMinerFatalException.java ================================================ /* * DiabloMiner - OpenCL miner for Bitcoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * 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 . */ package com.diablominer.DiabloMiner; public class DiabloMinerFatalException extends Exception { public DiabloMinerFatalException(DiabloMiner diabloMiner, String reason) { super(reason); diabloMiner.error(reason); diabloMiner.halt(); } private static final long serialVersionUID = -9022549833049053386L; } ================================================ FILE: src/main/java/com/diablominer/DiabloMiner/NetworkState/JSONRPCNetworkState.java ================================================ /* * DiabloMiner - OpenCL miner for BitCoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * 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 . */ package com.diablominer.DiabloMiner.NetworkState; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.HttpURLConnection; import java.net.Proxy; import java.net.URL; import java.util.Formatter; import java.util.concurrent.LinkedBlockingDeque; import java.util.zip.GZIPInputStream; import java.util.zip.InflaterInputStream; import org.apache.commons.codec.binary.Base64; import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.JsonProcessingException; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.node.ArrayNode; import org.codehaus.jackson.node.NullNode; import org.codehaus.jackson.node.ObjectNode; import com.diablominer.DiabloMiner.DiabloMiner; import com.diablominer.DiabloMiner.DeviceState.DeviceState.ExecutionState; public class JSONRPCNetworkState extends NetworkState { URL longPollUrl; String userPass; boolean rollNTime = false; boolean noDelay = false; String rejectReason = null; final GetWorkAsync getWorkAsync = this.new GetWorkAsync(); final SendWorkAsync sendWorkAsync = this.new SendWorkAsync(); LongPollAsync longPollAsync = null; LinkedBlockingDeque incomingQueue = new LinkedBlockingDeque(); final ObjectMapper mapper = new ObjectMapper(); public JSONRPCNetworkState(DiabloMiner diabloMiner, URL queryUrl, String user, String pass, byte hostChain) { super(diabloMiner, queryUrl, user, pass, hostChain); this.userPass = "Basic " + Base64.encodeBase64String((user + ":" + pass).getBytes()).trim().replace("\r\n", ""); Thread thread = new Thread(getWorkAsync, "DiabloMiner JSONRPC GetWorkAsync for " + queryUrl.getHost()); thread.start(); diabloMiner.addThread(thread); thread = new Thread(sendWorkAsync, "DiabloMiner JSONRPC SendWorkAsync for " + queryUrl.getHost()); thread.start(); diabloMiner.addThread(thread); } JsonNode doJSONRPCCall(boolean longPoll, ObjectNode message) throws IOException { HttpURLConnection connection = null; try { URL url; if(longPoll) url = longPollUrl; else url = queryUrl; Proxy proxy = diabloMiner.getProxy(); if(proxy == null) connection = (HttpURLConnection) url.openConnection(); else connection = (HttpURLConnection) url.openConnection(proxy); if(longPoll) { connection.setConnectTimeout(10 * 60 * 1000); connection.setReadTimeout(10 * 60 * 1000); } else { connection.setConnectTimeout(15 * 1000); connection.setReadTimeout(15 * 1000); } connection.setRequestProperty("Authorization", userPass); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("Accept-Encoding", "gzip,deflate"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Cache-Control", "no-cache"); connection.setRequestProperty("User-Agent", "DiabloMiner"); connection.setRequestProperty("X-Mining-Extensions", "longpoll rollntime switchto"); connection.setDoOutput(true); OutputStream requestStream = connection.getOutputStream(); Writer request = new OutputStreamWriter(requestStream); request.write(message.toString()); request.close(); requestStream.close(); ObjectNode responseMessage = null; InputStream responseStream = null; try { String xLongPolling = connection.getHeaderField("X-Long-Polling"); if(xLongPolling != null && !"".equals(xLongPolling) && longPollAsync == null) { if(xLongPolling.startsWith("http")) longPollUrl = new URL(xLongPolling); else if(xLongPolling.startsWith("/")) longPollUrl = new URL(queryUrl.getProtocol(), queryUrl.getHost(), queryUrl.getPort(), xLongPolling); else longPollUrl = new URL(queryUrl.getProtocol(), queryUrl.getHost(), queryUrl.getPort(), (url.getFile() + "/" + xLongPolling).replace("//", "/")); longPollAsync = new LongPollAsync(); Thread thread = new Thread(longPollAsync, "DiabloMiner JSONRPC LongPollAsync for " + url.getHost()); thread.start(); diabloMiner.addThread(thread); workLifetime = 60000; diabloMiner.debug(queryUrl.getHost() + ": Enabling long poll support"); } String xRollNTime = connection.getHeaderField("X-Roll-NTime"); if(xRollNTime != null && !"".equals(xRollNTime)) { if(!"n".equalsIgnoreCase(xRollNTime) && rollNTime == false) { rollNTime = true; if(xRollNTime.startsWith("expire=")) { try { workLifetime = Integer.parseInt(xRollNTime.substring(7)) * 1000; } catch(NumberFormatException ex) { } } else { workLifetime = 60000; } diabloMiner.debug(queryUrl.getHost() + ": Enabling roll ntime support, expire after " + (workLifetime / 1000) + " seconds"); } else if("n".equalsIgnoreCase(xRollNTime) && rollNTime == true) { rollNTime = false; if(longPoll) workLifetime = 60000; else workLifetime = diabloMiner.getWorkLifetime(); diabloMiner.debug(queryUrl.getHost() + ": Disabling roll ntime support"); } } String xSwitchTo = connection.getHeaderField("X-Switch-To"); if(xSwitchTo != null && !"".equals(xSwitchTo)) { String oldHost = queryUrl.getHost(); JsonNode newHost = mapper.readTree(xSwitchTo); queryUrl = new URL(queryUrl.getProtocol(), newHost.get("host").asText(), newHost.get("port").getIntValue(), queryUrl.getPath()); if(longPollUrl != null) longPollUrl = new URL(longPollUrl.getProtocol(), newHost.get("host").asText(), newHost.get("port").getIntValue(), longPollUrl.getPath()); diabloMiner.info(oldHost + ": Switched to " + queryUrl.getHost()); } String xRejectReason = connection.getHeaderField("X-Reject-Reason"); if(xRejectReason != null && !"".equals(xRejectReason)) { rejectReason = xRejectReason; } String xIsP2Pool = connection.getHeaderField("X-Is-P2Pool"); if(xIsP2Pool != null && !"".equals(xIsP2Pool)) { if(!noDelay) diabloMiner.info("P2Pool no delay mode enabled"); noDelay = true; } if(connection.getContentEncoding() != null) { if(connection.getContentEncoding().equalsIgnoreCase("gzip")) responseStream = new GZIPInputStream(connection.getInputStream()); else if(connection.getContentEncoding().equalsIgnoreCase("deflate")) responseStream = new InflaterInputStream(connection.getInputStream()); } else { responseStream = connection.getInputStream(); } if(responseStream == null) throw new IOException("Drop to error handler"); Object output = mapper.readTree(responseStream); if(NullNode.class.equals(output.getClass())) { throw new IOException("Bitcoin returned unparsable JSON"); } else { try { responseMessage = (ObjectNode) output; } catch(ClassCastException e) { throw new IOException("Bitcoin returned unparsable JSON"); } } responseStream.close(); } catch(JsonProcessingException e) { throw new IOException("Bitcoin returned unparsable JSON"); } catch(IOException e) { InputStream errorStream = null; IOException e2 = null; if(connection.getErrorStream() == null) throw new IOException("Bitcoin disconnected during response: " + connection.getResponseCode() + " " + connection.getResponseMessage()); if(connection.getContentEncoding() != null) { if(connection.getContentEncoding().equalsIgnoreCase("gzip")) errorStream = new GZIPInputStream(connection.getErrorStream()); else if(connection.getContentEncoding().equalsIgnoreCase("deflate")) errorStream = new InflaterInputStream(connection.getErrorStream()); } else { errorStream = connection.getErrorStream(); } if(errorStream == null) throw new IOException("Bitcoin disconnected during response: " + connection.getResponseCode() + " " + connection.getResponseMessage()); byte[] errorbuf = new byte[8192]; if(errorStream.read(errorbuf) < 1) throw new IOException("Bitcoin returned an error, but with no message"); String error = new String(errorbuf).trim(); if(error.startsWith("{")) { try { Object output = mapper.readTree(error); if(NullNode.class.equals(output.getClass())) throw new IOException("Bitcoin returned an error message: " + error); else try { responseMessage = (ObjectNode) output; } catch(ClassCastException f) { throw new IOException("Bitcoin returned unparsable JSON"); } if(responseMessage.get("error") != null) { if(responseMessage.get("error").get("message") != null && responseMessage.get("error").get("message").asText() != null) { error = responseMessage.get("error").get("message").asText().trim(); e2 = new IOException("Bitcoin returned error message: " + error); } else if(responseMessage.get("error").asText() != null) { error = responseMessage.get("error").asText().trim(); if(!"null".equals(error) && !"".equals(error)) e2 = new IOException("Bitcoin returned an error message: " + error); } } } catch(JsonProcessingException f) { e2 = new IOException("Bitcoin returned unparsable JSON"); } } else { e2 = new IOException("Bitcoin returned an error message: " + error); } errorStream.close(); if(responseStream != null) responseStream.close(); if(e2 == null) e2 = new IOException("Bitcoin returned an error, but with no message"); throw e2; } if(responseMessage.get("error") != null) { if(responseMessage.get("error").get("message") != null && responseMessage.get("error").get("message").asText() != null) { String error = responseMessage.get("error").get("message").asText().trim(); throw new IOException("Bitcoin returned error message: " + error); } else if(responseMessage.get("error").asText() != null) { String error = responseMessage.get("error").asText().trim(); if(!"null".equals(error) && !"".equals(error)) throw new IOException("Bitcoin returned error message: " + error); } } JsonNode result; try { result = responseMessage.get("result"); } catch(Exception e) { throw new IOException("Bitcoin returned unparsable JSON"); } if(result == null) throw new IOException("Bitcoin did not return a result or an error"); return result; } catch(IOException e) { if(connection != null) connection.disconnect(); throw e; } } WorkState doGetWorkMessage(boolean longPoll) throws IOException { ObjectNode getWorkMessage = mapper.createObjectNode(); getWorkMessage.put("method", "getwork"); getWorkMessage.putArray("params"); getWorkMessage.put("id", 1); JsonNode responseMessage = doJSONRPCCall(longPoll, getWorkMessage); String datas; String midstates; String targets; try { datas = responseMessage.get("data").asText(); midstates = responseMessage.get("midstate").asText(); targets = responseMessage.get("target").asText(); } catch(Exception e) { throw new IOException("Bitcoin returned unparsable JSON"); } WorkState workState = new WorkState(this); String parse; for(int i = 0; i < 32; i++) { parse = datas.substring(i * 8, (i * 8) + 8); workState.setData(i, Integer.reverseBytes((int) Long.parseLong(parse, 16))); } for(int i = 0; i < 8; i++) { parse = midstates.substring(i * 8, (i * 8) + 8); workState.setMidstate(i, Integer.reverseBytes((int) Long.parseLong(parse, 16))); } for(int i = 0; i < 8; i++) { parse = targets.substring(i * 8, (i * 8) + 8); workState.setTarget(i, (Long.reverseBytes(Long.parseLong(parse, 16) << 16)) >>> 16); } return workState; } boolean doSendWorkMessage(WorkState workState) throws IOException { StringBuilder dataOutput = new StringBuilder(8 * 32 + 1); Formatter dataFormatter = new Formatter(dataOutput); int[] data = workState.getData(); dataFormatter.format( "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x" + "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", Integer.reverseBytes(data[0]), Integer.reverseBytes(data[1]), Integer.reverseBytes(data[2]), Integer.reverseBytes(data[3]), Integer.reverseBytes(data[4]), Integer.reverseBytes(data[5]), Integer.reverseBytes(data[6]), Integer.reverseBytes(data[7]), Integer.reverseBytes(data[8]), Integer.reverseBytes(data[9]), Integer.reverseBytes(data[10]), Integer.reverseBytes(data[11]), Integer.reverseBytes(data[12]), Integer.reverseBytes(data[13]), Integer.reverseBytes(data[14]), Integer.reverseBytes(data[15]), Integer.reverseBytes(data[16]), Integer.reverseBytes(data[17]), Integer.reverseBytes(data[18]), Integer.reverseBytes(data[19]), Integer.reverseBytes(data[20]), Integer.reverseBytes(data[21]), Integer.reverseBytes(data[22]), Integer.reverseBytes(data[23]), Integer.reverseBytes(data[24]), Integer.reverseBytes(data[25]), Integer.reverseBytes(data[26]), Integer.reverseBytes(data[27]), Integer.reverseBytes(data[28]), Integer.reverseBytes(data[29]), Integer.reverseBytes(data[30]), Integer.reverseBytes(data[31])); ObjectNode sendWorkMessage = mapper.createObjectNode(); sendWorkMessage.put("method", "getwork"); ArrayNode params = sendWorkMessage.putArray("params"); params.add(dataOutput.toString()); sendWorkMessage.put("id", 1); JsonNode responseMessage = doJSONRPCCall(false, sendWorkMessage); boolean accepted; dataFormatter.close(); try { accepted = responseMessage.getBooleanValue(); } catch(Exception e) { throw new IOException("Bitcoin returned unparsable JSON"); } return accepted; } class GetWorkAsync implements Runnable { public void run() { while(diabloMiner.getRunning()) { ExecutionState executionState = null; try { executionState = getQueue.take(); } catch(InterruptedException e) { continue; } if(executionState != null) { WorkState workState = incomingQueue.poll(); if(workState == null) { try { workState = doGetWorkMessage(false); } catch (IOException e) { diabloMiner.error("Cannot connect to " + queryUrl.getHost() + ": " + e.getLocalizedMessage()); networkStateNext.addGetQueue(executionState); try { if(!noDelay) Thread.sleep(250); } catch(InterruptedException f) { } continue; } } workState.setExecutionState(executionState); executionState.addIncomingQueue(workState); } } } } class SendWorkAsync implements Runnable { public void run() { while(diabloMiner.getRunning()) { WorkState workState = null; try { workState = sendQueue.take(); } catch(InterruptedException e) { continue; } if(workState != null) { boolean accepted; try { accepted = doSendWorkMessage(workState); } catch (IOException e) { diabloMiner.error("Cannot connect to " + queryUrl.getHost() + ": " + e.getLocalizedMessage()); sendQueue.addFirst(workState); try { if(!noDelay) Thread.sleep(250); } catch(InterruptedException f) { } continue; } if(accepted) { diabloMiner.info(queryUrl.getHost() + " accepted block " + diabloMiner.incrementBlocks() + " from " + workState.getExecutionState().getExecutionName()); } else { diabloMiner.info(queryUrl.getHost() + " rejected block " + diabloMiner.incrementRejects() + " from " + workState.getExecutionState().getExecutionName()); diabloMiner.debug("Rejected block " + (float) ((DiabloMiner.now() - workState.timestamp) / 1000.0) + " seconds old, roll ntime set to " + workState.getNetworkState().getRollNTime() + ", rolled " + workState.getRolledNTime() + " times"); } if(rejectReason != null) { diabloMiner.info("Reject reason: " + rejectReason); rejectReason = null; } } } } } class LongPollAsync implements Runnable { public void run() { while(diabloMiner.getRunning()) { try { WorkState workState = doGetWorkMessage(true); incomingQueue.add(workState); refreshTimestamp.set(workState.getTimestamp()); diabloMiner.debug(queryUrl.getHost() + ": Long poll returned"); } catch(IOException e) { diabloMiner.error("Cannot connect to " + queryUrl.getHost() + ": " + e.getLocalizedMessage()); } try { if(!noDelay) Thread.sleep(250); } catch(InterruptedException e) { } } } } } ================================================ FILE: src/main/java/com/diablominer/DiabloMiner/NetworkState/NetworkState.java ================================================ /* * DiabloMiner - OpenCL miner for Bitcoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * 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 . */ package com.diablominer.DiabloMiner.NetworkState; import java.net.URL; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.atomic.AtomicLong; import com.diablominer.DiabloMiner.DiabloMiner; import com.diablominer.DiabloMiner.DeviceState.DeviceState.ExecutionState; public abstract class NetworkState { DiabloMiner diabloMiner; URL queryUrl; String user; String pass; byte hostChain; byte hostProtocol; long workLifetime; boolean rollNTime; AtomicLong refreshTimestamp = new AtomicLong(0); LinkedBlockingDeque getQueue = new LinkedBlockingDeque(); LinkedBlockingDeque sendQueue = new LinkedBlockingDeque(); NetworkState networkStateNext = null; public static final byte PROTOCOL_JSONRPC = 0; public static final byte PROTOCOL_STRATUM = 1; public static final byte CHAIN_BITCOIN = 0; public static final byte CHAIN_LITECOIN = 1; public NetworkState(DiabloMiner diabloMiner, URL queryUrl, String user, String pass, byte hostChain) { this.diabloMiner = diabloMiner; this.queryUrl = queryUrl; this.user = user; this.pass = pass; this.hostChain = hostChain; this.workLifetime = diabloMiner.getWorkLifetime(); this.rollNTime = false; if("stratum".equals(queryUrl.getProtocol())) hostProtocol = PROTOCOL_STRATUM; } public void addGetQueue(ExecutionState executionState) { getQueue.add(executionState); } public void addSendQueue(WorkState workState) { sendQueue.add(workState); } public DiabloMiner getDiabloMiner() { return diabloMiner; } public NetworkState getNetworkStateNext() { return networkStateNext; } public void setNetworkStateNext(NetworkState networkState) { networkStateNext = networkState; } public URL getQueryUrl() { return queryUrl; } public long getWorkLifetime() { return workLifetime; } public long getRefreshTimestamp() { return refreshTimestamp.get(); } public boolean getRollNTime() { return rollNTime; } } ================================================ FILE: src/main/java/com/diablominer/DiabloMiner/NetworkState/WorkState.java ================================================ /* * DiabloMiner - OpenCL miner for Bitcoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * 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 . */ package com.diablominer.DiabloMiner.NetworkState; import com.diablominer.DiabloMiner.DiabloMiner; import com.diablominer.DiabloMiner.DeviceState.DeviceState.ExecutionState; public class WorkState { final int[] data = new int[32]; final int[] midstate = new int[8]; final long[] target = new long[8]; long timestamp; long base; boolean rollNTimeEnable; int rolledNTime; DiabloMiner diabloMiner; NetworkState networkState; ExecutionState executionState; WorkState(NetworkState networkState) { this.networkState = networkState; this.diabloMiner = networkState.getDiabloMiner(); this.timestamp = DiabloMiner.now(); this.base = 0; this.rolledNTime = 0; } public boolean update(long delta) { boolean getWork; if((DiabloMiner.now() - timestamp) + 1000 >= networkState.getWorkLifetime()) { diabloMiner.debug(executionState.getExecutionName() + ": Refresh work: work expired"); getWork = true; } else if(networkState.getRefreshTimestamp() > timestamp) { diabloMiner.debug(executionState.getExecutionName() + ": Refresh work: longpoll"); getWork = true; } else if(base + delta > DiabloMiner.TWO32) { if(networkState.getRollNTime()) { diabloMiner.debug(executionState.getExecutionName() + ": Rolled NTime"); base = 0; data[17] = Integer.reverseBytes(Integer.reverseBytes(data[17]) + 1); rolledNTime++; getWork = false; } else { diabloMiner.debug(executionState.getExecutionName() + ": Refresh work: range expired"); getWork = true; } } else { base += delta; getWork = false; } if(getWork) { networkState.addGetQueue(executionState); return true; } else { return false; } } public void submitNonce(int nonce) { data[19] = nonce; networkState.addSendQueue(this); } public long getBase() { return base; } public ExecutionState getExecutionState() { return executionState; } public void setExecutionState(ExecutionState executionState) { this.executionState = executionState; } public NetworkState getNetworkState() { return networkState; } public int getRolledNTime() { return rolledNTime; } public long getTimestamp() { return timestamp; } public int[] getData() { return data; } public int getData(int n) { return data[n]; } public void setData(int n, int x) { data[n] = x; } public int getMidstate(int n) { return midstate[n]; } public int[] getMidstate() { return midstate; } public void setMidstate(int n, int x) { midstate[n] = x; } public long getTarget(int n) { return target[n]; } public void setTarget(int n, long x) { target[n] = x; } } ================================================ FILE: src/main/resources/DiabloMiner.cl ================================================ /* * DiabloMiner - OpenCL miner for BitCoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * 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 detail). * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ typedef uint z; #if BITALIGN #pragma OPENCL EXTENSION cl_amd_media_ops : enable #define Zrotr(a, b) amd_bitalign((z)a, (z)a, (z)(32 - b)) #else #define Zrotr(a, b) rotate((z)a, (z)b) #endif #if BFIINT #define ZCh(a, b, c) amd_bytealign(a, b, c) #define ZMa(a, b, c) amd_bytealign((c ^ a), (b), (a)) #else #define ZCh(a, b, c) bitselect((z)c, (z)b, (z)a) #define ZMa(a, b, c) bitselect((z)a, (z)b, (z)c ^ (z)a) #endif #define ZR25(n) ((Zrotr((n), 25) ^ Zrotr((n), 14) ^ ((n) >> 3U))) #define ZR15(n) ((Zrotr((n), 15) ^ Zrotr((n), 13) ^ ((n) >> 10U))) #define ZR26(n) ((Zrotr((n), 26) ^ Zrotr((n), 21) ^ Zrotr((n), 7))) #define ZR30(n) ((Zrotr((n), 30) ^ Zrotr((n), 19) ^ Zrotr((n), 10))) __kernel __attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) void search( const uint PreVal4_state0, const uint PreVal4_state0_k7, const uint PreVal4_T1, const uint W18, const uint W19, const uint W16, const uint W17, const uint W16_plus_K16, const uint W17_plus_K17, const uint W31, const uint W32, const uint d1, const uint b1, const uint c1, const uint h1, const uint f1, const uint g1, const uint c1_plus_k5, const uint b1_plus_k6, const uint state0, const uint state1, const uint state2, const uint state3, const uint state4, const uint state5, const uint state6, const uint state7, __global uint * output) { z ZA[930]; uint noncebase = get_global_id(0); z Znonce = noncebase; uintzz nonce = (uintzz)0; ZA[15] = Znonce + PreVal4_state0; ZA[16] = (ZCh(ZA[15], b1, c1) + d1) + ZR26(ZA[15]); ZA[26] = Znonce + PreVal4_T1; ZA[27] = ZMa(f1, g1, ZA[26]) + ZR30(ZA[26]); ZA[17] = ZA[16] + h1; ZA[19] = (ZCh(ZA[17], ZA[15], b1) + c1_plus_k5) + ZR26(ZA[17]); ZA[28] = ZA[27] + ZA[16]; ZA[548] = ZMa(ZA[26], f1, ZA[28]) + ZR30(ZA[28]); ZA[20] = ZA[19] + g1; ZA[22] = (ZCh(ZA[20], ZA[17], ZA[15]) + b1_plus_k6) + ZR26(ZA[20]); ZA[29] = ZA[548] + ZA[19]; ZA[549] = ZMa(ZA[28], ZA[26], ZA[29]) + ZR30(ZA[29]); ZA[23] = ZA[22] + f1; ZA[24] = ZCh(ZA[23], ZA[20], ZA[17]) + ZR26(ZA[23]); ZA[180] = Znonce + PreVal4_state0_k7; ZA[30] = ZA[549] + ZA[22]; ZA[31] = ZMa(ZA[29], ZA[28], ZA[30]) + ZR30(ZA[30]); ZA[181] = ZA[180] + ZA[24]; ZA[182] = ZA[181] + ZA[26]; ZA[183] = ZA[181] + ZA[31]; ZA[18] = ZA[17] + 0xd807aa98U; ZA[186] = (ZCh(ZA[182], ZA[23], ZA[20]) + ZA[18]) + ZR26(ZA[182]); ZA[184] = ZMa(ZA[30], ZA[29], ZA[183]) + ZR30(ZA[183]); ZA[187] = ZA[186] + ZA[28]; ZA[188] = ZA[186] + ZA[184]; ZA[21] = ZA[20] + 0x12835b01U; ZA[191] = (ZCh(ZA[187], ZA[182], ZA[23]) + ZA[21]) + ZR26(ZA[187]); ZA[189] = ZMa(ZA[183], ZA[30], ZA[188]) + ZR30(ZA[188]); ZA[192] = ZA[191] + ZA[29]; ZA[193] = ZA[191] + ZA[189]; ZA[25] = ZA[23] + 0x243185beU; ZA[196] = (ZCh(ZA[192], ZA[187], ZA[182]) + ZA[25]) + ZR26(ZA[192]); ZA[194] = ZMa(ZA[188], ZA[183], ZA[193]) + ZR30(ZA[193]); ZA[197] = ZA[196] + ZA[30]; ZA[198] = ZA[196] + ZA[194]; ZA[185] = ZA[182] + 0x550c7dc3U; ZA[201] = (ZCh(ZA[197], ZA[192], ZA[187]) + ZA[185]) + ZR26(ZA[197]); ZA[199] = ZMa(ZA[193], ZA[188], ZA[198]) + ZR30(ZA[198]); ZA[202] = ZA[201] + ZA[183]; ZA[203] = ZA[201] + ZA[199]; ZA[190] = ZA[187] + 0x72be5d74U; ZA[206] = (ZCh(ZA[202], ZA[197], ZA[192]) + ZA[190]) + ZR26(ZA[202]); ZA[204] = ZMa(ZA[198], ZA[193], ZA[203]) + ZR30(ZA[203]); ZA[207] = ZA[206] + ZA[188]; ZA[208] = ZA[206] + ZA[204]; ZA[195] = ZA[192] + 0x80deb1feU; ZA[211] = (ZCh(ZA[207], ZA[202], ZA[197]) + ZA[195]) + ZR26(ZA[207]); ZA[209] = ZMa(ZA[203], ZA[198], ZA[208]) + ZR30(ZA[208]); ZA[212] = ZA[193] + ZA[211]; ZA[213] = ZA[211] + ZA[209]; ZA[200] = ZA[197] + 0x9bdc06a7U; ZA[216] = (ZCh(ZA[212], ZA[207], ZA[202]) + ZA[200]) + ZR26(ZA[212]); ZA[214] = ZMa(ZA[208], ZA[203], ZA[213]) + ZR30(ZA[213]); ZA[217] = ZA[198] + ZA[216]; ZA[218] = ZA[216] + ZA[214]; ZA[205] = ZA[202] + 0xc19bf3f4U; ZA[220] = (ZCh(ZA[217], ZA[212], ZA[207]) + ZA[205]) + ZR26(ZA[217]); ZA[219] = ZMa(ZA[213], ZA[208], ZA[218]) + ZR30(ZA[218]); ZA[222] = ZA[203] + ZA[220]; ZA[223] = ZA[220] + ZA[219]; ZA[210] = ZA[207] + W16_plus_K16; ZA[226] = (ZCh(ZA[222], ZA[217], ZA[212]) + ZA[210]) + ZR26(ZA[222]); ZA[225] = ZMa(ZA[218], ZA[213], ZA[223]) + ZR30(ZA[223]); ZA[0] = ZR25(Znonce) + W18; ZA[228] = ZA[226] + ZA[225]; ZA[227] = ZA[208] + ZA[226]; ZA[215] = ZA[212] + W17_plus_K17; ZA[231] = (ZCh(ZA[227], ZA[222], ZA[217]) + ZA[215]) + ZR26(ZA[227]); ZA[229] = ZMa(ZA[223], ZA[218], ZA[228]) + ZR30(ZA[228]); ZA[1] = ZA[0] + 0x0fc19dc6U; ZA[232] = ZA[213] + ZA[231]; ZA[233] = ZA[231] + ZA[229]; ZA[221] = ZA[217] + ZA[1]; ZA[32] = Znonce + W19; ZA[236] = (ZCh(ZA[232], ZA[227], ZA[222]) + ZA[221]) + ZR26(ZA[232]); ZA[234] = ZMa(ZA[228], ZA[223], ZA[233]) + ZR30(ZA[233]); ZA[33] = ZA[32] + 0x240ca1ccU; ZA[3] = ZR15(ZA[0]) + 0x80000000U; ZA[238] = ZA[236] + ZA[234]; ZA[237] = ZA[218] + ZA[236]; ZA[224] = ZA[222] + ZA[33]; ZA[241] = (ZCh(ZA[237], ZA[232], ZA[227]) + ZA[224]) + ZR26(ZA[237]); ZA[239] = ZMa(ZA[233], ZA[228], ZA[238]) + ZR30(ZA[238]); ZA[4] = ZA[3] + 0x2de92c6fU; ZA[35] = ZR15(ZA[32]); ZA[243] = ZA[241] + ZA[239]; ZA[242] = ZA[223] + ZA[241]; ZA[230] = ZA[227] + ZA[4]; ZA[246] = (ZCh(ZA[242], ZA[237], ZA[232]) + ZA[230]) + ZR26(ZA[242]); ZA[244] = ZMa(ZA[238], ZA[233], ZA[243]) + ZR30(ZA[243]); ZA[36] = ZA[35] + 0x4a7484aaU; ZA[7] = ZR15(ZA[3]) + 0x00000280U; ZA[248] = ZA[246] + ZA[244]; ZA[247] = ZA[228] + ZA[246]; ZA[235] = ZA[232] + ZA[36]; ZA[251] = (ZCh(ZA[247], ZA[242], ZA[237]) + ZA[235]) + ZR26(ZA[247]); ZA[249] = ZMa(ZA[243], ZA[238], ZA[248]) + ZR30(ZA[248]); ZA[8] = ZA[7] + 0x5cb0a9dcU; ZA[38] = ZR15(ZA[35]) + W16; ZA[253] = ZA[251] + ZA[249]; ZA[252] = ZA[233] + ZA[251]; ZA[240] = ZA[237] + ZA[8]; ZA[256] = (ZCh(ZA[252], ZA[247], ZA[242]) + ZA[240]) + ZR26(ZA[252]); ZA[254] = ZMa(ZA[248], ZA[243], ZA[253]) + ZR30(ZA[253]); ZA[40] = ZA[38] + 0x76f988daU; ZA[10] = ZR15(ZA[7]) + W17; ZA[258] = ZA[256] + ZA[254]; ZA[257] = ZA[238] + ZA[256]; ZA[245] = ZA[242] + ZA[40]; ZA[261] = (ZCh(ZA[257], ZA[252], ZA[247]) + ZA[245]) + ZR26(ZA[257]); ZA[259] = ZMa(ZA[253], ZA[248], ZA[258]) + ZR30(ZA[258]); ZA[13] = ZA[10] + 0x983e5152U; ZA[43] = ZR15(ZA[38]) + ZA[0]; ZA[263] = ZA[261] + ZA[259]; ZA[262] = ZA[243] + ZA[261]; ZA[250] = ZA[247] + ZA[13]; ZA[266] = (ZCh(ZA[262], ZA[257], ZA[252]) + ZA[250]) + ZR26(ZA[262]); ZA[264] = ZMa(ZA[258], ZA[253], ZA[263]) + ZR30(ZA[263]); ZA[11] = ZR15(ZA[10]); ZA[45] = ZA[43] + 0xa831c66dU; ZA[52] = ZA[11] + ZA[32]; ZA[267] = ZA[248] + ZA[266]; ZA[255] = ZA[252] + ZA[45]; ZA[268] = ZA[266] + ZA[264]; ZA[271] = (ZCh(ZA[267], ZA[262], ZA[257]) + ZA[255]) + ZR26(ZA[267]); ZA[269] = ZMa(ZA[263], ZA[258], ZA[268]) + ZR30(ZA[268]); ZA[54] = ZA[52] + 0xb00327c8U; ZA[48] = ZR15(ZA[43]) + ZA[3]; ZA[273] = ZA[271] + ZA[269]; ZA[272] = ZA[253] + ZA[271]; ZA[260] = ZA[257] + ZA[54]; ZA[276] = (ZCh(ZA[272], ZA[267], ZA[262]) + ZA[260]) + ZR26(ZA[272]); ZA[274] = ZMa(ZA[268], ZA[263], ZA[273]) + ZR30(ZA[273]); ZA[49] = ZA[48] + 0xbf597fc7U; ZA[61] = ZR15(ZA[52]) + ZA[35]; ZA[278] = ZA[276] + ZA[274]; ZA[277] = ZA[258] + ZA[276]; ZA[265] = ZA[262] + ZA[49]; ZA[281] = (ZCh(ZA[277], ZA[272], ZA[267]) + ZA[265]) + ZR26(ZA[277]); ZA[279] = ZMa(ZA[273], ZA[268], ZA[278]) + ZR30(ZA[278]); ZA[62] = ZA[61] + 0xc6e00bf3U; ZA[53] = ZR15(ZA[48]) + ZA[7]; ZA[283] = ZA[281] + ZA[279]; ZA[282] = ZA[263] + ZA[281]; ZA[270] = ZA[267] + ZA[62]; ZA[286] = (ZCh(ZA[282], ZA[277], ZA[272]) + ZA[270]) + ZR26(ZA[282]); ZA[284] = ZMa(ZA[278], ZA[273], ZA[283]) + ZR30(ZA[283]); ZA[39] = ZA[38] + 0x00A00055U; ZA[55] = ZA[53] + 0xd5a79147U; ZA[66] = ZR15(ZA[61]) + ZA[39]; ZA[288] = ZA[286] + ZA[284]; ZA[287] = ZA[268] + ZA[286]; ZA[275] = ZA[272] + ZA[55]; ZA[291] = (ZCh(ZA[287], ZA[282], ZA[277]) + ZA[275]) + ZR26(ZA[287]); ZA[289] = ZMa(ZA[283], ZA[278], ZA[288]) + ZR30(ZA[288]); ZA[12] = ZA[10] + W31; ZA[68] = ZA[66] + 0x06ca6351U; ZA[67] = ZR15(ZA[53]) + ZA[12]; ZA[293] = ZA[291] + ZA[289]; ZA[292] = ZA[273] + ZA[291]; ZA[280] = ZA[277] + ZA[68]; ZA[296] = (ZCh(ZA[292], ZA[287], ZA[282]) + ZA[280]) + ZR26(ZA[292]); ZA[294] = ZMa(ZA[288], ZA[283], ZA[293]) + ZR30(ZA[293]); ZA[2] = ZR25(ZA[0]); ZA[69] = ZA[67] + 0x14292967U; ZA[44] = ZA[43] + W32; ZA[75] = ZR15(ZA[66]) + ZA[44]; ZA[298] = ZA[296] + ZA[294]; ZA[297] = ZA[278] + ZA[296]; ZA[285] = ZA[282] + ZA[69]; ZA[5] = ZA[2] + W17; ZA[301] = (ZCh(ZA[297], ZA[292], ZA[287]) + ZA[285]) + ZR26(ZA[297]); ZA[299] = ZMa(ZA[293], ZA[288], ZA[298]) + ZR30(ZA[298]); ZA[56] = ZA[52] + ZA[5]; ZA[76] = ZA[75] + 0x27b70a85U; ZA[34] = ZR25(ZA[32]) + ZA[0]; ZA[70] = ZR15(ZA[67]) + ZA[56]; ZA[302] = ZA[283] + ZA[301]; ZA[303] = ZA[301] + ZA[299]; ZA[290] = ZA[287] + ZA[76]; ZA[306] = (ZCh(ZA[302], ZA[297], ZA[292]) + ZA[290]) + ZR26(ZA[302]); ZA[304] = ZMa(ZA[298], ZA[293], ZA[303]) + ZR30(ZA[303]); ZA[6] = ZR25(ZA[3]); ZA[77] = ZA[70] + 0x2e1b2138U; ZA[50] = ZA[34] + ZA[48]; ZA[78] = ZR15(ZA[75]) + ZA[50]; ZA[308] = ZA[306] + ZA[304]; ZA[307] = ZA[288] + ZA[306]; ZA[295] = ZA[292] + ZA[77]; ZA[41] = ZA[32] + ZA[6]; ZA[311] = (ZCh(ZA[307], ZA[302], ZA[297]) + ZA[295]) + ZR26(ZA[307]); ZA[309] = ZMa(ZA[303], ZA[298], ZA[308]) + ZR30(ZA[308]); ZA[63] = ZA[41] + ZA[61]; ZA[85] = ZA[78] + 0x4d2c6dfcU; ZA[37] = ZR25(ZA[35]) + ZA[3]; ZA[79] = ZR15(ZA[70]) + ZA[63]; ZA[312] = ZA[293] + ZA[311]; ZA[313] = ZA[311] + ZA[309]; ZA[300] = ZA[297] + ZA[85]; ZA[316] = (ZCh(ZA[312], ZA[307], ZA[302]) + ZA[300]) + ZR26(ZA[312]); ZA[314] = ZMa(ZA[308], ZA[303], ZA[313]) + ZR30(ZA[313]); ZA[9] = ZR25(ZA[7]); ZA[86] = ZA[79] + 0x53380d13U; ZA[57] = ZA[37] + ZA[53]; ZA[87] = ZR15(ZA[78]) + ZA[57]; ZA[318] = ZA[316] + ZA[314]; ZA[317] = ZA[298] + ZA[316]; ZA[305] = ZA[302] + ZA[86]; ZA[46] = ZA[35] + ZA[9]; ZA[321] = (ZCh(ZA[317], ZA[312], ZA[307]) + ZA[305]) + ZR26(ZA[317]); ZA[319] = ZMa(ZA[313], ZA[308], ZA[318]) + ZR30(ZA[318]); ZA[71] = ZA[46] + ZA[66]; ZA[92] = ZA[87] + 0x650a7354U; ZA[42] = ZR25(ZA[38]) + ZA[7]; ZA[88] = ZR15(ZA[79]) + ZA[71]; ZA[322] = ZA[303] + ZA[321]; ZA[323] = ZA[321] + ZA[319]; ZA[310] = ZA[307] + ZA[92]; ZA[326] = (ZCh(ZA[322], ZA[317], ZA[312]) + ZA[310]) + ZR26(ZA[322]); ZA[324] = ZMa(ZA[318], ZA[313], ZA[323]) + ZR30(ZA[323]); ZA[14] = ZR25(ZA[10]); ZA[93] = ZA[88] + 0x766a0abbU; ZA[72] = ZA[42] + ZA[67]; ZA[94] = ZR15(ZA[87]) + ZA[72]; ZA[328] = ZA[326] + ZA[324]; ZA[327] = ZA[308] + ZA[326]; ZA[315] = ZA[312] + ZA[93]; ZA[51] = ZA[38] + ZA[14]; ZA[331] = (ZCh(ZA[327], ZA[322], ZA[317]) + ZA[315]) + ZR26(ZA[327]); ZA[329] = ZMa(ZA[323], ZA[318], ZA[328]) + ZR30(ZA[328]); ZA[80] = ZA[51] + ZA[75]; ZA[100] = ZA[94] + 0x81c2c92eU; ZA[47] = ZR25(ZA[43]) + ZA[10]; ZA[95] = ZR15(ZA[88]) + ZA[80]; ZA[332] = ZA[313] + ZA[331]; ZA[333] = ZA[331] + ZA[329]; ZA[320] = ZA[317] + ZA[100]; ZA[336] = (ZCh(ZA[332], ZA[327], ZA[322]) + ZA[320]) + ZR26(ZA[332]); ZA[334] = ZMa(ZA[328], ZA[323], ZA[333]) + ZR30(ZA[333]); ZA[81] = ZA[47] + ZA[70]; ZA[101] = ZA[95] + 0x92722c85U; ZA[58] = ZR25(ZA[52]) + ZA[43]; ZA[102] = ZR15(ZA[94]) + ZA[81]; ZA[337] = ZA[318] + ZA[336]; ZA[338] = ZA[336] + ZA[334]; ZA[325] = ZA[322] + ZA[101]; ZA[341] = (ZCh(ZA[337], ZA[332], ZA[327]) + ZA[325]) + ZR26(ZA[337]); ZA[339] = ZMa(ZA[333], ZA[328], ZA[338]) + ZR30(ZA[338]); ZA[89] = ZA[58] + ZA[78]; ZA[108] = ZA[102] + 0xa2bfe8a1U; ZA[59] = ZR25(ZA[48]) + ZA[52]; ZA[103] = ZR15(ZA[95]) + ZA[89]; ZA[342] = ZA[323] + ZA[341]; ZA[343] = ZA[341] + ZA[339]; ZA[330] = ZA[327] + ZA[108]; ZA[346] = (ZCh(ZA[342], ZA[337], ZA[332]) + ZA[330]) + ZR26(ZA[342]); ZA[344] = ZMa(ZA[338], ZA[333], ZA[343]) + ZR30(ZA[343]); ZA[90] = ZA[59] + ZA[79]; ZA[109] = ZA[103] + 0xa81a664bU; ZA[64] = ZR25(ZA[61]) + ZA[48]; ZA[110] = ZR15(ZA[102]) + ZA[90]; ZA[347] = ZA[328] + ZA[346]; ZA[348] = ZA[346] + ZA[344]; ZA[335] = ZA[332] + ZA[109]; ZA[351] = (ZCh(ZA[347], ZA[342], ZA[337]) + ZA[335]) + ZR26(ZA[347]); ZA[349] = ZMa(ZA[343], ZA[338], ZA[348]) + ZR30(ZA[348]); ZA[60] = ZR25(ZA[53]); ZA[116] = ZA[110] + 0xc24b8b70U; ZA[96] = ZA[87] + ZA[64]; ZA[111] = ZR15(ZA[103]) + ZA[96]; ZA[353] = ZA[351] + ZA[349]; ZA[352] = ZA[333] + ZA[351]; ZA[340] = ZA[337] + ZA[116]; ZA[65] = ZA[60] + ZA[61]; ZA[356] = (ZCh(ZA[352], ZA[347], ZA[342]) + ZA[340]) + ZR26(ZA[352]); ZA[354] = ZMa(ZA[348], ZA[343], ZA[353]) + ZR30(ZA[353]); ZA[97] = ZA[88] + ZA[65]; ZA[117] = ZA[111] + 0xc76c51a3U; ZA[73] = ZR25(ZA[66]) + ZA[53]; ZA[118] = ZR15(ZA[110]) + ZA[97]; ZA[357] = ZA[338] + ZA[356]; ZA[358] = ZA[356] + ZA[354]; ZA[345] = ZA[342] + ZA[117]; ZA[361] = (ZCh(ZA[357], ZA[352], ZA[347]) + ZA[345]) + ZR26(ZA[357]); ZA[359] = ZMa(ZA[353], ZA[348], ZA[358]) + ZR30(ZA[358]); ZA[104] = ZA[73] + ZA[94]; ZA[124] = ZA[118] + 0xd192e819U; ZA[74] = ZR25(ZA[67]) + ZA[66]; ZA[119] = ZR15(ZA[111]) + ZA[104]; ZA[362] = ZA[343] + ZA[361]; ZA[363] = ZA[361] + ZA[359]; ZA[350] = ZA[347] + ZA[124]; ZA[366] = (ZCh(ZA[362], ZA[357], ZA[352]) + ZA[350]) + ZR26(ZA[362]); ZA[364] = ZMa(ZA[358], ZA[353], ZA[363]) + ZR30(ZA[363]); ZA[105] = ZA[74] + ZA[95]; ZA[125] = ZA[119] + 0xd6990624U; ZA[82] = ZR25(ZA[75]) + ZA[67]; ZA[126] = ZR15(ZA[118]) + ZA[105]; ZA[367] = ZA[348] + ZA[366]; ZA[368] = ZA[366] + ZA[364]; ZA[355] = ZA[352] + ZA[125]; ZA[371] = (ZCh(ZA[367], ZA[362], ZA[357]) + ZA[355]) + ZR26(ZA[367]); ZA[369] = ZMa(ZA[363], ZA[358], ZA[368]) + ZR30(ZA[368]); ZA[112] = ZA[102] + ZA[82]; ZA[132] = ZA[126] + 0xf40e3585U; ZA[83] = ZR25(ZA[70]) + ZA[75]; ZA[127] = ZR15(ZA[119]) + ZA[112]; ZA[372] = ZA[353] + ZA[371]; ZA[373] = ZA[371] + ZA[369]; ZA[360] = ZA[357] + ZA[132]; ZA[376] = (ZCh(ZA[372], ZA[367], ZA[362]) + ZA[360]) + ZR26(ZA[372]); ZA[374] = ZMa(ZA[368], ZA[363], ZA[373]) + ZR30(ZA[373]); ZA[113] = ZA[103] + ZA[83]; ZA[133] = ZA[127] + 0x106aa070U; ZA[84] = ZR25(ZA[78]) + ZA[70]; ZA[134] = ZR15(ZA[126]) + ZA[113]; ZA[377] = ZA[358] + ZA[376]; ZA[378] = ZA[376] + ZA[374]; ZA[365] = ZA[362] + ZA[133]; ZA[381] = (ZCh(ZA[377], ZA[372], ZA[367]) + ZA[365]) + ZR26(ZA[377]); ZA[379] = ZMa(ZA[373], ZA[368], ZA[378]) + ZR30(ZA[378]); ZA[120] = ZA[110] + ZA[84]; ZA[140] = ZA[134] + 0x19a4c116U; ZA[91] = ZR25(ZA[79]) + ZA[78]; ZA[135] = ZR15(ZA[127]) + ZA[120]; ZA[382] = ZA[363] + ZA[381]; ZA[383] = ZA[381] + ZA[379]; ZA[370] = ZA[367] + ZA[140]; ZA[386] = (ZCh(ZA[382], ZA[377], ZA[372]) + ZA[370]) + ZR26(ZA[382]); ZA[384] = ZMa(ZA[378], ZA[373], ZA[383]) + ZR30(ZA[383]); ZA[121] = ZA[111] + ZA[91]; ZA[141] = ZA[135] + 0x1e376c08U; ZA[98] = ZR25(ZA[87]) + ZA[79]; ZA[142] = ZR15(ZA[134]) + ZA[121]; ZA[387] = ZA[368] + ZA[386]; ZA[388] = ZA[386] + ZA[384]; ZA[375] = ZA[372] + ZA[141]; ZA[391] = (ZCh(ZA[387], ZA[382], ZA[377]) + ZA[375]) + ZR26(ZA[387]); ZA[389] = ZMa(ZA[383], ZA[378], ZA[388]) + ZR30(ZA[388]); ZA[128] = ZA[118] + ZA[98]; ZA[147] = ZA[142] + 0x2748774cU; ZA[99] = ZR25(ZA[88]) + ZA[87]; ZA[143] = ZR15(ZA[135]) + ZA[128]; ZA[392] = ZA[373] + ZA[391]; ZA[393] = ZA[391] + ZA[389]; ZA[380] = ZA[377] + ZA[147]; ZA[396] = (ZCh(ZA[392], ZA[387], ZA[382]) + ZA[380]) + ZR26(ZA[392]); ZA[394] = ZMa(ZA[388], ZA[383], ZA[393]) + ZR30(ZA[393]); ZA[129] = ZA[119] + ZA[99]; ZA[148] = ZA[143] + 0x34b0bcb5U; ZA[106] = ZR25(ZA[94]) + ZA[88]; ZA[149] = ZR15(ZA[142]) + ZA[129]; ZA[397] = ZA[378] + ZA[396]; ZA[398] = ZA[396] + ZA[394]; ZA[385] = ZA[382] + ZA[148]; ZA[401] = (ZCh(ZA[397], ZA[392], ZA[387]) + ZA[385]) + ZR26(ZA[397]); ZA[399] = ZMa(ZA[393], ZA[388], ZA[398]) + ZR30(ZA[398]); ZA[136] = ZA[126] + ZA[106]; ZA[153] = ZA[149] + 0x391c0cb3U; ZA[107] = ZR25(ZA[95]) + ZA[94]; ZA[150] = ZR15(ZA[143]) + ZA[136]; ZA[402] = ZA[383] + ZA[401]; ZA[403] = ZA[401] + ZA[399]; ZA[390] = ZA[387] + ZA[153]; ZA[406] = (ZCh(ZA[402], ZA[397], ZA[392]) + ZA[390]) + ZR26(ZA[402]); ZA[404] = ZMa(ZA[398], ZA[393], ZA[403]) + ZR30(ZA[403]); ZA[137] = ZA[127] + ZA[107]; ZA[154] = ZA[150] + 0x4ed8aa4aU; ZA[114] = ZR25(ZA[102]) + ZA[95]; ZA[155] = ZR15(ZA[149]) + ZA[137]; ZA[407] = ZA[388] + ZA[406]; ZA[408] = ZA[406] + ZA[404]; ZA[395] = ZA[392] + ZA[154]; ZA[411] = (ZCh(ZA[407], ZA[402], ZA[397]) + ZA[395]) + ZR26(ZA[407]); ZA[409] = ZMa(ZA[403], ZA[398], ZA[408]) + ZR30(ZA[408]); ZA[144] = ZA[134] + ZA[114]; ZA[159] = ZA[155] + 0x5b9cca4fU; ZA[115] = ZR25(ZA[103]) + ZA[102]; ZA[156] = ZR15(ZA[150]) + ZA[144]; ZA[412] = ZA[393] + ZA[411]; ZA[413] = ZA[411] + ZA[409]; ZA[400] = ZA[397] + ZA[159]; ZA[416] = (ZCh(ZA[412], ZA[407], ZA[402]) + ZA[400]) + ZR26(ZA[412]); ZA[414] = ZMa(ZA[408], ZA[403], ZA[413]) + ZR30(ZA[413]); ZA[145] = ZA[135] + ZA[115]; ZA[160] = ZA[156] + 0x682e6ff3U; ZA[122] = ZR25(ZA[110]) + ZA[103]; ZA[161] = ZR15(ZA[155]) + ZA[145]; ZA[417] = ZA[398] + ZA[416]; ZA[418] = ZA[416] + ZA[414]; ZA[405] = ZA[402] + ZA[160]; ZA[421] = (ZCh(ZA[417], ZA[412], ZA[407]) + ZA[405]) + ZR26(ZA[417]); ZA[419] = ZMa(ZA[413], ZA[408], ZA[418]) + ZR30(ZA[418]); ZA[151] = ZA[142] + ZA[122]; ZA[165] = ZA[161] + 0x748f82eeU; ZA[123] = ZR25(ZA[111]) + ZA[110]; ZA[162] = ZR15(ZA[156]) + ZA[151]; ZA[422] = ZA[403] + ZA[421]; ZA[423] = ZA[421] + ZA[419]; ZA[410] = ZA[407] + ZA[165]; ZA[426] = (ZCh(ZA[422], ZA[417], ZA[412]) + ZA[410]) + ZR26(ZA[422]); ZA[424] = ZMa(ZA[418], ZA[413], ZA[423]) + ZR30(ZA[423]); ZA[152] = ZA[143] + ZA[123]; ZA[166] = ZA[162] + 0x78a5636fU; ZA[130] = ZR25(ZA[118]) + ZA[111]; ZA[167] = ZR15(ZA[161]) + ZA[152]; ZA[427] = ZA[408] + ZA[426]; ZA[428] = ZA[426] + ZA[424]; ZA[415] = ZA[412] + ZA[166]; ZA[431] = (ZCh(ZA[427], ZA[422], ZA[417]) + ZA[415]) + ZR26(ZA[427]); ZA[429] = ZMa(ZA[423], ZA[418], ZA[428]) + ZR30(ZA[428]); ZA[157] = ZA[149] + ZA[130]; ZA[170] = ZA[167] + 0x84c87814U; ZA[131] = ZR25(ZA[119]) + ZA[118]; ZA[168] = ZR15(ZA[162]) + ZA[157]; ZA[432] = ZA[413] + ZA[431]; ZA[433] = ZA[431] + ZA[429]; ZA[420] = ZA[417] + ZA[170]; ZA[436] = (ZCh(ZA[432], ZA[427], ZA[422]) + ZA[420]) + ZR26(ZA[432]); ZA[434] = ZMa(ZA[428], ZA[423], ZA[433]) + ZR30(ZA[433]); ZA[158] = ZA[150] + ZA[131]; ZA[171] = ZA[168] + 0x8cc70208U; ZA[138] = ZR25(ZA[126]) + ZA[119]; ZA[172] = ZR15(ZA[167]) + ZA[158]; ZA[437] = ZA[418] + ZA[436]; ZA[438] = ZA[436] + ZA[434]; ZA[425] = ZA[422] + ZA[171]; ZA[441] = (ZCh(ZA[437], ZA[432], ZA[427]) + ZA[425]) + ZR26(ZA[437]); ZA[439] = ZMa(ZA[433], ZA[428], ZA[438]) + ZR30(ZA[438]); ZA[163] = ZA[155] + ZA[138]; ZA[174] = ZA[172] + 0x90befffaU; ZA[139] = ZR25(ZA[127]) + ZA[126]; ZA[173] = ZR15(ZA[168]) + ZA[163]; ZA[442] = ZA[423] + ZA[441]; ZA[443] = ZA[441] + ZA[439]; ZA[430] = ZA[427] + ZA[174]; ZA[445] = (ZCh(ZA[442], ZA[437], ZA[432]) + ZA[430]) + ZR26(ZA[442]); ZA[444] = ZMa(ZA[438], ZA[433], ZA[443]) + ZR30(ZA[443]); ZA[164] = ZA[156] + ZA[139]; ZA[175] = ZA[173] + 0xa4506cebU; ZA[146] = ZR25(ZA[134]) + ZA[127]; ZA[176] = ZR15(ZA[172]) + ZA[164]; ZA[446] = ZA[428] + ZA[445]; ZA[447] = ZA[445] + ZA[444]; ZA[435] = ZA[432] + ZA[175]; ZA[449] = (ZCh(ZA[446], ZA[442], ZA[437]) + ZA[435]) + ZR26(ZA[446]); ZA[448] = ZMa(ZA[443], ZA[438], ZA[447]) + ZR30(ZA[447]); ZA[169] = ZA[161] + ZA[146]; ZA[178] = ZA[176] + 0xbef9a3f7U; ZA[177] = ZR15(ZA[173]) + ZA[169]; ZA[451] = ZA[449] + ZA[448]; ZA[450] = ZA[433] + ZA[449]; ZA[440] = ZA[437] + ZA[178]; ZA[453] = (ZCh(ZA[450], ZA[446], ZA[442]) + ZA[440]) + ZR26(ZA[450]); ZA[452] = ZMa(ZA[447], ZA[443], ZA[451]) + ZR30(ZA[451]); ZA[179] = ZA[177] + 0xc67178f2U; ZA[454] = ZA[438] + ZA[453]; ZA[494] = ZA[442] + ZA[179]; ZA[455] = ZA[453] + ZA[452]; ZA[457] = (ZCh(ZA[454], ZA[450], ZA[446]) + ZA[494]) + ZR26(ZA[454]); ZA[456] = ZMa(ZA[451], ZA[447], ZA[455]) + ZR30(ZA[455]); ZA[459] = ZA[457] + ZA[456]; ZA[461] = ZA[455] + state1; ZA[460] = ZA[459] + state0; ZA[495] = ZA[460] + 0x98c7e2a2U; ZA[469] = ZA[461] + 0x90bb1e3cU; ZA[498] = (ZCh(ZA[495], 0x510e527fU, 0x9b05688cU) + ZA[469]) + ZR26(ZA[495]); ZA[462] = ZA[451] + state2; ZA[496] = ZA[460] + 0xfc08884dU; ZA[506] = ZA[498] + 0x3c6ef372U; ZA[470] = ZA[462] + 0x50c6645bU; ZA[507] = (ZCh(ZA[506], ZA[495], 0x510e527fU) + ZA[470]) + ZR26(ZA[506]); ZA[500] = ZMa(0x6a09e667U, 0xbb67ae85U, ZA[496]) + ZR30(ZA[496]); ZA[463] = ZA[447] + state3; ZA[458] = ZA[443] + ZA[457]; ZA[499] = ZA[498] + ZA[500]; ZA[508] = ZA[507] + 0xbb67ae85U; ZA[473] = ZA[463] + 0x3ac42e24U; ZA[510] = (ZCh(ZA[508], ZA[506], ZA[495]) + ZA[473]) + ZR26(ZA[508]); ZA[928] = ZMa(ZA[496], 0x6a09e667U, ZA[499]) + ZR30(ZA[499]); ZA[464] = ZA[458] + state4; ZA[476] = ZA[464] + ZA[460] + 0xd21ea4fdU; ZA[511] = ZA[510] + 0x6a09e667U; ZA[509] = ZA[928] + ZA[507]; ZA[465] = ZA[454] + state5; ZA[514] = (ZCh(ZA[511], ZA[508], ZA[506]) + ZA[476]) + ZR26(ZA[511]); ZA[512] = ZMa(ZA[499], ZA[496], ZA[509]) + ZR30(ZA[509]); ZA[478] = ZA[465] + 0x59f111f1U; ZA[519] = ZA[506] + ZA[478]; ZA[516] = ZA[496] + ZA[514]; ZA[513] = ZA[510] + ZA[512]; ZA[466] = ZA[450] + state6; ZA[520] = (ZCh(ZA[516], ZA[511], ZA[508]) + ZA[519]) + ZR26(ZA[516]); ZA[515] = ZMa(ZA[509], ZA[499], ZA[513]) + ZR30(ZA[513]); ZA[480] = ZA[466] + 0x923f82a4U; ZA[524] = ZA[508] + ZA[480]; ZA[521] = ZA[499] + ZA[520]; ZA[517] = ZA[514] + ZA[515]; ZA[467] = ZA[446] + state7; ZA[525] = (ZCh(ZA[521], ZA[516], ZA[511]) + ZA[524]) + ZR26(ZA[521]); ZA[522] = ZMa(ZA[513], ZA[509], ZA[517]) + ZR30(ZA[517]); ZA[484] = ZA[467] + 0xab1c5ed5U; ZA[529] = ZA[511] + ZA[484]; ZA[526] = ZA[509] + ZA[525]; ZA[523] = ZA[520] + ZA[522]; ZA[530] = (ZCh(ZA[526], ZA[521], ZA[516]) + ZA[529]) + ZR26(ZA[526]); ZA[550] = ZMa(ZA[517], ZA[513], ZA[523]) + ZR30(ZA[523]); ZA[531] = ZA[513] + ZA[530]; ZA[533] = ZA[516] + 0x5807aa98U; ZA[527] = ZA[550] + ZA[525]; ZA[534] = (ZCh(ZA[531], ZA[526], ZA[521]) + ZA[533]) + ZR26(ZA[531]); ZA[551] = ZMa(ZA[523], ZA[517], ZA[527]) + ZR30(ZA[527]); ZA[535] = ZA[517] + ZA[534]; ZA[538] = ZA[521] + 0x12835b01U; ZA[532] = ZA[551] + ZA[530]; ZA[539] = (ZCh(ZA[535], ZA[531], ZA[526]) + ZA[538]) + ZR26(ZA[535]); ZA[552] = ZMa(ZA[527], ZA[523], ZA[532]) + ZR30(ZA[532]); ZA[540] = ZA[523] + ZA[539]; ZA[542] = ZA[526] + 0x243185beU; ZA[536] = ZA[552] + ZA[534]; ZA[543] = (ZCh(ZA[540], ZA[535], ZA[531]) + ZA[542]) + ZR26(ZA[540]); ZA[553] = ZMa(ZA[532], ZA[527], ZA[536]) + ZR30(ZA[536]); ZA[544] = ZA[527] + ZA[543]; ZA[555] = ZA[531] + 0x550c7dc3U; ZA[541] = ZA[553] + ZA[539]; ZA[558] = (ZCh(ZA[544], ZA[540], ZA[535]) + ZA[555]) + ZR26(ZA[544]); ZA[547] = ZMa(ZA[536], ZA[532], ZA[541]) + ZR30(ZA[541]); ZA[559] = ZA[532] + ZA[558]; ZA[556] = ZA[535] + 0x72be5d74U; ZA[545] = ZA[547] + ZA[543]; ZA[562] = (ZCh(ZA[559], ZA[544], ZA[540]) + ZA[556]) + ZR26(ZA[559]); ZA[561] = ZMa(ZA[541], ZA[536], ZA[545]) + ZR30(ZA[545]); ZA[563] = ZA[536] + ZA[562]; ZA[560] = ZA[561] + ZA[558]; ZA[557] = ZA[540] + 0x80deb1feU; ZA[568] = (ZCh(ZA[563], ZA[559], ZA[544]) + ZA[557]) + ZR26(ZA[563]); ZA[564] = ZMa(ZA[545], ZA[541], ZA[560]) + ZR30(ZA[560]); ZA[569] = ZA[541] + ZA[568]; ZA[572] = ZA[544] + 0x9bdc06a7U; ZA[565] = ZA[562] + ZA[564]; ZA[574] = (ZCh(ZA[569], ZA[563], ZA[559]) + ZA[572]) + ZR26(ZA[569]); ZA[570] = ZMa(ZA[560], ZA[545], ZA[565]) + ZR30(ZA[565]); ZA[468] = ZR25(ZA[461]); ZA[497] = ZA[468] + ZA[460]; ZA[575] = ZA[545] + ZA[574]; ZA[571] = ZA[568] + ZA[570]; ZA[573] = ZA[559] + 0xc19bf274U; ZA[578] = (ZCh(ZA[575], ZA[569], ZA[563]) + ZA[573]) + ZR26(ZA[575]); ZA[576] = ZMa(ZA[565], ZA[560], ZA[571]) + ZR30(ZA[571]); ZA[929] = ZR25(ZA[462]); ZA[503] = ZA[497] + 0xe49b69c1U; ZA[471] = ZA[929] + ZA[461] + 0x00a00000U; ZA[582] = ZA[563] + ZA[503]; ZA[579] = ZA[560] + ZA[578]; ZA[577] = ZA[574] + ZA[576]; ZA[583] = (ZCh(ZA[579], ZA[575], ZA[569]) + ZA[582]) + ZR26(ZA[579]); ZA[580] = ZMa(ZA[571], ZA[565], ZA[577]) + ZR30(ZA[577]); ZA[488] = ZA[471] + 0xefbe4786U; ZA[472] = ZR25(ZA[463]) + ZA[462]; ZA[587] = ZA[569] + ZA[488]; ZA[584] = ZA[565] + ZA[583]; ZA[581] = ZA[578] + ZA[580]; ZA[588] = (ZCh(ZA[584], ZA[579], ZA[575]) + ZA[587]) + ZR26(ZA[584]); ZA[586] = ZMa(ZA[577], ZA[571], ZA[581]) + ZR30(ZA[581]); ZA[501] = ZR15(ZA[497]) + ZA[472]; ZA[475] = ZR15(ZA[471]); ZA[926] = ZA[575] + 0x0fc19dc6U; ZA[474] = ZA[475] + ZA[463] + ZR25(ZA[464]); ZA[927] = ZA[926] + ZA[501]; ZA[589] = ZA[571] + ZA[588]; ZA[585] = ZA[583] + ZA[586]; ZA[592] = (ZCh(ZA[589], ZA[584], ZA[579]) + ZA[927]) + ZR26(ZA[589]); ZA[590] = ZMa(ZA[581], ZA[577], ZA[585]) + ZR30(ZA[585]); ZA[477] = ZR25(ZA[465]) + ZA[464]; ZA[489] = ZA[474] + 0x240ca1ccU; ZA[518] = ZR15(ZA[501]) + ZA[477]; ZA[479] = ZR25(ZA[466]); ZA[596] = ZA[579] + ZA[489]; ZA[593] = ZA[577] + ZA[592]; ZA[591] = ZA[588] + ZA[590]; ZA[597] = (ZCh(ZA[593], ZA[589], ZA[584]) + ZA[596]) + ZR26(ZA[593]); ZA[594] = ZMa(ZA[585], ZA[581], ZA[591]) + ZR30(ZA[591]); ZA[481] = ZA[479] + ZA[465]; ZA[601] = ZA[518] + 0x2de92c6fU; ZA[482] = ZR15(ZA[474]) + ZA[481]; ZA[602] = ZA[584] + ZA[601]; ZA[598] = ZA[581] + ZA[597]; ZA[595] = ZA[592] + ZA[594]; ZA[632] = (ZCh(ZA[598], ZA[593], ZA[589]) + ZA[602]) + ZR26(ZA[598]); ZA[599] = ZMa(ZA[591], ZA[585], ZA[595]) + ZR30(ZA[595]); ZA[483] = ZA[466] + 0x00000100U + ZR25(ZA[467]); ZA[490] = ZA[482] + 0x4a7484aaU; ZA[528] = ZR15(ZA[518]) + ZA[483]; ZA[736] = ZA[585] + ZA[632]; ZA[605] = ZA[589] + ZA[490]; ZA[600] = ZA[597] + ZA[599]; ZA[485] = ZA[467] + 0x11002000U; ZA[738] = (ZCh(ZA[736], ZA[598], ZA[593]) + ZA[605]) + ZR26(ZA[736]); ZA[744] = ZMa(ZA[595], ZA[591], ZA[600]) + ZR30(ZA[600]); ZA[487] = ZR15(ZA[482]) + ZA[485]; ZA[603] = ZA[528] + 0x5cb0a9dcU; ZA[502] = ZA[497] + ZA[487]; ZA[739] = ZA[591] + ZA[738]; ZA[604] = ZA[593] + ZA[603]; ZA[737] = ZA[744] + ZA[632]; ZA[741] = (ZCh(ZA[739], ZA[736], ZA[598]) + ZA[604]) + ZR26(ZA[739]); ZA[745] = ZMa(ZA[600], ZA[595], ZA[737]) + ZR30(ZA[737]); ZA[486] = ZA[471] + 0x80000000U; ZA[606] = ZA[502] + 0x76f988daU; ZA[537] = ZR15(ZA[528]) + ZA[486]; ZA[742] = ZA[595] + ZA[741]; ZA[613] = ZA[598] + ZA[606]; ZA[740] = ZA[745] + ZA[738]; ZA[747] = (ZCh(ZA[742], ZA[739], ZA[736]) + ZA[613]) + ZR26(ZA[742]); ZA[746] = ZMa(ZA[737], ZA[600], ZA[740]) + ZR30(ZA[740]); ZA[607] = ZA[537] + 0x983e5152U; ZA[546] = ZR15(ZA[502]) + ZA[501]; ZA[751] = ZA[736] + ZA[607]; ZA[748] = ZA[600] + ZA[747]; ZA[743] = ZA[746] + ZA[741]; ZA[752] = (ZCh(ZA[748], ZA[742], ZA[739]) + ZA[751]) + ZR26(ZA[748]); ZA[749] = ZMa(ZA[740], ZA[737], ZA[743]) + ZR30(ZA[743]); ZA[608] = ZA[546] + 0xa831c66dU; ZA[554] = ZR15(ZA[537]) + ZA[474]; ZA[756] = ZA[739] + ZA[608]; ZA[753] = ZA[737] + ZA[752]; ZA[750] = ZA[747] + ZA[749]; ZA[757] = (ZCh(ZA[753], ZA[748], ZA[742]) + ZA[756]) + ZR26(ZA[753]); ZA[754] = ZMa(ZA[743], ZA[740], ZA[750]) + ZR30(ZA[750]); ZA[609] = ZA[554] + 0xb00327c8U; ZA[566] = ZR15(ZA[546]) + ZA[518]; ZA[761] = ZA[742] + ZA[609]; ZA[758] = ZA[740] + ZA[757]; ZA[755] = ZA[752] + ZA[754]; ZA[762] = (ZCh(ZA[758], ZA[753], ZA[748]) + ZA[761]) + ZR26(ZA[758]); ZA[759] = ZMa(ZA[750], ZA[743], ZA[755]) + ZR30(ZA[755]); ZA[610] = ZA[566] + 0xbf597fc7U; ZA[567] = ZR15(ZA[554]) + ZA[482]; ZA[766] = ZA[748] + ZA[610]; ZA[763] = ZA[743] + ZA[762]; ZA[760] = ZA[757] + ZA[759]; ZA[767] = (ZCh(ZA[763], ZA[758], ZA[753]) + ZA[766]) + ZR26(ZA[763]); ZA[764] = ZMa(ZA[755], ZA[750], ZA[760]) + ZR30(ZA[760]); ZA[611] = ZA[567] + 0xc6e00bf3U; ZA[614] = ZR15(ZA[566]) + ZA[528]; ZA[771] = ZA[753] + ZA[611]; ZA[768] = ZA[750] + ZA[767]; ZA[765] = ZA[762] + ZA[764]; ZA[772] = (ZCh(ZA[768], ZA[763], ZA[758]) + ZA[771]) + ZR26(ZA[768]); ZA[769] = ZMa(ZA[760], ZA[755], ZA[765]) + ZR30(ZA[765]); ZA[612] = ZA[502] + 0x00400022U; ZA[615] = ZA[614] + 0xd5a79147U; ZA[616] = ZR15(ZA[567]) + ZA[612]; ZA[504] = ZR25(ZA[497]) + 0x00000100U; ZA[776] = ZA[758] + ZA[615]; ZA[773] = ZA[755] + ZA[772]; ZA[770] = ZA[767] + ZA[769]; ZA[777] = (ZCh(ZA[773], ZA[768], ZA[763]) + ZA[776]) + ZR26(ZA[773]); ZA[774] = ZMa(ZA[765], ZA[760], ZA[770]) + ZR30(ZA[770]); ZA[492] = ZR25(ZA[471]); ZA[618] = ZA[537] + ZA[504]; ZA[617] = ZA[616] + 0x06ca6351U; ZA[619] = ZR15(ZA[614]) + ZA[618]; ZA[781] = ZA[763] + ZA[617]; ZA[778] = ZA[760] + ZA[777]; ZA[775] = ZA[772] + ZA[774]; ZA[505] = ZA[492] + ZA[497]; ZA[782] = (ZCh(ZA[778], ZA[773], ZA[768]) + ZA[781]) + ZR26(ZA[778]); ZA[779] = ZMa(ZA[770], ZA[765], ZA[775]) + ZR30(ZA[775]); ZA[621] = ZA[505] + ZA[546]; ZA[620] = ZA[619] + 0x14292967U; ZA[622] = ZR15(ZA[616]) + ZA[621]; ZA[625] = ZR25(ZA[501]); ZA[786] = ZA[768] + ZA[620]; ZA[783] = ZA[765] + ZA[782]; ZA[624] = ZA[554] + ZA[471]; ZA[780] = ZA[777] + ZA[779]; ZA[787] = (ZCh(ZA[783], ZA[778], ZA[773]) + ZA[786]) + ZR26(ZA[783]); ZA[784] = ZMa(ZA[775], ZA[770], ZA[780]) + ZR30(ZA[780]); ZA[493] = ZR25(ZA[474]); ZA[626] = ZA[625] + ZA[624]; ZA[623] = ZA[622] + 0x27b70a85U; ZA[627] = ZR15(ZA[619]) + ZA[626]; ZA[791] = ZA[773] + ZA[623]; ZA[788] = ZA[770] + ZA[787]; ZA[785] = ZA[782] + ZA[784]; ZA[629] = ZA[493] + ZA[501]; ZA[792] = (ZCh(ZA[788], ZA[783], ZA[778]) + ZA[791]) + ZR26(ZA[788]); ZA[789] = ZMa(ZA[780], ZA[775], ZA[785]) + ZR30(ZA[785]); ZA[630] = ZA[566] + ZA[629]; ZA[628] = ZA[627] + 0x2e1b2138U; ZA[634] = ZR25(ZA[518]) + ZA[474]; ZA[631] = ZR15(ZA[622]) + ZA[630]; ZA[796] = ZA[778] + ZA[628]; ZA[793] = ZA[775] + ZA[792]; ZA[790] = ZA[787] + ZA[789]; ZA[797] = (ZCh(ZA[793], ZA[788], ZA[783]) + ZA[796]) + ZR26(ZA[793]); ZA[794] = ZMa(ZA[785], ZA[780], ZA[790]) + ZR30(ZA[790]); ZA[491] = ZR25(ZA[482]); ZA[635] = ZA[567] + ZA[634]; ZA[633] = ZA[631] + 0x4d2c6dfcU; ZA[636] = ZR15(ZA[627]) + ZA[635]; ZA[801] = ZA[783] + ZA[633]; ZA[798] = ZA[780] + ZA[797]; ZA[795] = ZA[792] + ZA[794]; ZA[638] = ZA[491] + ZA[518]; ZA[802] = (ZCh(ZA[798], ZA[793], ZA[788]) + ZA[801]) + ZR26(ZA[798]); ZA[799] = ZMa(ZA[790], ZA[785], ZA[795]) + ZR30(ZA[795]); ZA[639] = ZA[638] + ZA[614]; ZA[637] = ZA[636] + 0x53380d13U; ZA[642] = ZR25(ZA[528]) + ZA[482]; ZA[640] = ZR15(ZA[631]) + ZA[639]; ZA[806] = ZA[788] + ZA[637]; ZA[803] = ZA[785] + ZA[802]; ZA[800] = ZA[797] + ZA[799]; ZA[807] = (ZCh(ZA[803], ZA[798], ZA[793]) + ZA[806]) + ZR26(ZA[803]); ZA[804] = ZMa(ZA[795], ZA[790], ZA[800]) + ZR30(ZA[800]); ZA[643] = ZA[616] + ZA[642]; ZA[641] = ZA[640] + 0x650a7354U; ZA[646] = ZR25(ZA[502]) + ZA[528]; ZA[644] = ZR15(ZA[636]) + ZA[643]; ZA[811] = ZA[793] + ZA[641]; ZA[808] = ZA[790] + ZA[807]; ZA[805] = ZA[802] + ZA[804]; ZA[812] = (ZCh(ZA[808], ZA[803], ZA[798]) + ZA[811]) + ZR26(ZA[808]); ZA[809] = ZMa(ZA[800], ZA[795], ZA[805]) + ZR30(ZA[805]); ZA[647] = ZA[619] + ZA[646]; ZA[645] = ZA[644] + 0x766a0abbU; ZA[650] = ZR25(ZA[537]) + ZA[502]; ZA[648] = ZR15(ZA[640]) + ZA[647]; ZA[816] = ZA[798] + ZA[645]; ZA[813] = ZA[795] + ZA[812]; ZA[810] = ZA[807] + ZA[809]; ZA[817] = (ZCh(ZA[813], ZA[808], ZA[803]) + ZA[816]) + ZR26(ZA[813]); ZA[814] = ZMa(ZA[805], ZA[800], ZA[810]) + ZR30(ZA[810]); ZA[925] = ZA[622] + ZA[650]; ZA[649] = ZA[648] + 0x81c2c92eU; ZA[653] = ZR25(ZA[546]) + ZA[537]; ZA[651] = ZR15(ZA[644]) + ZA[925]; ZA[821] = ZA[803] + ZA[649]; ZA[818] = ZA[800] + ZA[817]; ZA[815] = ZA[812] + ZA[814]; ZA[822] = (ZCh(ZA[818], ZA[813], ZA[808]) + ZA[821]) + ZR26(ZA[818]); ZA[819] = ZMa(ZA[810], ZA[805], ZA[815]) + ZR30(ZA[815]); ZA[654] = ZA[627] + ZA[653]; ZA[652] = ZA[651] + 0x92722c85U; ZA[657] = ZR25(ZA[554]) + ZA[546]; ZA[655] = ZR15(ZA[648]) + ZA[654]; ZA[826] = ZA[808] + ZA[652]; ZA[823] = ZA[805] + ZA[822]; ZA[820] = ZA[817] + ZA[819]; ZA[827] = (ZCh(ZA[823], ZA[818], ZA[813]) + ZA[826]) + ZR26(ZA[823]); ZA[824] = ZMa(ZA[815], ZA[810], ZA[820]) + ZR30(ZA[820]); ZA[658] = ZA[631] + ZA[657]; ZA[656] = ZA[655] + 0xa2bfe8a1U; ZA[661] = ZR25(ZA[566]) + ZA[554]; ZA[659] = ZR15(ZA[651]) + ZA[658]; ZA[831] = ZA[813] + ZA[656]; ZA[828] = ZA[810] + ZA[827]; ZA[825] = ZA[822] + ZA[824]; ZA[832] = (ZCh(ZA[828], ZA[823], ZA[818]) + ZA[831]) + ZR26(ZA[828]); ZA[829] = ZMa(ZA[820], ZA[815], ZA[825]) + ZR30(ZA[825]); ZA[662] = ZA[636] + ZA[661]; ZA[660] = ZA[659] + 0xa81a664bU; ZA[665] = ZR25(ZA[567]) + ZA[566]; ZA[663] = ZR15(ZA[655]) + ZA[662]; ZA[836] = ZA[818] + ZA[660]; ZA[833] = ZA[815] + ZA[832]; ZA[830] = ZA[827] + ZA[829]; ZA[837] = (ZCh(ZA[833], ZA[828], ZA[823]) + ZA[836]) + ZR26(ZA[833]); ZA[834] = ZMa(ZA[825], ZA[820], ZA[830]) + ZR30(ZA[830]); ZA[666] = ZA[640] + ZA[665]; ZA[664] = ZA[663] + 0xc24b8b70U; ZA[669] = ZR25(ZA[614]) + ZA[567]; ZA[667] = ZR15(ZA[659]) + ZA[666]; ZA[841] = ZA[823] + ZA[664]; ZA[838] = ZA[820] + ZA[837]; ZA[835] = ZA[832] + ZA[834]; ZA[842] = (ZCh(ZA[838], ZA[833], ZA[828]) + ZA[841]) + ZR26(ZA[838]); ZA[839] = ZMa(ZA[830], ZA[825], ZA[835]) + ZR30(ZA[835]); ZA[670] = ZA[644] + ZA[669]; ZA[668] = ZA[667] + 0xc76c51a3U; ZA[677] = ZR25(ZA[616]) + ZA[614]; ZA[671] = ZR15(ZA[663]) + ZA[670]; ZA[846] = ZA[828] + ZA[668]; ZA[843] = ZA[825] + ZA[842]; ZA[840] = ZA[837] + ZA[839]; ZA[847] = (ZCh(ZA[843], ZA[838], ZA[833]) + ZA[846]) + ZR26(ZA[843]); ZA[844] = ZMa(ZA[835], ZA[830], ZA[840]) + ZR30(ZA[840]); ZA[678] = ZA[648] + ZA[677]; ZA[676] = ZA[671] + 0xd192e819U; ZA[682] = ZR25(ZA[619]) + ZA[616]; ZA[679] = ZR15(ZA[667]) + ZA[678]; ZA[851] = ZA[833] + ZA[676]; ZA[848] = ZA[830] + ZA[847]; ZA[845] = ZA[842] + ZA[844]; ZA[852] = (ZCh(ZA[848], ZA[843], ZA[838]) + ZA[851]) + ZR26(ZA[848]); ZA[849] = ZMa(ZA[840], ZA[835], ZA[845]) + ZR30(ZA[845]); ZA[683] = ZA[651] + ZA[682]; ZA[680] = ZA[679] + 0xd6990624U; ZA[686] = ZR25(ZA[622]) + ZA[619]; ZA[684] = ZR15(ZA[671]) + ZA[683]; ZA[856] = ZA[838] + ZA[680]; ZA[853] = ZA[835] + ZA[852]; ZA[850] = ZA[847] + ZA[849]; ZA[857] = (ZCh(ZA[853], ZA[848], ZA[843]) + ZA[856]) + ZR26(ZA[853]); ZA[854] = ZMa(ZA[845], ZA[840], ZA[850]) + ZR30(ZA[850]); ZA[687] = ZA[655] + ZA[686]; ZA[685] = ZA[684] + 0xf40e3585U; ZA[690] = ZR25(ZA[627]) + ZA[622]; ZA[688] = ZR15(ZA[679]) + ZA[687]; ZA[861] = ZA[843] + ZA[685]; ZA[858] = ZA[840] + ZA[857]; ZA[855] = ZA[852] + ZA[854]; ZA[862] = (ZCh(ZA[858], ZA[853], ZA[848]) + ZA[861]) + ZR26(ZA[858]); ZA[859] = ZMa(ZA[850], ZA[845], ZA[855]) + ZR30(ZA[855]); ZA[691] = ZA[659] + ZA[690]; ZA[689] = ZA[688] + 0x106aa070U; ZA[694] = ZR25(ZA[631]) + ZA[627]; ZA[692] = ZR15(ZA[684]) + ZA[691]; ZA[866] = ZA[848] + ZA[689]; ZA[863] = ZA[845] + ZA[862]; ZA[860] = ZA[857] + ZA[859]; ZA[867] = (ZCh(ZA[863], ZA[858], ZA[853]) + ZA[866]) + ZR26(ZA[863]); ZA[864] = ZMa(ZA[855], ZA[850], ZA[860]) + ZR30(ZA[860]); ZA[695] = ZA[663] + ZA[694]; ZA[693] = ZA[692] + 0x19a4c116U; ZA[698] = ZR25(ZA[636]) + ZA[631]; ZA[696] = ZR15(ZA[688]) + ZA[695]; ZA[871] = ZA[853] + ZA[693]; ZA[868] = ZA[850] + ZA[867]; ZA[865] = ZA[862] + ZA[864]; ZA[873] = (ZCh(ZA[868], ZA[863], ZA[858]) + ZA[871]) + ZR26(ZA[868]); ZA[869] = ZMa(ZA[860], ZA[855], ZA[865]) + ZR30(ZA[865]); ZA[699] = ZA[667] + ZA[698]; ZA[697] = ZA[696] + 0x1e376c08U; ZA[702] = ZR25(ZA[640]) + ZA[636]; ZA[700] = ZR15(ZA[692]) + ZA[699]; ZA[877] = ZA[858] + ZA[697]; ZA[874] = ZA[855] + ZA[873]; ZA[870] = ZA[867] + ZA[869]; ZA[878] = (ZCh(ZA[874], ZA[868], ZA[863]) + ZA[877]) + ZR26(ZA[874]); ZA[875] = ZMa(ZA[865], ZA[860], ZA[870]) + ZR30(ZA[870]); ZA[703] = ZA[671] + ZA[702]; ZA[701] = ZA[700] + 0x2748774cU; ZA[706] = ZR25(ZA[644]) + ZA[640]; ZA[704] = ZR15(ZA[696]) + ZA[703]; ZA[882] = ZA[863] + ZA[701]; ZA[879] = ZA[860] + ZA[878]; ZA[876] = ZA[873] + ZA[875]; ZA[883] = (ZCh(ZA[879], ZA[874], ZA[868]) + ZA[882]) + ZR26(ZA[879]); ZA[880] = ZMa(ZA[870], ZA[865], ZA[876]) + ZR30(ZA[876]); ZA[707] = ZA[679] + ZA[706]; ZA[705] = ZA[704] + 0x34b0bcb5U; ZA[710] = ZR25(ZA[648]) + ZA[644]; ZA[708] = ZR15(ZA[700]) + ZA[707]; ZA[887] = ZA[868] + ZA[705]; ZA[884] = ZA[865] + ZA[883]; ZA[881] = ZA[878] + ZA[880]; ZA[888] = (ZCh(ZA[884], ZA[879], ZA[874]) + ZA[887]) + ZR26(ZA[884]); ZA[885] = ZMa(ZA[876], ZA[870], ZA[881]) + ZR30(ZA[881]); ZA[711] = ZA[684] + ZA[710]; ZA[709] = ZA[708] + 0x391c0cb3U; ZA[714] = ZR25(ZA[651]) + ZA[648]; ZA[712] = ZR15(ZA[704]) + ZA[711]; ZA[892] = ZA[874] + ZA[709]; ZA[889] = ZA[870] + ZA[888]; ZA[886] = ZA[883] + ZA[885]; ZA[893] = (ZCh(ZA[889], ZA[884], ZA[879]) + ZA[892]) + ZR26(ZA[889]); ZA[890] = ZMa(ZA[881], ZA[876], ZA[886]) + ZR30(ZA[886]); ZA[715] = ZA[688] + ZA[714]; ZA[713] = ZA[712] + 0x4ed8aa4aU; ZA[718] = ZR25(ZA[655]) + ZA[651]; ZA[716] = ZR15(ZA[708]) + ZA[715]; ZA[897] = ZA[879] + ZA[713]; ZA[894] = ZA[876] + ZA[893]; ZA[891] = ZA[888] + ZA[890]; ZA[898] = (ZCh(ZA[894], ZA[889], ZA[884]) + ZA[897]) + ZR26(ZA[894]); ZA[895] = ZMa(ZA[886], ZA[881], ZA[891]) + ZR30(ZA[891]); ZA[719] = ZA[692] + ZA[718]; ZA[717] = ZA[716] + 0x5b9cca4fU; ZA[722] = ZR25(ZA[659]) + ZA[655]; ZA[720] = ZR15(ZA[712]) + ZA[719]; ZA[902] = ZA[884] + ZA[717]; ZA[899] = ZA[881] + ZA[898]; ZA[896] = ZA[893] + ZA[895]; ZA[903] = (ZCh(ZA[899], ZA[894], ZA[889]) + ZA[902]) + ZR26(ZA[899]); ZA[900] = ZMa(ZA[891], ZA[886], ZA[896]) + ZR30(ZA[896]); ZA[723] = ZA[696] + ZA[722]; ZA[721] = ZA[720] + 0x682e6ff3U; ZA[672] = ZR25(ZA[663]) + ZA[659]; ZA[724] = ZR15(ZA[716]) + ZA[723]; ZA[907] = ZA[889] + ZA[721]; ZA[904] = ZA[886] + ZA[903]; ZA[901] = ZA[898] + ZA[900]; ZA[908] = (ZCh(ZA[904], ZA[899], ZA[894]) + ZA[907]) + ZR26(ZA[904]); ZA[905] = ZMa(ZA[896], ZA[891], ZA[901]) + ZR30(ZA[901]); ZA[673] = ZR25(ZA[667]) + ZA[663]; ZA[726] = ZA[700] + ZA[672]; ZA[725] = ZA[724] + 0x748f82eeU; ZA[727] = ZR15(ZA[720]) + ZA[726]; ZA[912] = ZA[894] + ZA[725]; ZA[909] = ZA[891] + ZA[908]; ZA[906] = ZA[903] + ZA[905]; ZA[675] = ZA[667] + 0x8cc70208U; ZA[729] = ZA[704] + ZA[673]; ZA[913] = (ZCh(ZA[909], ZA[904], ZA[899]) + ZA[912]) + ZR26(ZA[909]); ZA[910] = ZMa(ZA[901], ZA[896], ZA[906]) + ZR30(ZA[906]); ZA[674] = ZR25(ZA[671]) + ZA[675]; ZA[730] = ZR15(ZA[724]) + ZA[729]; ZA[728] = ZA[727] + 0x78a5636fU; ZA[681] = ZR25(ZA[679]) + ZA[671]; ZA[917] = ZA[899] + ZA[901] + ZA[728]; ZA[914] = ZA[896] + ZA[913]; ZA[911] = ZA[908] + ZA[910]; ZA[732] = ZA[708] + ZA[674]; ZA[731] = ZA[730] + 0x84c87814U; ZA[918] = (ZCh(ZA[914], ZA[909], ZA[904]) + ZA[917]) + ZR26(ZA[914]); ZA[915] = ZMa(ZA[906], ZA[901], ZA[911]) + ZR30(ZA[911]); ZA[733] = ZR15(ZA[727]) + ZA[732]; ZA[919] = ZA[906] + ZA[904] + ZA[731]; ZA[734] = ZA[712] + ZA[681]; ZA[920] = (ZCh(ZA[918], ZA[914], ZA[909]) + ZA[919]) + ZR26(ZA[918]); ZA[735] = ZR15(ZA[730]) + ZA[734]; ZA[921] = ZA[911] + ZA[909] + ZA[733]; ZA[916] = ZA[913] + ZA[915]; ZA[922] = (ZCh(ZA[920], ZA[918], ZA[914]) + ZA[921]) + ZR26(ZA[920]); ZA[923] = ZA[916] + ZA[914] + ZA[735]; ZA[924] = (ZCh(ZA[922], ZA[920], ZA[918]) + ZA[923]) + ZR26(ZA[922]); bool Zio = any(ZA[924] == (z)0x136032EDU); bool io = false; io = (Zio) ? Zio : io; nonce = (io) ? Znonce : nonce; if(io) { output[0] = (uintzz)nonce; } } // vim: set ft=c