├── LICENSE ├── Makefile ├── README ├── bfcrypt ├── bfcrypt.c ├── bfcrypt.h ├── blowfish.c ├── blowfish.h ├── crc32.c ├── crc32.h ├── des.c ├── des.h ├── md5.c ├── md5.h ├── sha256.c └── sha256.h /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TGT = bfcrypt 2 | SRC = $(addsuffix .c, $(TGT) blowfish md5 sha256 crc32 des) 3 | OBJ = $(addsuffix .o, $(TGT)) 4 | INC = -I. 5 | CFLAGS = -W -Wall -O2 6 | 7 | 8 | all: $(TGT) 9 | 10 | $(TGT): $(SRC) 11 | $(CC) $(CFLAGS) $(INC) $(SRC) -o $(TGT) 12 | 13 | clean: 14 | rm -f $(TGT) $(OBJ) 15 | 16 | 17 | .PHONY: all clean 18 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Usage: bfcrypt file 2 | -------------------------------------------------------------------------------- /bfcrypt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fwhacking/bfcrypt/879f62595f25ccd8e89eeddf929f96af1da47611/bfcrypt -------------------------------------------------------------------------------- /bfcrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "bfcrypt.h" 16 | #include "blowfish.h" 17 | #include "md5.h" 18 | #include "sha256.h" 19 | #include "crc32.h" 20 | #include "des.h" 21 | 22 | static void print_usage(const char *name) 23 | { 24 | printf("Usage: %s file\n", name); 25 | } 26 | 27 | int main(int argc, char **argv) 28 | { 29 | FILE *fd; 30 | char *start; 31 | size_t size; 32 | size_t offset; 33 | 34 | if (argc != 2) 35 | { 36 | print_usage(argv[0]); 37 | exit(1); 38 | } 39 | 40 | fd = fopen(argv[1], "rb"); 41 | if (fd == NULL) 42 | { 43 | printf("Could not read the file '%s'\n", argv[1]); 44 | print_usage(argv[0]); 45 | exit(1); 46 | } 47 | 48 | size = fseek(fd, 0L, SEEK_END); 49 | size = ftell(fd); 50 | // printf("File size : %ld bytes\n\n", size); 51 | fseek(fd, 0L, SEEK_SET); 52 | 53 | start = malloc(size); 54 | 55 | fread(start, size, 1, fd); 56 | fclose(fd); 57 | 58 | for (offset = 0; offset < size; offset++) 59 | { 60 | find_blowfish(start, offset); 61 | find_md5(start, offset); 62 | find_sha256(start, offset); 63 | find_crc32(start, offset); 64 | find_des(start, offset); 65 | } 66 | 67 | free(start); 68 | 69 | exit(0); 70 | } 71 | -------------------------------------------------------------------------------- /bfcrypt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #ifndef _BFCRYPT_H_ 10 | #define _BFCRYPT_H_ 11 | 12 | 13 | 14 | #endif // _BFCRYPT_H_ 15 | -------------------------------------------------------------------------------- /blowfish.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "bfcrypt.h" 16 | #include "blowfish.h" 17 | 18 | int find_blowfish(char *base, size_t offset) 19 | { 20 | unsigned int i; 21 | 22 | if (find_blowfish_parray(base + offset) == 0) 23 | { 24 | printf("Blowfish P-array (0x%08x) found at 0x%08lx\n", BLOWFISH_PARRAY[0], (unsigned long) offset); 25 | } 26 | 27 | for (i = 0; i < 4; i++) 28 | { 29 | if (find_blowfish_sbox(base + offset, i) == 0) 30 | { 31 | printf("Blowfish S-box[%d] (0x%08x) found at 0x%08lx\n", i, BLOWFISH_SBOX[i][0], (unsigned long) offset); 32 | } 33 | } 34 | 35 | return 0; 36 | } 37 | 38 | int find_blowfish_parray(char *p) 39 | { 40 | int ret = -1; 41 | unsigned int i; 42 | 43 | if (memcmp(BLOWFISH_PARRAY, p, sizeof(BLOWFISH_PARRAY[0])) == 0) 44 | { 45 | ret = 0; 46 | 47 | for (i = 0; i < sizeof(BLOWFISH_PARRAY) / sizeof(BLOWFISH_PARRAY[0]); i++) 48 | { 49 | if (memcmp(&BLOWFISH_PARRAY[i], p + i * sizeof(BLOWFISH_PARRAY[0]), sizeof(BLOWFISH_PARRAY[0])) != 0) 50 | { 51 | ret = -1; 52 | } 53 | } 54 | } 55 | 56 | return ret; 57 | } 58 | 59 | int find_blowfish_sbox(char *p, int n) 60 | { 61 | int ret = -1; 62 | unsigned int i; 63 | 64 | if (memcmp(BLOWFISH_SBOX[n], p, sizeof(BLOWFISH_SBOX[n][0])) == 0) 65 | { 66 | ret = 0; 67 | 68 | for (i = 0; i < sizeof(BLOWFISH_SBOX[n]) / sizeof(BLOWFISH_SBOX[n][0]); i++) 69 | { 70 | if (memcmp(&(BLOWFISH_SBOX[n][i]), p + i * sizeof(BLOWFISH_SBOX[n][0]), sizeof(BLOWFISH_SBOX[n][0])) != 0) 71 | { 72 | ret = -1; 73 | } 74 | } 75 | } 76 | 77 | return ret; 78 | } 79 | -------------------------------------------------------------------------------- /blowfish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #ifndef _BLOWFISH_H_ 10 | #define _BLOWFISH_H_ 11 | 12 | int find_blowfish(char *base, size_t offset); 13 | int find_blowfish_parray(char *p); 14 | int find_blowfish_sbox(char *p, int n); 15 | 16 | static uint32_t BLOWFISH_PARRAY[18] = 17 | { 18 | 0x243f6a88L, 0x85a308d3L, 0x13198a2eL, 0x03707344L, 19 | 0xa4093822L, 0x299f31d0L, 0x082efa98L, 0xec4e6c89L, 20 | 0x452821e6L, 0x38d01377L, 0xbe5466cfL, 0x34e90c6cL, 21 | 0xc0ac29b7L, 0xc97c50ddL, 0x3f84d5b5L, 0xb5470917L, 22 | 0x9216d5d9L, 0x8979fb1b 23 | }; 24 | 25 | static uint32_t BLOWFISH_SBOX[4][256] = 26 | { 27 | { 28 | 0xd1310ba6L, 0x98dfb5acL, 0x2ffd72dbL, 0xd01adfb7L, 29 | 0xb8e1afedL, 0x6a267e96L, 0xba7c9045L, 0xf12c7f99L, 30 | 0x24a19947L, 0xb3916cf7L, 0x0801f2e2L, 0x858efc16L, 31 | 0x636920d8L, 0x71574e69L, 0xa458fea3L, 0xf4933d7eL, 32 | 0x0d95748fL, 0x728eb658L, 0x718bcd58L, 0x82154aeeL, 33 | 0x7b54a41dL, 0xc25a59b5L, 0x9c30d539L, 0x2af26013L, 34 | 0xc5d1b023L, 0x286085f0L, 0xca417918L, 0xb8db38efL, 35 | 0x8e79dcb0L, 0x603a180eL, 0x6c9e0e8bL, 0xb01e8a3eL, 36 | 0xd71577c1L, 0xbd314b27L, 0x78af2fdaL, 0x55605c60L, 37 | 0xe65525f3L, 0xaa55ab94L, 0x57489862L, 0x63e81440L, 38 | 0x55ca396aL, 0x2aab10b6L, 0xb4cc5c34L, 0x1141e8ceL, 39 | 0xa15486afL, 0x7c72e993L, 0xb3ee1411L, 0x636fbc2aL, 40 | 0x2ba9c55dL, 0x741831f6L, 0xce5c3e16L, 0x9b87931eL, 41 | 0xafd6ba33L, 0x6c24cf5cL, 0x7a325381L, 0x28958677L, 42 | 0x3b8f4898L, 0x6b4bb9afL, 0xc4bfe81bL, 0x66282193L, 43 | 0x61d809ccL, 0xfb21a991L, 0x487cac60L, 0x5dec8032L, 44 | 0xef845d5dL, 0xe98575b1L, 0xdc262302L, 0xeb651b88L, 45 | 0x23893e81L, 0xd396acc5L, 0x0f6d6ff3L, 0x83f44239L, 46 | 0x2e0b4482L, 0xa4842004L, 0x69c8f04aL, 0x9e1f9b5eL, 47 | 0x21c66842L, 0xf6e96c9aL, 0x670c9c61L, 0xabd388f0L, 48 | 0x6a51a0d2L, 0xd8542f68L, 0x960fa728L, 0xab5133a3L, 49 | 0x6eef0b6cL, 0x137a3be4L, 0xba3bf050L, 0x7efb2a98L, 50 | 0xa1f1651dL, 0x39af0176L, 0x66ca593eL, 0x82430e88L, 51 | 0x8cee8619L, 0x456f9fb4L, 0x7d84a5c3L, 0x3b8b5ebeL, 52 | 0xe06f75d8L, 0x85c12073L, 0x401a449fL, 0x56c16aa6L, 53 | 0x4ed3aa62L, 0x363f7706L, 0x1bfedf72L, 0x429b023dL, 54 | 0x37d0d724L, 0xd00a1248L, 0xdb0fead3L, 0x49f1c09bL, 55 | 0x075372c9L, 0x80991b7bL, 0x25d479d8L, 0xf6e8def7L, 56 | 0xe3fe501aL, 0xb6794c3bL, 0x976ce0bdL, 0x04c006baL, 57 | 0xc1a94fb6L, 0x409f60c4L, 0x5e5c9ec2L, 0x196a2463L, 58 | 0x68fb6fafL, 0x3e6c53b5L, 0x1339b2ebL, 0x3b52ec6fL, 59 | 0x6dfc511fL, 0x9b30952cL, 0xcc814544L, 0xaf5ebd09L, 60 | 0xbee3d004L, 0xde334afdL, 0x660f2807L, 0x192e4bb3L, 61 | 0xc0cba857L, 0x45c8740fL, 0xd20b5f39L, 0xb9d3fbdbL, 62 | 0x5579c0bdL, 0x1a60320aL, 0xd6a100c6L, 0x402c7279L, 63 | 0x679f25feL, 0xfb1fa3ccL, 0x8ea5e9f8L, 0xdb3222f8L, 64 | 0x3c7516dfL, 0xfd616b15L, 0x2f501ec8L, 0xad0552abL, 65 | 0x323db5faL, 0xfd238760L, 0x53317b48L, 0x3e00df82L, 66 | 0x9e5c57bbL, 0xca6f8ca0L, 0x1a87562eL, 0xdf1769dbL, 67 | 0xd542a8f6L, 0x287effc3L, 0xac6732c6L, 0x8c4f5573L, 68 | 0x695b27b0L, 0xbbca58c8L, 0xe1ffa35dL, 0xb8f011a0L, 69 | 0x10fa3d98L, 0xfd2183b8L, 0x4afcb56cL, 0x2dd1d35bL, 70 | 0x9a53e479L, 0xb6f84565L, 0xd28e49bcL, 0x4bfb9790L, 71 | 0xe1ddf2daL, 0xa4cb7e33L, 0x62fb1341L, 0xcee4c6e8L, 72 | 0xef20cadaL, 0x36774c01L, 0xd07e9efeL, 0x2bf11fb4L, 73 | 0x95dbda4dL, 0xae909198L, 0xeaad8e71L, 0x6b93d5a0L, 74 | 0xd08ed1d0L, 0xafc725e0L, 0x8e3c5b2fL, 0x8e7594b7L, 75 | 0x8ff6e2fbL, 0xf2122b64L, 0x8888b812L, 0x900df01cL, 76 | 0x4fad5ea0L, 0x688fc31cL, 0xd1cff191L, 0xb3a8c1adL, 77 | 0x2f2f2218L, 0xbe0e1777L, 0xea752dfeL, 0x8b021fa1L, 78 | 0xe5a0cc0fL, 0xb56f74e8L, 0x18acf3d6L, 0xce89e299L, 79 | 0xb4a84fe0L, 0xfd13e0b7L, 0x7cc43b81L, 0xd2ada8d9L, 80 | 0x165fa266L, 0x80957705L, 0x93cc7314L, 0x211a1477L, 81 | 0xe6ad2065L, 0x77b5fa86L, 0xc75442f5L, 0xfb9d35cfL, 82 | 0xebcdaf0cL, 0x7b3e89a0L, 0xd6411bd3L, 0xae1e7e49L, 83 | 0x00250e2dL, 0x2071b35eL, 0x226800bbL, 0x57b8e0afL, 84 | 0x2464369bL, 0xf009b91eL, 0x5563911dL, 0x59dfa6aaL, 85 | 0x78c14389L, 0xd95a537fL, 0x207d5ba2L, 0x02e5b9c5L, 86 | 0x83260376L, 0x6295cfa9L, 0x11c81968L, 0x4e734a41L, 87 | 0xb3472dcaL, 0x7b14a94aL, 0x1b510052L, 0x9a532915L, 88 | 0xd60f573fL, 0xbc9bc6e4L, 0x2b60a476L, 0x81e67400L, 89 | 0x08ba6fb5L, 0x571be91fL, 0xf296ec6bL, 0x2a0dd915L, 90 | 0xb6636521L, 0xe7b9f9b6L, 0xff34052eL, 0xc5855664L, 91 | 0x53b02d5dL, 0xa99f8fa1L, 0x08ba4799L, 0x6e85076aL 92 | }, 93 | { 94 | 0x4b7a70e9L, 0xb5b32944L, 0xdb75092eL, 0xc4192623L, 95 | 0xad6ea6b0L, 0x49a7df7dL, 0x9cee60b8L, 0x8fedb266L, 96 | 0xecaa8c71L, 0x699a17ffL, 0x5664526cL, 0xc2b19ee1L, 97 | 0x193602a5L, 0x75094c29L, 0xa0591340L, 0xe4183a3eL, 98 | 0x3f54989aL, 0x5b429d65L, 0x6b8fe4d6L, 0x99f73fd6L, 99 | 0xa1d29c07L, 0xefe830f5L, 0x4d2d38e6L, 0xf0255dc1L, 100 | 0x4cdd2086L, 0x8470eb26L, 0x6382e9c6L, 0x021ecc5eL, 101 | 0x09686b3fL, 0x3ebaefc9L, 0x3c971814L, 0x6b6a70a1L, 102 | 0x687f3584L, 0x52a0e286L, 0xb79c5305L, 0xaa500737L, 103 | 0x3e07841cL, 0x7fdeae5cL, 0x8e7d44ecL, 0x5716f2b8L, 104 | 0xb03ada37L, 0xf0500c0dL, 0xf01c1f04L, 0x0200b3ffL, 105 | 0xae0cf51aL, 0x3cb574b2L, 0x25837a58L, 0xdc0921bdL, 106 | 0xd19113f9L, 0x7ca92ff6L, 0x94324773L, 0x22f54701L, 107 | 0x3ae5e581L, 0x37c2dadcL, 0xc8b57634L, 0x9af3dda7L, 108 | 0xa9446146L, 0x0fd0030eL, 0xecc8c73eL, 0xa4751e41L, 109 | 0xe238cd99L, 0x3bea0e2fL, 0x3280bba1L, 0x183eb331L, 110 | 0x4e548b38L, 0x4f6db908L, 0x6f420d03L, 0xf60a04bfL, 111 | 0x2cb81290L, 0x24977c79L, 0x5679b072L, 0xbcaf89afL, 112 | 0xde9a771fL, 0xd9930810L, 0xb38bae12L, 0xdccf3f2eL, 113 | 0x5512721fL, 0x2e6b7124L, 0x501adde6L, 0x9f84cd87L, 114 | 0x7a584718L, 0x7408da17L, 0xbc9f9abcL, 0xe94b7d8cL, 115 | 0xec7aec3aL, 0xdb851dfaL, 0x63094366L, 0xc464c3d2L, 116 | 0xef1c1847L, 0x3215d908L, 0xdd433b37L, 0x24c2ba16L, 117 | 0x12a14d43L, 0x2a65c451L, 0x50940002L, 0x133ae4ddL, 118 | 0x71dff89eL, 0x10314e55L, 0x81ac77d6L, 0x5f11199bL, 119 | 0x043556f1L, 0xd7a3c76bL, 0x3c11183bL, 0x5924a509L, 120 | 0xf28fe6edL, 0x97f1fbfaL, 0x9ebabf2cL, 0x1e153c6eL, 121 | 0x86e34570L, 0xeae96fb1L, 0x860e5e0aL, 0x5a3e2ab3L, 122 | 0x771fe71cL, 0x4e3d06faL, 0x2965dcb9L, 0x99e71d0fL, 123 | 0x803e89d6L, 0x5266c825L, 0x2e4cc978L, 0x9c10b36aL, 124 | 0xc6150ebaL, 0x94e2ea78L, 0xa5fc3c53L, 0x1e0a2df4L, 125 | 0xf2f74ea7L, 0x361d2b3dL, 0x1939260fL, 0x19c27960L, 126 | 0x5223a708L, 0xf71312b6L, 0xebadfe6eL, 0xeac31f66L, 127 | 0xe3bc4595L, 0xa67bc883L, 0xb17f37d1L, 0x018cff28L, 128 | 0xc332ddefL, 0xbe6c5aa5L, 0x65582185L, 0x68ab9802L, 129 | 0xeecea50fL, 0xdb2f953bL, 0x2aef7dadL, 0x5b6e2f84L, 130 | 0x1521b628L, 0x29076170L, 0xecdd4775L, 0x619f1510L, 131 | 0x13cca830L, 0xeb61bd96L, 0x0334fe1eL, 0xaa0363cfL, 132 | 0xb5735c90L, 0x4c70a239L, 0xd59e9e0bL, 0xcbaade14L, 133 | 0xeecc86bcL, 0x60622ca7L, 0x9cab5cabL, 0xb2f3846eL, 134 | 0x648b1eafL, 0x19bdf0caL, 0xa02369b9L, 0x655abb50L, 135 | 0x40685a32L, 0x3c2ab4b3L, 0x319ee9d5L, 0xc021b8f7L, 136 | 0x9b540b19L, 0x875fa099L, 0x95f7997eL, 0x623d7da8L, 137 | 0xf837889aL, 0x97e32d77L, 0x11ed935fL, 0x16681281L, 138 | 0x0e358829L, 0xc7e61fd6L, 0x96dedfa1L, 0x7858ba99L, 139 | 0x57f584a5L, 0x1b227263L, 0x9b83c3ffL, 0x1ac24696L, 140 | 0xcdb30aebL, 0x532e3054L, 0x8fd948e4L, 0x6dbc3128L, 141 | 0x58ebf2efL, 0x34c6ffeaL, 0xfe28ed61L, 0xee7c3c73L, 142 | 0x5d4a14d9L, 0xe864b7e3L, 0x42105d14L, 0x203e13e0L, 143 | 0x45eee2b6L, 0xa3aaabeaL, 0xdb6c4f15L, 0xfacb4fd0L, 144 | 0xc742f442L, 0xef6abbb5L, 0x654f3b1dL, 0x41cd2105L, 145 | 0xd81e799eL, 0x86854dc7L, 0xe44b476aL, 0x3d816250L, 146 | 0xcf62a1f2L, 0x5b8d2646L, 0xfc8883a0L, 0xc1c7b6a3L, 147 | 0x7f1524c3L, 0x69cb7492L, 0x47848a0bL, 0x5692b285L, 148 | 0x095bbf00L, 0xad19489dL, 0x1462b174L, 0x23820e00L, 149 | 0x58428d2aL, 0x0c55f5eaL, 0x1dadf43eL, 0x233f7061L, 150 | 0x3372f092L, 0x8d937e41L, 0xd65fecf1L, 0x6c223bdbL, 151 | 0x7cde3759L, 0xcbee7460L, 0x4085f2a7L, 0xce77326eL, 152 | 0xa6078084L, 0x19f8509eL, 0xe8efd855L, 0x61d99735L, 153 | 0xa969a7aaL, 0xc50c06c2L, 0x5a04abfcL, 0x800bcadcL, 154 | 0x9e447a2eL, 0xc3453484L, 0xfdd56705L, 0x0e1e9ec9L, 155 | 0xdb73dbd3L, 0x105588cdL, 0x675fda79L, 0xe3674340L, 156 | 0xc5c43465L, 0x713e38d8L, 0x3d28f89eL, 0xf16dff20L, 157 | 0x153e21e7L, 0x8fb03d4aL, 0xe6e39f2bL, 0xdb83adf7L 158 | }, 159 | { 160 | 0xe93d5a68L, 0x948140f7L, 0xf64c261cL, 0x94692934L, 161 | 0x411520f7L, 0x7602d4f7L, 0xbcf46b2eL, 0xd4a20068L, 162 | 0xd4082471L, 0x3320f46aL, 0x43b7d4b7L, 0x500061afL, 163 | 0x1e39f62eL, 0x97244546L, 0x14214f74L, 0xbf8b8840L, 164 | 0x4d95fc1dL, 0x96b591afL, 0x70f4ddd3L, 0x66a02f45L, 165 | 0xbfbc09ecL, 0x03bd9785L, 0x7fac6dd0L, 0x31cb8504L, 166 | 0x96eb27b3L, 0x55fd3941L, 0xda2547e6L, 0xabca0a9aL, 167 | 0x28507825L, 0x530429f4L, 0x0a2c86daL, 0xe9b66dfbL, 168 | 0x68dc1462L, 0xd7486900L, 0x680ec0a4L, 0x27a18deeL, 169 | 0x4f3ffea2L, 0xe887ad8cL, 0xb58ce006L, 0x7af4d6b6L, 170 | 0xaace1e7cL, 0xd3375fecL, 0xce78a399L, 0x406b2a42L, 171 | 0x20fe9e35L, 0xd9f385b9L, 0xee39d7abL, 0x3b124e8bL, 172 | 0x1dc9faf7L, 0x4b6d1856L, 0x26a36631L, 0xeae397b2L, 173 | 0x3a6efa74L, 0xdd5b4332L, 0x6841e7f7L, 0xca7820fbL, 174 | 0xfb0af54eL, 0xd8feb397L, 0x454056acL, 0xba489527L, 175 | 0x55533a3aL, 0x20838d87L, 0xfe6ba9b7L, 0xd096954bL, 176 | 0x55a867bcL, 0xa1159a58L, 0xcca92963L, 0x99e1db33L, 177 | 0xa62a4a56L, 0x3f3125f9L, 0x5ef47e1cL, 0x9029317cL, 178 | 0xfdf8e802L, 0x04272f70L, 0x80bb155cL, 0x05282ce3L, 179 | 0x95c11548L, 0xe4c66d22L, 0x48c1133fL, 0xc70f86dcL, 180 | 0x07f9c9eeL, 0x41041f0fL, 0x404779a4L, 0x5d886e17L, 181 | 0x325f51ebL, 0xd59bc0d1L, 0xf2bcc18fL, 0x41113564L, 182 | 0x257b7834L, 0x602a9c60L, 0xdff8e8a3L, 0x1f636c1bL, 183 | 0x0e12b4c2L, 0x02e1329eL, 0xaf664fd1L, 0xcad18115L, 184 | 0x6b2395e0L, 0x333e92e1L, 0x3b240b62L, 0xeebeb922L, 185 | 0x85b2a20eL, 0xe6ba0d99L, 0xde720c8cL, 0x2da2f728L, 186 | 0xd0127845L, 0x95b794fdL, 0x647d0862L, 0xe7ccf5f0L, 187 | 0x5449a36fL, 0x877d48faL, 0xc39dfd27L, 0xf33e8d1eL, 188 | 0x0a476341L, 0x992eff74L, 0x3a6f6eabL, 0xf4f8fd37L, 189 | 0xa812dc60L, 0xa1ebddf8L, 0x991be14cL, 0xdb6e6b0dL, 190 | 0xc67b5510L, 0x6d672c37L, 0x2765d43bL, 0xdcd0e804L, 191 | 0xf1290dc7L, 0xcc00ffa3L, 0xb5390f92L, 0x690fed0bL, 192 | 0x667b9ffbL, 0xcedb7d9cL, 0xa091cf0bL, 0xd9155ea3L, 193 | 0xbb132f88L, 0x515bad24L, 0x7b9479bfL, 0x763bd6ebL, 194 | 0x37392eb3L, 0xcc115979L, 0x8026e297L, 0xf42e312dL, 195 | 0x6842ada7L, 0xc66a2b3bL, 0x12754cccL, 0x782ef11cL, 196 | 0x6a124237L, 0xb79251e7L, 0x06a1bbe6L, 0x4bfb6350L, 197 | 0x1a6b1018L, 0x11caedfaL, 0x3d25bdd8L, 0xe2e1c3c9L, 198 | 0x44421659L, 0x0a121386L, 0xd90cec6eL, 0xd5abea2aL, 199 | 0x64af674eL, 0xda86a85fL, 0xbebfe988L, 0x64e4c3feL, 200 | 0x9dbc8057L, 0xf0f7c086L, 0x60787bf8L, 0x6003604dL, 201 | 0xd1fd8346L, 0xf6381fb0L, 0x7745ae04L, 0xd736fcccL, 202 | 0x83426b33L, 0xf01eab71L, 0xb0804187L, 0x3c005e5fL, 203 | 0x77a057beL, 0xbde8ae24L, 0x55464299L, 0xbf582e61L, 204 | 0x4e58f48fL, 0xf2ddfda2L, 0xf474ef38L, 0x8789bdc2L, 205 | 0x5366f9c3L, 0xc8b38e74L, 0xb475f255L, 0x46fcd9b9L, 206 | 0x7aeb2661L, 0x8b1ddf84L, 0x846a0e79L, 0x915f95e2L, 207 | 0x466e598eL, 0x20b45770L, 0x8cd55591L, 0xc902de4cL, 208 | 0xb90bace1L, 0xbb8205d0L, 0x11a86248L, 0x7574a99eL, 209 | 0xb77f19b6L, 0xe0a9dc09L, 0x662d09a1L, 0xc4324633L, 210 | 0xe85a1f02L, 0x09f0be8cL, 0x4a99a025L, 0x1d6efe10L, 211 | 0x1ab93d1dL, 0x0ba5a4dfL, 0xa186f20fL, 0x2868f169L, 212 | 0xdcb7da83L, 0x573906feL, 0xa1e2ce9bL, 0x4fcd7f52L, 213 | 0x50115e01L, 0xa70683faL, 0xa002b5c4L, 0x0de6d027L, 214 | 0x9af88c27L, 0x773f8641L, 0xc3604c06L, 0x61a806b5L, 215 | 0xf0177a28L, 0xc0f586e0L, 0x006058aaL, 0x30dc7d62L, 216 | 0x11e69ed7L, 0x2338ea63L, 0x53c2dd94L, 0xc2c21634L, 217 | 0xbbcbee56L, 0x90bcb6deL, 0xebfc7da1L, 0xce591d76L, 218 | 0x6f05e409L, 0x4b7c0188L, 0x39720a3dL, 0x7c927c24L, 219 | 0x86e3725fL, 0x724d9db9L, 0x1ac15bb4L, 0xd39eb8fcL, 220 | 0xed545578L, 0x08fca5b5L, 0xd83d7cd3L, 0x4dad0fc4L, 221 | 0x1e50ef5eL, 0xb161e6f8L, 0xa28514d9L, 0x6c51133cL, 222 | 0x6fd5c7e7L, 0x56e14ec4L, 0x362abfceL, 0xddc6c837L, 223 | 0xd79a3234L, 0x92638212L, 0x670efa8eL, 0x406000e0L 224 | }, 225 | { 226 | 0x3a39ce37L, 0xd3faf5cfL, 0xabc27737L, 0x5ac52d1bL, 227 | 0x5cb0679eL, 0x4fa33742L, 0xd3822740L, 0x99bc9bbeL, 228 | 0xd5118e9dL, 0xbf0f7315L, 0xd62d1c7eL, 0xc700c47bL, 229 | 0xb78c1b6bL, 0x21a19045L, 0xb26eb1beL, 0x6a366eb4L, 230 | 0x5748ab2fL, 0xbc946e79L, 0xc6a376d2L, 0x6549c2c8L, 231 | 0x530ff8eeL, 0x468dde7dL, 0xd5730a1dL, 0x4cd04dc6L, 232 | 0x2939bbdbL, 0xa9ba4650L, 0xac9526e8L, 0xbe5ee304L, 233 | 0xa1fad5f0L, 0x6a2d519aL, 0x63ef8ce2L, 0x9a86ee22L, 234 | 0xc089c2b8L, 0x43242ef6L, 0xa51e03aaL, 0x9cf2d0a4L, 235 | 0x83c061baL, 0x9be96a4dL, 0x8fe51550L, 0xba645bd6L, 236 | 0x2826a2f9L, 0xa73a3ae1L, 0x4ba99586L, 0xef5562e9L, 237 | 0xc72fefd3L, 0xf752f7daL, 0x3f046f69L, 0x77fa0a59L, 238 | 0x80e4a915L, 0x87b08601L, 0x9b09e6adL, 0x3b3ee593L, 239 | 0xe990fd5aL, 0x9e34d797L, 0x2cf0b7d9L, 0x022b8b51L, 240 | 0x96d5ac3aL, 0x017da67dL, 0xd1cf3ed6L, 0x7c7d2d28L, 241 | 0x1f9f25cfL, 0xadf2b89bL, 0x5ad6b472L, 0x5a88f54cL, 242 | 0xe029ac71L, 0xe019a5e6L, 0x47b0acfdL, 0xed93fa9bL, 243 | 0xe8d3c48dL, 0x283b57ccL, 0xf8d56629L, 0x79132e28L, 244 | 0x785f0191L, 0xed756055L, 0xf7960e44L, 0xe3d35e8cL, 245 | 0x15056dd4L, 0x88f46dbaL, 0x03a16125L, 0x0564f0bdL, 246 | 0xc3eb9e15L, 0x3c9057a2L, 0x97271aecL, 0xa93a072aL, 247 | 0x1b3f6d9bL, 0x1e6321f5L, 0xf59c66fbL, 0x26dcf319L, 248 | 0x7533d928L, 0xb155fdf5L, 0x03563482L, 0x8aba3cbbL, 249 | 0x28517711L, 0xc20ad9f8L, 0xabcc5167L, 0xccad925fL, 250 | 0x4de81751L, 0x3830dc8eL, 0x379d5862L, 0x9320f991L, 251 | 0xea7a90c2L, 0xfb3e7bceL, 0x5121ce64L, 0x774fbe32L, 252 | 0xa8b6e37eL, 0xc3293d46L, 0x48de5369L, 0x6413e680L, 253 | 0xa2ae0810L, 0xdd6db224L, 0x69852dfdL, 0x09072166L, 254 | 0xb39a460aL, 0x6445c0ddL, 0x586cdecfL, 0x1c20c8aeL, 255 | 0x5bbef7ddL, 0x1b588d40L, 0xccd2017fL, 0x6bb4e3bbL, 256 | 0xdda26a7eL, 0x3a59ff45L, 0x3e350a44L, 0xbcb4cdd5L, 257 | 0x72eacea8L, 0xfa6484bbL, 0x8d6612aeL, 0xbf3c6f47L, 258 | 0xd29be463L, 0x542f5d9eL, 0xaec2771bL, 0xf64e6370L, 259 | 0x740e0d8dL, 0xe75b1357L, 0xf8721671L, 0xaf537d5dL, 260 | 0x4040cb08L, 0x4eb4e2ccL, 0x34d2466aL, 0x0115af84L, 261 | 0xe1b00428L, 0x95983a1dL, 0x06b89fb4L, 0xce6ea048L, 262 | 0x6f3f3b82L, 0x3520ab82L, 0x011a1d4bL, 0x277227f8L, 263 | 0x611560b1L, 0xe7933fdcL, 0xbb3a792bL, 0x344525bdL, 264 | 0xa08839e1L, 0x51ce794bL, 0x2f32c9b7L, 0xa01fbac9L, 265 | 0xe01cc87eL, 0xbcc7d1f6L, 0xcf0111c3L, 0xa1e8aac7L, 266 | 0x1a908749L, 0xd44fbd9aL, 0xd0dadecbL, 0xd50ada38L, 267 | 0x0339c32aL, 0xc6913667L, 0x8df9317cL, 0xe0b12b4fL, 268 | 0xf79e59b7L, 0x43f5bb3aL, 0xf2d519ffL, 0x27d9459cL, 269 | 0xbf97222cL, 0x15e6fc2aL, 0x0f91fc71L, 0x9b941525L, 270 | 0xfae59361L, 0xceb69cebL, 0xc2a86459L, 0x12baa8d1L, 271 | 0xb6c1075eL, 0xe3056a0cL, 0x10d25065L, 0xcb03a442L, 272 | 0xe0ec6e0eL, 0x1698db3bL, 0x4c98a0beL, 0x3278e964L, 273 | 0x9f1f9532L, 0xe0d392dfL, 0xd3a0342bL, 0x8971f21eL, 274 | 0x1b0a7441L, 0x4ba3348cL, 0xc5be7120L, 0xc37632d8L, 275 | 0xdf359f8dL, 0x9b992f2eL, 0xe60b6f47L, 0x0fe3f11dL, 276 | 0xe54cda54L, 0x1edad891L, 0xce6279cfL, 0xcd3e7e6fL, 277 | 0x1618b166L, 0xfd2c1d05L, 0x848fd2c5L, 0xf6fb2299L, 278 | 0xf523f357L, 0xa6327623L, 0x93a83531L, 0x56cccd02L, 279 | 0xacf08162L, 0x5a75ebb5L, 0x6e163697L, 0x88d273ccL, 280 | 0xde966292L, 0x81b949d0L, 0x4c50901bL, 0x71c65614L, 281 | 0xe6c6c7bdL, 0x327a140aL, 0x45e1d006L, 0xc3f27b9aL, 282 | 0xc9aa53fdL, 0x62a80f00L, 0xbb25bfe2L, 0x35bdd2f6L, 283 | 0x71126905L, 0xb2040222L, 0xb6cbcf7cL, 0xcd769c2bL, 284 | 0x53113ec0L, 0x1640e3d3L, 0x38abbd60L, 0x2547adf0L, 285 | 0xba38209cL, 0xf746ce76L, 0x77afa1c5L, 0x20756060L, 286 | 0x85cbfe4eL, 0x8ae88dd8L, 0x7aaaf9b0L, 0x4cf9aa7eL, 287 | 0x1948c25cL, 0x02fb8a8cL, 0x01c36ae4L, 0xd6ebe1f9L, 288 | 0x90d4f869L, 0xa65cdea0L, 0x3f09252dL, 0xc208e69fL, 289 | 0xb74e6132L, 0xce77e25bL, 0x578fdfe3L, 0x3ac372e6L 290 | } 291 | }; 292 | 293 | #endif // _BLOWFISH_H_ 294 | -------------------------------------------------------------------------------- /crc32.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "bfcrypt.h" 16 | #include "crc32.h" 17 | 18 | int find_crc32(char *base, size_t offset) 19 | { 20 | int found; 21 | 22 | found = find_crc32_poly(base + offset); 23 | 24 | if (found >= 0) 25 | { 26 | printf("%s (0x%08x) found at 0x%08lx\n", CRC32_TABLE[0].desc, CRC32_TABLE[0].poly, (unsigned long) offset); 27 | } 28 | 29 | return 0; 30 | } 31 | 32 | int find_crc32_poly(char *p) 33 | { 34 | int ret = -1; 35 | unsigned int i; 36 | 37 | for (i = 0; i < sizeof(CRC32_TABLE) / sizeof(CRC32_TABLE[0]); i++) 38 | { 39 | if (memcmp(&CRC32_TABLE[i].poly, p, sizeof(CRC32_TABLE[0].poly)) == 0) 40 | { 41 | ret = i; 42 | break; 43 | } 44 | } 45 | 46 | return ret; 47 | } 48 | -------------------------------------------------------------------------------- /crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #ifndef _CRC32_H_ 10 | #define _CRC32_H_ 11 | 12 | /* 13 | * http://en.wikipedia.org/wiki/Cyclic_redundancy_check 14 | */ 15 | 16 | int find_crc32(char *base, size_t offset); 17 | int find_crc32_poly(char *p); 18 | 19 | typedef struct _crc32 { 20 | char *desc; 21 | uint32_t poly; 22 | } crc32; 23 | 24 | static crc32 CRC32_TABLE[8] = 25 | { 26 | { "CRC-32-IEEE 802.3", 0x04c11db7L}, 27 | { "CRC-32-IEEE 802.3 (reversed)", 0xedb88320L}, 28 | { "CRC-32C (Castagnoli)", 0x1edc6f41L}, 29 | { "CRC-32C (Castagnoli) (reversed)", 0x82f63b78L}, 30 | { "CRC-32K (Koopman)", 0x741b8cd7L}, 31 | { "CRC-32K (Koopman) (reversed)", 0xeb31d82eL}, 32 | { "CRC-32Q", 0x814141abL}, 33 | { "CRC-32Q (reversed)", 0xd5828281L} 34 | }; 35 | 36 | #endif // _CRC32_H_ 37 | -------------------------------------------------------------------------------- /des.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "bfcrypt.h" 16 | #include "des.h" 17 | 18 | int find_des(char *base, size_t offset) 19 | { 20 | unsigned int i; 21 | 22 | for (i = 0; i < 2; i++) 23 | { 24 | if (find_des_keyswap(base + offset, i) == 0) 25 | { 26 | printf("DES Keyswap (0x%08x) found at 0x%08lx\n", DES_KEYSWAP[i][0], (unsigned long) offset); 27 | } 28 | } 29 | 30 | for (i = 0; i < 8; i++) 31 | { 32 | if (find_des_sbox(base + offset, i) == 0) 33 | { 34 | printf("DES S-box[%d] (0x%08x) found at 0x%08lx\n", i, DES_SBOX[i][0], (unsigned long) offset); 35 | } 36 | } 37 | 38 | return 0; 39 | } 40 | 41 | int find_des_keyswap(char *p, int n) 42 | { 43 | int ret = -1; 44 | unsigned int i; 45 | 46 | if (memcmp(DES_KEYSWAP[n], p, sizeof(DES_KEYSWAP[n][0])) == 0) 47 | { 48 | ret = 0; 49 | 50 | for (i = 0; i < sizeof(DES_KEYSWAP[n]) / sizeof(DES_KEYSWAP[n][0]); i++) 51 | { 52 | if (memcmp(&(DES_KEYSWAP[n][i]), p + i * sizeof(DES_KEYSWAP[n][0]), sizeof(DES_KEYSWAP[n][0])) != 0) 53 | { 54 | ret = -1; 55 | } 56 | } 57 | } 58 | 59 | return ret; 60 | } 61 | 62 | int find_des_sbox(char *p, int n) 63 | { 64 | int ret = -1; 65 | unsigned int i; 66 | 67 | if (memcmp(DES_SBOX[n], p, sizeof(DES_SBOX[n][0])) == 0) 68 | { 69 | ret = 0; 70 | 71 | for (i = 0; i < sizeof(DES_SBOX[n]) / sizeof(DES_SBOX[n][0]); i++) 72 | { 73 | if (memcmp(&(DES_SBOX[n][i]), p + i * sizeof(DES_SBOX[n][0]), sizeof(DES_SBOX[n][0])) != 0) 74 | { 75 | ret = -1; 76 | } 77 | } 78 | } 79 | 80 | return ret; 81 | } 82 | -------------------------------------------------------------------------------- /des.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #ifndef _DES_H_ 10 | #define _DES_H_ 11 | 12 | /* 13 | * http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf 14 | */ 15 | 16 | int find_des(char *base, size_t offset); 17 | int find_des_keyswap(char *p, int n); 18 | int find_des_sbox(char *p, int n); 19 | 20 | static uint32_t DES_KEYSWAP[2][16] = 21 | { 22 | { 23 | 0x00000000L, 0x00000001L, 0x00000100L, 0x00000101L, 24 | 0x00010000L, 0x00010001L, 0x00010100L, 0x00010101L, 25 | 0x01000000L, 0x01000001L, 0x01000100L, 0x01000101L, 26 | 0x01010000L, 0x01010001L, 0x01010100L, 0x01010101L 27 | }, 28 | { 29 | 0x00000000L, 0x01000000L, 0x00010000L, 0x01010000L, 30 | 0x00000100L, 0x01000100L, 0x00010100L, 0x01010100L, 31 | 0x00000001L, 0x01000001L, 0x00010001L, 0x01010001L, 32 | 0x00000101L, 0x01000101L, 0x00010101L, 0x01010101L 33 | } 34 | }; 35 | 36 | static uint32_t DES_SBOX[8][64] = 37 | { 38 | { 39 | 0x01010400, 0x00000000, 0x00010000, 0x01010404, 40 | 0x01010004, 0x00010404, 0x00000004, 0x00010000, 41 | 0x00000400, 0x01010400, 0x01010404, 0x00000400, 42 | 0x01000404, 0x01010004, 0x01000000, 0x00000004, 43 | 0x00000404, 0x01000400, 0x01000400, 0x00010400, 44 | 0x00010400, 0x01010000, 0x01010000, 0x01000404, 45 | 0x00010004, 0x01000004, 0x01000004, 0x00010004, 46 | 0x00000000, 0x00000404, 0x00010404, 0x01000000, 47 | 0x00010000, 0x01010404, 0x00000004, 0x01010000, 48 | 0x01010400, 0x01000000, 0x01000000, 0x00000400, 49 | 0x01010004, 0x00010000, 0x00010400, 0x01000004, 50 | 0x00000400, 0x00000004, 0x01000404, 0x00010404, 51 | 0x01010404, 0x00010004, 0x01010000, 0x01000404, 52 | 0x01000004, 0x00000404, 0x00010404, 0x01010400, 53 | 0x00000404, 0x01000400, 0x01000400, 0x00000000, 54 | 0x00010004, 0x00010400, 0x00000000, 0x01010004 55 | }, 56 | { 57 | 0x80108020, 0x80008000, 0x00008000, 0x00108020, 58 | 0x00100000, 0x00000020, 0x80100020, 0x80008020, 59 | 0x80000020, 0x80108020, 0x80108000, 0x80000000, 60 | 0x80008000, 0x00100000, 0x00000020, 0x80100020, 61 | 0x00108000, 0x00100020, 0x80008020, 0x00000000, 62 | 0x80000000, 0x00008000, 0x00108020, 0x80100000, 63 | 0x00100020, 0x80000020, 0x00000000, 0x00108000, 64 | 0x00008020, 0x80108000, 0x80100000, 0x00008020, 65 | 0x00000000, 0x00108020, 0x80100020, 0x00100000, 66 | 0x80008020, 0x80100000, 0x80108000, 0x00008000, 67 | 0x80100000, 0x80008000, 0x00000020, 0x80108020, 68 | 0x00108020, 0x00000020, 0x00008000, 0x80000000, 69 | 0x00008020, 0x80108000, 0x00100000, 0x80000020, 70 | 0x00100020, 0x80008020, 0x80000020, 0x00100020, 71 | 0x00108000, 0x00000000, 0x80008000, 0x00008020, 72 | 0x80000000, 0x80100020, 0x80108020, 0x00108000 73 | }, 74 | { 75 | 0x00000208, 0x08020200, 0x00000000, 0x08020008, 76 | 0x08000200, 0x00000000, 0x00020208, 0x08000200, 77 | 0x00020008, 0x08000008, 0x08000008, 0x00020000, 78 | 0x08020208, 0x00020008, 0x08020000, 0x00000208, 79 | 0x08000000, 0x00000008, 0x08020200, 0x00000200, 80 | 0x00020200, 0x08020000, 0x08020008, 0x00020208, 81 | 0x08000208, 0x00020200, 0x00020000, 0x08000208, 82 | 0x00000008, 0x08020208, 0x00000200, 0x08000000, 83 | 0x08020200, 0x08000000, 0x00020008, 0x00000208, 84 | 0x00020000, 0x08020200, 0x08000200, 0x00000000, 85 | 0x00000200, 0x00020008, 0x08020208, 0x08000200, 86 | 0x08000008, 0x00000200, 0x00000000, 0x08020008, 87 | 0x08000208, 0x00020000, 0x08000000, 0x08020208, 88 | 0x00000008, 0x00020208, 0x00020200, 0x08000008, 89 | 0x08020000, 0x08000208, 0x00000208, 0x08020000, 90 | 0x00020208, 0x00000008, 0x08020008, 0x00020200 91 | }, 92 | { 93 | 0x00802001, 0x00002081, 0x00002081, 0x00000080, 94 | 0x00802080, 0x00800081, 0x00800001, 0x00002001, 95 | 0x00000000, 0x00802000, 0x00802000, 0x00802081, 96 | 0x00000081, 0x00000000, 0x00800080, 0x00800001, 97 | 0x00000001, 0x00002000, 0x00800000, 0x00802001, 98 | 0x00000080, 0x00800000, 0x00002001, 0x00002080, 99 | 0x00800081, 0x00000001, 0x00002080, 0x00800080, 100 | 0x00002000, 0x00802080, 0x00802081, 0x00000081, 101 | 0x00800080, 0x00800001, 0x00802000, 0x00802081, 102 | 0x00000081, 0x00000000, 0x00000000, 0x00802000, 103 | 0x00002080, 0x00800080, 0x00800081, 0x00000001, 104 | 0x00802001, 0x00002081, 0x00002081, 0x00000080, 105 | 0x00802081, 0x00000081, 0x00000001, 0x00002000, 106 | 0x00800001, 0x00002001, 0x00802080, 0x00800081, 107 | 0x00002001, 0x00002080, 0x00800000, 0x00802001, 108 | 0x00000080, 0x00800000, 0x00002000, 0x00802080 109 | }, 110 | { 111 | 0x00000100, 0x02080100, 0x02080000, 0x42000100, 112 | 0x00080000, 0x00000100, 0x40000000, 0x02080000, 113 | 0x40080100, 0x00080000, 0x02000100, 0x40080100, 114 | 0x42000100, 0x42080000, 0x00080100, 0x40000000, 115 | 0x02000000, 0x40080000, 0x40080000, 0x00000000, 116 | 0x40000100, 0x42080100, 0x42080100, 0x02000100, 117 | 0x42080000, 0x40000100, 0x00000000, 0x42000000, 118 | 0x02080100, 0x02000000, 0x42000000, 0x00080100, 119 | 0x00080000, 0x42000100, 0x00000100, 0x02000000, 120 | 0x40000000, 0x02080000, 0x42000100, 0x40080100, 121 | 0x02000100, 0x40000000, 0x42080000, 0x02080100, 122 | 0x40080100, 0x00000100, 0x02000000, 0x42080000, 123 | 0x42080100, 0x00080100, 0x42000000, 0x42080100, 124 | 0x02080000, 0x00000000, 0x40080000, 0x42000000, 125 | 0x00080100, 0x02000100, 0x40000100, 0x00080000, 126 | 0x00000000, 0x40080000, 0x02080100, 0x40000100 127 | }, 128 | { 129 | 0x20000010, 0x20400000, 0x00004000, 0x20404010, 130 | 0x20400000, 0x00000010, 0x20404010, 0x00400000, 131 | 0x20004000, 0x00404010, 0x00400000, 0x20000010, 132 | 0x00400010, 0x20004000, 0x20000000, 0x00004010, 133 | 0x00000000, 0x00400010, 0x20004010, 0x00004000, 134 | 0x00404000, 0x20004010, 0x00000010, 0x20400010, 135 | 0x20400010, 0x00000000, 0x00404010, 0x20404000, 136 | 0x00004010, 0x00404000, 0x20404000, 0x20000000, 137 | 0x20004000, 0x00000010, 0x20400010, 0x00404000, 138 | 0x20404010, 0x00400000, 0x00004010, 0x20000010, 139 | 0x00400000, 0x20004000, 0x20000000, 0x00004010, 140 | 0x20000010, 0x20404010, 0x00404000, 0x20400000, 141 | 0x00404010, 0x20404000, 0x00000000, 0x20400010, 142 | 0x00000010, 0x00004000, 0x20400000, 0x00404010, 143 | 0x00004000, 0x00400010, 0x20004010, 0x00000000, 144 | 0x20404000, 0x20000000, 0x00400010, 0x20004010 145 | }, 146 | { 147 | 0x00200000, 0x04200002, 0x04000802, 0x00000000, 148 | 0x00000800, 0x04000802, 0x00200802, 0x04200800, 149 | 0x04200802, 0x00200000, 0x00000000, 0x04000002, 150 | 0x00000002, 0x04000000, 0x04200002, 0x00000802, 151 | 0x04000800, 0x00200802, 0x00200002, 0x04000800, 152 | 0x04000002, 0x04200000, 0x04200800, 0x00200002, 153 | 0x04200000, 0x00000800, 0x00000802, 0x04200802, 154 | 0x00200800, 0x00000002, 0x04000000, 0x00200800, 155 | 0x04000000, 0x00200800, 0x00200000, 0x04000802, 156 | 0x04000802, 0x04200002, 0x04200002, 0x00000002, 157 | 0x00200002, 0x04000000, 0x04000800, 0x00200000, 158 | 0x04200800, 0x00000802, 0x00200802, 0x04200800, 159 | 0x00000802, 0x04000002, 0x04200802, 0x04200000, 160 | 0x00200800, 0x00000000, 0x00000002, 0x04200802, 161 | 0x00000000, 0x00200802, 0x04200000, 0x00000800, 162 | 0x04000002, 0x04000800, 0x00000800, 0x00200002 163 | }, 164 | { 165 | 0x10001040, 0x00001000, 0x00040000, 0x10041040, 166 | 0x10000000, 0x10001040, 0x00000040, 0x10000000, 167 | 0x00040040, 0x10040000, 0x10041040, 0x00041000, 168 | 0x10041000, 0x00041040, 0x00001000, 0x00000040, 169 | 0x10040000, 0x10000040, 0x10001000, 0x00001040, 170 | 0x00041000, 0x00040040, 0x10040040, 0x10041000, 171 | 0x00001040, 0x00000000, 0x00000000, 0x10040040, 172 | 0x10000040, 0x10001000, 0x00041040, 0x00040000, 173 | 0x00041040, 0x00040000, 0x10041000, 0x00001000, 174 | 0x00000040, 0x10040040, 0x00001000, 0x00041040, 175 | 0x10001000, 0x00000040, 0x10000040, 0x10040000, 176 | 0x10040040, 0x10000000, 0x00040000, 0x10001040, 177 | 0x00000000, 0x10041040, 0x00040040, 0x10000040, 178 | 0x10040000, 0x10001000, 0x10001040, 0x00000000, 179 | 0x10041040, 0x00041000, 0x00041000, 0x00001040, 180 | 0x00001040, 0x00040040, 0x10000000, 0x10041000 181 | } 182 | }; 183 | 184 | #endif // _DES_H_ 185 | -------------------------------------------------------------------------------- /md5.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "bfcrypt.h" 16 | #include "md5.h" 17 | 18 | int find_md5(char *base, size_t offset) 19 | { 20 | if (find_md5_digest(base + offset) == 0) 21 | { 22 | printf("MD Digest (0x%08x) found at 0x%08lx\n", MD5_DIGEST[0], (unsigned long) offset); 23 | } 24 | 25 | if (find_md5_constants(base + offset) == 0) 26 | { 27 | printf("MD5 Constants (0x%08x) found at 0x%08lx\n", MD5_CONSTANTS[0], (unsigned long) offset); 28 | } 29 | 30 | return 0; 31 | } 32 | 33 | int find_md5_digest(char *p) 34 | { 35 | int ret = -1; 36 | unsigned int i; 37 | 38 | if (memcmp(MD5_DIGEST, p, sizeof(MD5_DIGEST[0])) == 0) 39 | { 40 | ret = 0; 41 | 42 | for (i = 0; i < sizeof(MD5_DIGEST) / sizeof(MD5_DIGEST[0]); i++) 43 | { 44 | if (memcmp(&MD5_DIGEST[i], p + i * sizeof(MD5_DIGEST[0]), sizeof(MD5_DIGEST[0])) != 0) 45 | { 46 | ret = -1; 47 | } 48 | } 49 | } 50 | 51 | return ret; 52 | } 53 | 54 | int find_md5_constants(char *p) 55 | { 56 | int ret = -1; 57 | unsigned int i; 58 | 59 | if (memcmp(MD5_CONSTANTS, p, sizeof(MD5_CONSTANTS[0])) == 0) 60 | { 61 | ret = 0; 62 | 63 | for (i = 0; i < sizeof(MD5_CONSTANTS) / sizeof(MD5_CONSTANTS[0]); i++) 64 | { 65 | if (memcmp(&MD5_CONSTANTS[i], p + i * sizeof(MD5_CONSTANTS[0]), sizeof(MD5_CONSTANTS[0])) != 0) 66 | { 67 | ret = -1; 68 | } 69 | } 70 | } 71 | 72 | return ret; 73 | } 74 | -------------------------------------------------------------------------------- /md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #ifndef _MD5_H_ 10 | #define _MD5_H_ 11 | 12 | int find_md5(char *base, size_t offset); 13 | int find_md5_digest(char *p); 14 | int find_md5_constants(char *p); 15 | 16 | static uint32_t MD5_DIGEST[4] = 17 | { 18 | 0x67452301L, 0xefcdab89L, 0x98badcfeL, 0x10325476L 19 | }; 20 | 21 | static uint32_t MD5_CONSTANTS[64] = 22 | { 23 | /* round 1 */ 24 | 0xd76aa478L, 0xe8c7b756L, 0x242070dbL, 0xc1bdceeeL, 25 | 0xf57c0fafL, 0x4787c62aL, 0xa8304613L, 0xfd469501L, 26 | 0x698098d8L, 0x8b44f7afL, 0xffff5bb1L, 0x895cd7beL, 27 | 0x6b901122L, 0xfd987193L, 0xa679438eL, 0x49b40821L, 28 | /* round 2 */ 29 | 0xf61e2562L, 0xc040b340L, 0x265e5a51L, 0xe9b6c7aaL, 30 | 0xd62f105dL, 0x2441453L, 0xd8a1e681L, 0xe7d3fbc8L, 31 | 0x21e1cde6L, 0xc33707d6L, 0xf4d50d87L, 0x455a14edL, 32 | 0xa9e3e905L, 0xfcefa3f8L, 0x676f02d9L, 0x8d2a4c8aL, 33 | /* round 3 */ 34 | 0xfffa3942L, 0x8771f681L, 0x6d9d6122L, 0xfde5380cL, 35 | 0xa4beea44L, 0x4bdecfa9L, 0xf6bb4b60L, 0xbebfbc70L, 36 | 0x289b7ec6L, 0xeaa127faL, 0xd4ef3085L, 0x4881d05L, 37 | 0xd9d4d039L, 0xe6db99e5L, 0x1fa27cf8L, 0xc4ac5665L, 38 | /* round 4 */ 39 | 0xf4292244L, 0x432aff97L, 0xab9423a7L, 0xfc93a039L, 40 | 0x655b59c3L, 0x8f0ccc92L, 0xffeff47dL, 0x85845dd1L, 41 | 0x6fa87e4fL, 0xfe2ce6e0L, 0xa3014314L, 0x4e0811a1L, 42 | 0xf7537e82L, 0xbd3af235L, 0x2ad7d2bbL, 0xeb86d391L 43 | }; 44 | 45 | #endif // _MD5_H_ 46 | -------------------------------------------------------------------------------- /sha256.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "bfcrypt.h" 16 | #include "sha256.h" 17 | 18 | int find_sha256(char *base, size_t offset) 19 | { 20 | if (find_sha256_init(base + offset) == 0) 21 | { 22 | printf("SHA256 Init (0x%08x) found at 0x%08lx\n", SHA256_INIT[0], (unsigned long) offset); 23 | } 24 | 25 | if (find_sha256_constants(base + offset) == 0) 26 | { 27 | printf("SHA256 Constants (0x%08x) found at 0x%08lx\n", SHA256_CONSTANTS[0], (unsigned long) offset); 28 | } 29 | 30 | return 0; 31 | } 32 | 33 | int find_sha256_init(char *p) 34 | { 35 | int ret = -1; 36 | unsigned int i; 37 | 38 | if (memcmp(SHA256_INIT, p, sizeof(SHA256_INIT[0])) == 0) 39 | { 40 | ret = 0; 41 | 42 | for (i = 0; i < sizeof(SHA256_INIT) / sizeof(SHA256_INIT[0]); i++) 43 | { 44 | if (memcmp(&SHA256_INIT[i], p + i * sizeof(SHA256_INIT[0]), sizeof(SHA256_INIT[0])) != 0) 45 | { 46 | ret = -1; 47 | } 48 | } 49 | } 50 | 51 | return ret; 52 | } 53 | 54 | int find_sha256_constants(char *p) 55 | { 56 | int ret = -1; 57 | unsigned int i; 58 | 59 | if (memcmp(SHA256_CONSTANTS, p, sizeof(SHA256_CONSTANTS[0])) == 0) 60 | { 61 | ret = 0; 62 | 63 | for (i = 0; i < sizeof(SHA256_CONSTANTS) / sizeof(SHA256_CONSTANTS[0]); i++) 64 | { 65 | if (memcmp(&SHA256_CONSTANTS[i], p + i * sizeof(SHA256_CONSTANTS[0]), sizeof(SHA256_CONSTANTS[0])) != 0) 66 | { 67 | ret = -1; 68 | } 69 | } 70 | } 71 | 72 | return ret; 73 | } 74 | -------------------------------------------------------------------------------- /sha256.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 3 | * 4 | * This is free software, licensed under the GNU General Public License v2. 5 | * See /LICENSE for more information. 6 | * 7 | */ 8 | 9 | #ifndef _SHA256_H_ 10 | #define _SHA256_H_ 11 | 12 | /* 13 | * http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf 14 | */ 15 | 16 | int find_sha256(char *base, size_t offset); 17 | int find_sha256_init(char *p); 18 | int find_sha256_constants(char *p); 19 | 20 | /* 21 | * Initial hash value. These words were obtained by taking the first 22 | * thirty-two bits of the fractional parts of the square roots of the 23 | * first eight prime numbers. 24 | */ 25 | static uint32_t SHA256_INIT[8] = 26 | { 27 | 0x6a09e667L, 0xbb67ae85L, 0x3c6ef372L, 0xa54ff53aL, 28 | 0x510e527fL, 0x9b05688cL, 0x1f83d9abL, 0x5be0cd19L 29 | }; 30 | 31 | /* 32 | * Sequence of sixty-four constants. These words represent the first 33 | * thirty-two bits of the fractional parts of the cube roots of the 34 | * first sixty-four prime numbers. 35 | */ 36 | static uint32_t SHA256_CONSTANTS[64] = 37 | { 38 | 0x428a2f98L, 0x71374491L, 0xb5c0fbcfL, 0xe9b5dba5L, 39 | 0x3956c25bL, 0x59f111f1L, 0x923f82a4L, 0xab1c5ed5L, 40 | 0xd807aa98L, 0x12835b01L, 0x243185beL, 0x550c7dc3L, 41 | 0x72be5d74L, 0x80deb1feL, 0x9bdc06a7L, 0xc19bf174L, 42 | 0xe49b69c1L, 0xefbe4786L, 0x0fc19dc6L, 0x240ca1ccL, 43 | 0x2de92c6fL, 0x4a7484aaL, 0x5cb0a9dcL, 0x76f988daL, 44 | 0x983e5152L, 0xa831c66dL, 0xb00327c8L, 0xbf597fc7L, 45 | 0xc6e00bf3L, 0xd5a79147L, 0x06ca6351L, 0x14292967L, 46 | 0x27b70a85L, 0x2e1b2138L, 0x4d2c6dfcL, 0x53380d13L, 47 | 0x650a7354L, 0x766a0abbL, 0x81c2c92eL, 0x92722c85L, 48 | 0xa2bfe8a1L, 0xa81a664bL, 0xc24b8b70L, 0xc76c51a3L, 49 | 0xd192e819L, 0xd6990624L, 0xf40e3585L, 0x106aa070L, 50 | 0x19a4c116L, 0x1e376c08L, 0x2748774cL, 0x34b0bcb5L, 51 | 0x391c0cb3L, 0x4ed8aa4aL, 0x5b9cca4fL, 0x682e6ff3L, 52 | 0x748f82eeL, 0x78a5636fL, 0x84c87814L, 0x8cc70208L, 53 | 0x90befffaL, 0xa4506cebL, 0xbef9a3f7L, 0xc67178f2L 54 | }; 55 | 56 | #endif // _SHA256_H_ 57 | --------------------------------------------------------------------------------