engine.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. /**
  2. * Author......: Jens Steube <jens.steube@gmail.com>
  3. * License.....: MIT
  4. */
  5. #ifndef ENGINE_H
  6. #define ENGINE_H
  7. #define INCR_RULES_PTR 100000
  8. #define INCR_WORDS_PTR 1000000
  9. #define INCR_SALT_PTR 10000
  10. #define INCR_POT 100000
  11. #define INCR_INDEX_PTR 1
  12. #define INCR_DIGEST_PTR 1
  13. #define INCR_MASK_PTR 1000
  14. #define INDEX_BITS 8
  15. #define DIGEST_SIZE_MD5 4 * 4
  16. #define DIGEST_SIZE_SHA1 5 * 4
  17. #define DIGEST_SIZE_MYSQL 2 * 4
  18. #define DIGEST_SIZE_MD4 4 * 4
  19. #define DIGEST_SIZE_SHA256 8 * 4
  20. #define DIGEST_SIZE_SHA512 8 * 8
  21. #define DIGEST_SIZE_DESCRYPT 2 * 4
  22. #define DIGEST_SIZE_KECCAK 25 * 8
  23. #define DIGEST_SIZE_NETNTLMv1 6 * 4
  24. #define DIGEST_SIZE_GOST 8 * 4
  25. #define DIGEST_SIZE_BCRYPT 6 * 4
  26. #define DIGEST_SIZE_PLAIN 55
  27. #define HASH_SIZE_MD5 32
  28. #define HASH_SIZE_SHA1 40
  29. #define HASH_SIZE_MYSQL 16
  30. #define HASH_SIZE_PHPASS 22
  31. #define HASH_SIZE_MD5UNIX 22
  32. #define HASH_SIZE_SHA1B64 28
  33. #define HASH_SIZE_MD4 32
  34. #define HASH_SIZE_MD5CHAP 32
  35. #define HASH_SIZE_MSSQL2000 80
  36. #define HASH_SIZE_MSSQL2005 40
  37. #define HASH_SIZE_SHA256 64
  38. #define HASH_SIZE_MD5APR 22
  39. #define HASH_SIZE_SHA512 128
  40. #define HASH_SIZE_SHA512UNIX 86
  41. #define HASH_SIZE_MD5SUN 22
  42. #define HASH_SIZE_OSX1 40
  43. #define HASH_SIZE_OSX512 128
  44. #define HASH_SIZE_MSSQL2012 128
  45. #define HASH_SIZE_DESCRYPT 11
  46. #define HASH_SIZE_KECCAK_MIN 1
  47. #define HASH_SIZE_KECCAK_MAX 200
  48. #define HASH_SIZE_EPIV6_MIN 27
  49. #define HASH_SIZE_EPIV6_MAX 27
  50. #define HASH_SIZE_VS2012_MIN 44
  51. #define HASH_SIZE_VS2012_MAX 44
  52. #define HASH_SIZE_IKEPSK_MD5_MIN 48
  53. #define HASH_SIZE_IKEPSK_MD5_MAX 1024
  54. #define HASH_SIZE_IKEPSK_SHA1_MIN 56
  55. #define HASH_SIZE_IKEPSK_SHA1_MAX 1024
  56. #define HASH_SIZE_NETNTLMv1 48
  57. #define HASH_SIZE_NETNTLMv2 32
  58. #define HASH_SIZE_CISCO_SECRET4 43
  59. #define HASH_SIZE_MD5AIX 22
  60. #define HASH_SIZE_SHA1AIX 27
  61. #define HASH_SIZE_SHA256AIX 43
  62. #define HASH_SIZE_SHA512AIX 86
  63. #define HASH_SIZE_GOST 64
  64. #define HASH_SIZE_SHA1FORTIGATE 40
  65. #define HASH_SIZE_PBKDF2OSX 128
  66. #define HASH_SIZE_PBKDF2GRUB 128
  67. #define HASH_SIZE_MD5CISCO 16
  68. #define HASH_SIZE_SHA1ORACLE 40
  69. #define HASH_SIZE_BCRYPT 31
  70. #define HASH_SIZE_HMACRAKP 40
  71. #define HASH_SIZE_SHA256UNIX 43
  72. #define HASH_SIZE_EPIV6_4_MIN 43
  73. #define HASH_SIZE_EPIV6_4_MAX 43
  74. #define HASH_SIZE_SHA512B64 86
  75. #define HASH_SIZE_EPIV4_MIN 40
  76. #define HASH_SIZE_EPIV4_MAX 40
  77. #define HASH_SIZE_SCRYPT_MIN 44
  78. #define HASH_SIZE_SCRYPT_MAX 44
  79. #define HASH_SIZE_CISCO_SECRET9 43
  80. #define HASH_SIZE_DJANGOSHA1_MIN 40
  81. #define HASH_SIZE_DJANGOSHA1_MAX 40
  82. #define HASH_SIZE_HMAIL 64
  83. #define HASH_SIZE_MEDIAWIKI_B_MIN 32
  84. #define HASH_SIZE_MEDIAWIKI_B_MAX 32
  85. #define HASH_SIZE_CISCO_SECRET8 43
  86. #define HASH_SIZE_DJANGO_SHA256 44
  87. #define HASH_SIZE_PEOPLESOFT 28
  88. #define HASH_SIZE_CRAM_MD5_MIN 44
  89. #define HASH_SIZE_CRAM_MD5_MAX 132
  90. #define HASH_SIZE_DRUPAL7 43
  91. #define HASH_SIZE_SAP_H_MIN 33
  92. #define HASH_SIZE_SAP_H_MAX 49
  93. #define HASH_SIZE_SHA256B64 44
  94. #define HASH_SIZE_PLAIN 55
  95. #define HASH_TYPE_MD5 1
  96. #define HASH_TYPE_SHA1 2
  97. #define HASH_TYPE_MYSQL 3
  98. #define HASH_TYPE_PHPASS 4
  99. #define HASH_TYPE_MD5UNIX 5
  100. #define HASH_TYPE_SHA1B64 6
  101. #define HASH_TYPE_SHA1B64S 7
  102. #define HASH_TYPE_MD4 9
  103. #define HASH_TYPE_DCC 10
  104. #define HASH_TYPE_MD5CHAP 11
  105. #define HASH_TYPE_MSSQL2000 12
  106. #define HASH_TYPE_SHA256 13
  107. #define HASH_TYPE_MD5APR 14
  108. #define HASH_TYPE_SHA512 15
  109. #define HASH_TYPE_SHA512UNIX 16
  110. #define HASH_TYPE_MD5SUN 17
  111. #define HASH_TYPE_OSX1 18
  112. #define HASH_TYPE_OSX512 19
  113. #define HASH_TYPE_MSSQL2012 20
  114. #define HASH_TYPE_DESCRYPT 21
  115. #define HASH_TYPE_KECCAK 22
  116. #define HASH_TYPE_EPIV6 23
  117. #define HASH_TYPE_VS2012 24
  118. #define HASH_TYPE_PSAFE3 25
  119. #define HASH_TYPE_IKEPSK_MD5 26
  120. #define HASH_TYPE_IKEPSK_SHA1 27
  121. #define HASH_TYPE_NETNTLMv1 28
  122. #define HASH_TYPE_NETNTLMv2 29
  123. #define HASH_TYPE_WPA 30
  124. #define HASH_TYPE_CISCO_SECRET4 31
  125. #define HASH_TYPE_MD5AIX 32
  126. #define HASH_TYPE_SHA1AIX 33
  127. #define HASH_TYPE_SHA256AIX 34
  128. #define HASH_TYPE_SHA512AIX 35
  129. #define HASH_TYPE_GOST 36
  130. #define HASH_TYPE_SHA1FORTIGATE 37
  131. #define HASH_TYPE_PBKDF2OSX 38
  132. #define HASH_TYPE_PBKDF2GRUB 39
  133. #define HASH_TYPE_MSSQL2005 40
  134. #define HASH_TYPE_MD5CISCO_PIX 41
  135. #define HASH_TYPE_SHA1ORACLE 42
  136. #define HASH_TYPE_HMACRAKP 43
  137. #define HASH_TYPE_BCRYPT 44
  138. #define HASH_TYPE_SHA256UNIX 45
  139. #define HASH_TYPE_EPIV6_4 46
  140. #define HASH_TYPE_SHA512B64S 47
  141. #define HASH_TYPE_EPIV4 48
  142. #define HASH_TYPE_SCRYPT 49
  143. #define HASH_TYPE_CISCO_SECRET9 50
  144. #define HASH_TYPE_PHPS 51
  145. #define HASH_TYPE_DJANGOSHA1 52
  146. #define HASH_TYPE_HMAIL 53
  147. #define HASH_TYPE_MEDIAWIKI_B 54
  148. #define HASH_TYPE_CISCO_SECRET8 55
  149. #define HASH_TYPE_DJANGO_SHA256 56
  150. #define HASH_TYPE_PEOPLESOFT 57
  151. #define HASH_TYPE_CRAM_MD5 58
  152. #define HASH_TYPE_DRUPAL7 59
  153. #define HASH_TYPE_MD5CISCO_ASA 60
  154. #define HASH_TYPE_SAP_H_SHA1 61
  155. #define HASH_TYPE_PRESTASHOP 62
  156. #define HASH_TYPE_POSTGRESQL_AUTH 63
  157. #define HASH_TYPE_MYSQL_AUTH 64
  158. #define HASH_TYPE_SIP_AUTH 65
  159. #define HASH_TYPE_SHA256B64 66
  160. #define HASH_TYPE_PLAIN 99
  161. #define PLAIN_SIZE_MD5 55
  162. #define PLAIN_SIZE_SHA1 55
  163. #define PLAIN_SIZE_MYSQL 55
  164. #define PLAIN_SIZE_PHPASS 55
  165. #define PLAIN_SIZE_MD5UNIX 16
  166. #define PLAIN_SIZE_SHA1B64 55
  167. #define PLAIN_SIZE_SHA1B64S 55
  168. #define PLAIN_SIZE_MD4 55
  169. #define PLAIN_SIZE_NTLM 27
  170. #define PLAIN_SIZE_DCC 27
  171. #define PLAIN_SIZE_MD5CHAP 55
  172. #define PLAIN_SIZE_MSSQL2000 27
  173. #define PLAIN_SIZE_MSSQL2005 27
  174. #define PLAIN_SIZE_SHA256 55
  175. #define PLAIN_SIZE_MD5APR 16
  176. #define PLAIN_SIZE_SHA512 55
  177. #define PLAIN_SIZE_SHA512UNIX 64
  178. #define PLAIN_SIZE_MD5SUN 55
  179. #define PLAIN_SIZE_OSX1 55
  180. #define PLAIN_SIZE_OSX512 55
  181. #define PLAIN_SIZE_MSSQL2012 27
  182. #define PLAIN_SIZE_DESCRYPT 8
  183. #define PLAIN_SIZE_KECCAK 55
  184. #define PLAIN_SIZE_EPIV6 27
  185. #define PLAIN_SIZE_VS2012 55
  186. #define PLAIN_SIZE_WPA 64
  187. #define PLAIN_SIZE_MD5AIX 16
  188. #define PLAIN_SIZE_SHA1AIX 55
  189. #define PLAIN_SIZE_SHA256AIX 55
  190. #define PLAIN_SIZE_SHA512AIX 55
  191. #define PLAIN_SIZE_GOST 55
  192. #define PLAIN_SIZE_FORTIGATE 47
  193. #define PLAIN_SIZE_PBKDF2OSX 55
  194. #define PLAIN_SIZE_PBKDF2GRUB 55
  195. #define PLAIN_SIZE_NETNTLMv1 27
  196. #define PLAIN_SIZE_NETNTLMv2 27
  197. #define PLAIN_SIZE_MD5CISCO 16
  198. #define PLAIN_SIZE_SHA1ORACLE 55
  199. #define PLAIN_SIZE_HMACRAKP 55
  200. #define PLAIN_SIZE_BCRYPT 55
  201. #define PLAIN_SIZE_SHA256UNIX 16
  202. #define PLAIN_SIZE_EPIV6_4 55
  203. #define PLAIN_SIZE_SHA512B64S 55
  204. #define PLAIN_SIZE_EPIV4 55
  205. #define PLAIN_SIZE_SCRYPT 55
  206. #define PLAIN_SIZE_CISCO_SECRET8 55
  207. #define PLAIN_SIZE_DJANGO_SHA256 55
  208. #define PLAIN_SIZE_PLAIN 55
  209. #define SALT_TYPE_NONE 1 << 1
  210. #define SALT_TYPE_INCLUDED 1 << 2
  211. #define SALT_TYPE_EXTERNAL 1 << 3
  212. #define SALT_TYPE_EMBEDDED 1 << 4
  213. #define SALT_SIZE_MIN_MD5 0
  214. #define SALT_SIZE_MAX_MD5 54
  215. #define SALT_SIZE_MIN_SHA1 0
  216. #define SALT_SIZE_MAX_SHA1 54
  217. #define SALT_SIZE_MIN_PHPASS 8
  218. #define SALT_SIZE_MAX_PHPASS 8
  219. #define SALT_SIZE_MIN_MD5UNIX 0
  220. #define SALT_SIZE_MAX_MD5UNIX 8
  221. #define SALT_SIZE_MIN_SHA1B64S 0
  222. #define SALT_SIZE_MAX_SHA1B64S 32
  223. #define SALT_SIZE_MIN_DCC 1
  224. #define SALT_SIZE_MAX_DCC 54
  225. #define SALT_SIZE_MIN_MD5CHAP 32
  226. #define SALT_SIZE_MAX_MD5CHAP 32
  227. #define SALT_SIZE_MIN_MSSQL2000 8
  228. #define SALT_SIZE_MIN_MSSQL2005 8
  229. #define SALT_SIZE_MAX_MSSQL2000 8
  230. #define SALT_SIZE_MAX_MSSQL2005 8
  231. #define SALT_SIZE_MIN_SHA256 0
  232. #define SALT_SIZE_MAX_SHA256 54
  233. #define SALT_SIZE_MIN_MD5APR 0
  234. #define SALT_SIZE_MAX_MD5APR 8
  235. #define SALT_SIZE_MIN_SHA512 0
  236. #define SALT_SIZE_MAX_SHA512 54
  237. #define SALT_SIZE_MIN_SHA512UNIX 0
  238. #define SALT_SIZE_MAX_SHA512UNIX 54
  239. #define SALT_SIZE_MIN_MD5SUN 1
  240. #define SALT_SIZE_MAX_MD5SUN 17
  241. #define SALT_SIZE_MIN_OSX1 8
  242. #define SALT_SIZE_MAX_OSX1 8
  243. #define SALT_SIZE_MIN_OSX512 8
  244. #define SALT_SIZE_MAX_OSX512 8
  245. #define SALT_SIZE_MIN_MSSQL2012 8
  246. #define SALT_SIZE_MAX_MSSQL2012 8
  247. #define SALT_SIZE_MIN_DESCRYPT 2
  248. #define SALT_SIZE_MAX_DESCRYPT 2
  249. #define SALT_SIZE_MIN_KECCAK 1
  250. #define SALT_SIZE_MAX_KECCAK 54
  251. #define SALT_SIZE_MIN_EPIV6 1
  252. #define SALT_SIZE_MAX_EPIV6 44
  253. #define SALT_SIZE_MIN_VS2012 1
  254. #define SALT_SIZE_MAX_VS2012 44
  255. #define SALT_SIZE_MIN_NETNTLMv1 16
  256. #define SALT_SIZE_MAX_NETNTLMv1 16
  257. #define SALT_SIZE_MIN_NETNTLMv2 ( 1 + 1 + 1 + 16 + 1 + 1)
  258. #define SALT_SIZE_MAX_NETNTLMv2 (60 + 45 + 1 + 16 + 1 + 1024)
  259. #define SALT_SIZE_MIN_MD5AIX 8
  260. #define SALT_SIZE_MAX_MD5AIX 8
  261. #define SALT_SIZE_MIN_SHA1AIX 16
  262. #define SALT_SIZE_MAX_SHA1AIX 128
  263. #define SALT_SIZE_MIN_SHA256AIX 16
  264. #define SALT_SIZE_MAX_SHA256AIX 128
  265. #define SALT_SIZE_MIN_SHA512AIX 16
  266. #define SALT_SIZE_MAX_SHA512AIX 128
  267. #define SALT_SIZE_SHA1FORTIGATE 12
  268. #define SALT_SIZE_MIN_PBKDF2OSX 64
  269. #define SALT_SIZE_MAX_PBKDF2OSX 64
  270. #define SALT_SIZE_MIN_PBKDF2GRUB 1
  271. #define SALT_SIZE_MAX_PBKDF2GRUB 1024
  272. #define SALT_SIZE_MIN_SHA1ORACLE 20
  273. #define SALT_SIZE_MAX_SHA1ORACLE 20
  274. #define SALT_SIZE_MIN_HMACRAKP 64
  275. #define SALT_SIZE_MAX_HMACRAKP 512
  276. #define SALT_SIZE_MIN_BCRYPT 22
  277. #define SALT_SIZE_MAX_BCRYPT 22
  278. #define SALT_SIZE_MIN_SHA256UNIX 0
  279. #define SALT_SIZE_MAX_SHA256UNIX 16
  280. #define SALT_SIZE_MIN_EPIV6_4 24
  281. #define SALT_SIZE_MAX_EPIV6_4 24
  282. #define SALT_SIZE_MIN_SHA512B64S 0
  283. #define SALT_SIZE_MAX_SHA512B64S 68
  284. #define SALT_SIZE_MIN_EPIV4 60
  285. #define SALT_SIZE_MAX_EPIV4 60
  286. #define SALT_SIZE_MIN_SCRYPT 1
  287. #define SALT_SIZE_MAX_SCRYPT 44
  288. #define SALT_SIZE_CISCO_SECRET9 14
  289. #define SALT_SIZE_MIN_DJANGOSHA1 0
  290. #define SALT_SIZE_MAX_DJANGOSHA1 54
  291. #define SALT_SIZE_HMAIL 6
  292. #define SALT_SIZE_MIN_MEDIAWIKI_B 0
  293. #define SALT_SIZE_MAX_MEDIAWIKI_B 54
  294. #define SALT_SIZE_MIN_CISCO_SECRET8 14
  295. #define SALT_SIZE_MAX_CISCO_SECRET8 14
  296. #define SALT_SIZE_MIN_DJANGO_SHA256 0
  297. #define SALT_SIZE_MAX_DJANGO_SHA256 128
  298. #define SALT_SIZE_MIN_CRAM_MD5 12
  299. #define SALT_SIZE_MAX_CRAM_MD5 76
  300. #define SALT_SIZE_DRUPAL7 8
  301. #define SALT_SIZE_MIN_MD5CISCO_ASA 0
  302. #define SALT_SIZE_MAX_MD5CISCO_ASA 16
  303. #define SALT_SIZE_MIN_SAP_H_SHA1 4
  304. #define SALT_SIZE_MAX_SAP_H_SHA1 16
  305. #define SALT_SIZE_MIN_PRESTASHOP 56
  306. #define SALT_SIZE_MAX_PRESTASHOP 56
  307. #define SALT_SIZE_POSTGRESQL_AUTH 8
  308. #define SALT_SIZE_MYSQL_AUTH 40
  309. #define PSAFE3_SIGN 4
  310. #define PSAFE3_MAGIC "PWS3"
  311. #define PSAFE3_ROUNDS 2048
  312. #define PHPASS_SIGN 3
  313. #define PHPASS_ITER 1
  314. #define PHPASS_MAGIC_P "$P$"
  315. #define PHPASS_MAGIC_H "$H$"
  316. #define PHPASS_ROUNDS (1 << 11)
  317. #define MD5UNIX_SIGN 3
  318. #define MD5UNIX_MAGIC "$1$"
  319. #define MD5UNIX_ROUNDS 1000
  320. #define MD5SUN_SIGN 4
  321. #define MD5SUN_MAGIC "$md5"
  322. #define MD5SUN_ROUNDS_MIN 4096
  323. #define MD5APR_SIGN 6
  324. #define MD5APR_MAGIC "$apr1$"
  325. #define MD5APR_ROUNDS 1000
  326. #define SHA512UNIX_SIGN 3
  327. #define SHA512UNIX_MAGIC "$6$"
  328. #define SHA512UNIX_ROUNDS 5000
  329. #define SHA1B64_SIGN 5
  330. #define SHA1B64_MAGIC "{SHA}"
  331. #define SHA1B64S_SIGN 6
  332. #define SHA1B64S_MAGIC "{SSHA}"
  333. #define MD5CHAP_IDBYTE 2
  334. #define MSSQL_SIGN 6
  335. #define MSSQL_MAGIC "0x0100"
  336. #define MSSQL2012_SIGN 6
  337. #define MSSQL2012_MAGIC "0x0200"
  338. #define EPISERVERV6_SIGN 14
  339. #define EPISERVERV6_MAGIC "$episerver$*0*"
  340. #define NETNTLMv1_SIGN 9
  341. #define NETNTLMv1_MAGIC "$NETNTLM$"
  342. #define NETNTLMv2_SIGN 11
  343. #define NETNTLMv2_MAGIC "$NETNTLMv2$"
  344. #define MD5AIX_SIGN 6
  345. #define MD5AIX_MAGIC "{smd5}"
  346. #define MD5AIX_ROUNDS 1000
  347. #define SHA1AIX_SIGN 7
  348. #define SHA1AIX_MAGIC "{ssha1}"
  349. #define SHA1AIX_ROUNDS (1 << 6)
  350. #define SHA256AIX_SIGN 9
  351. #define SHA256AIX_MAGIC "{ssha256}"
  352. #define SHA256AIX_ROUNDS (1 << 6)
  353. #define SHA512AIX_SIGN 9
  354. #define SHA512AIX_MAGIC "{ssha512}"
  355. #define SHA512AIX_ROUNDS (1 << 6)
  356. #define FORTIGATE_SIGN 3
  357. #define FORTIGATE_MAGIC "AK1"
  358. #define FORTIGATE_MAGIC_A "\xa3\x88\xba\x2e\x42\x4c\xb0\x4a\x53\x79\x30\xc1\x31\x07\xcc\x3f\xa1\x32\x90\x29\xa9\x81\x5b\x70"
  359. #define PBKDF2OSX_SIGN 4
  360. #define PBKDF2OSX_MAGIC "$ml$"
  361. #define PBKDF2OSX_ROUNDS 35000
  362. #define PBKDF2GRUB_SIGN 19
  363. #define PBKDF2GRUB_MAGIC "grub.pbkdf2.sha512."
  364. #define PBKDF2GRUB_ROUNDS 10000
  365. #define BCRYPT_SIGN 4
  366. #define BCRYPT_MAGIC "$2a$"
  367. #define BCRYPT_ROUNDS (1 << 5)
  368. #define SHA256UNIX_SIGN 3
  369. #define SHA256UNIX_MAGIC "$5$"
  370. #define SHA256UNIX_ROUNDS 5000
  371. #define EPISERVERV6_4_SIGN 14
  372. #define EPISERVERV6_4_MAGIC "$episerver$*1*"
  373. #define SHA512B64S_SIGN 9
  374. #define SHA512B64S_MAGIC "{SSHA512}"
  375. #define EPISERVERV4_SIGN 2
  376. #define EPISERVERV4_MAGIC "0x"
  377. #define SCRYPT_SIGN 6
  378. #define SCRYPT_MAGIC "SCRYPT"
  379. #define CISCO_SECRET9_SIGN 3
  380. #define CISCO_SECRET9_MAGIC "$9$"
  381. #define WPA2_ROUNDS 4096
  382. #define ANDROID_PIN_ROUNDS 1024
  383. #define PHPS_SIGN 6
  384. #define PHPS_MAGIC "$PHPS$"
  385. #define DJANGOSHA1_SIGN 5
  386. #define DJANGOSHA1_MAGIC "sha1$"
  387. #define MEDIAWIKI_B_SIGN 3
  388. #define MEDIAWIKI_B_MAGIC "$B$"
  389. #define CISCO_SECRET8_SIGN 3
  390. #define CISCO_SECRET8_MAGIC "$8$"
  391. #define CISCO_SECRET8_ROUNDS 20000
  392. #define DJANGO_SHA256_SIGN 14
  393. #define DJANGO_SHA256_MAGIC "pbkdf2_sha256$"
  394. #define DJANGO_SHA256_ROUNDS 20000
  395. #define CRAM_MD5_SIGN 10
  396. #define CRAM_MD5_MAGIC "$cram_md5$"
  397. #define DRUPAL7_SIGN 3
  398. #define DRUPAL7_MAGIC "$S$"
  399. #define DRUPAL7_ROUNDS 16384
  400. #define SAP_H_SHA1_SIGN 10
  401. #define SAP_H_SHA1_MAGIC "{x-issha, "
  402. #define SAP_H_SHA1_ROUNDS 1024
  403. #define POSTGRESQL_AUTH_SIGN 10
  404. #define POSTGRESQL_AUTH_MAGIC "$postgres$"
  405. #define MYSQL_AUTH_SIGN 9
  406. #define MYSQL_AUTH_MAGIC "$mysqlna$"
  407. #define SIP_AUTH_SIGN 6
  408. #define SIP_AUTH_MAGIC "$sip$*"
  409. /**
  410. * Strings
  411. */
  412. #define HT_00000 "MD5"
  413. #define HT_00010 "md5($pass.$salt)"
  414. #define HT_00020 "md5($salt.$pass)"
  415. #define HT_00030 "md5(unicode($pass).$salt)"
  416. #define HT_00040 "md5($salt.unicode($pass))"
  417. #define HT_00050 "HMAC-MD5 (key = $pass)"
  418. #define HT_00060 "HMAC-MD5 (key = $salt)"
  419. #define HT_00100 "SHA1"
  420. #define HT_00110 "sha1($pass.$salt)"
  421. #define HT_00120 "sha1($salt.$pass)"
  422. #define HT_00130 "sha1(unicode($pass).$salt)"
  423. #define HT_00140 "sha1($salt.unicode($pass))"
  424. #define HT_00150 "HMAC-SHA1 (key = $pass)"
  425. #define HT_00160 "HMAC-SHA1 (key = $salt)"
  426. #define HT_00190 "sha1(LinkedIn)"
  427. #define HT_00200 "MySQL323"
  428. #define HT_00300 "MySQL4.1/MySQL5"
  429. #define HT_00400 "phpass, MD5(Wordpress), MD5(phpBB3), MD5(Joomla)"
  430. #define HT_00500 "md5crypt, MD5(Unix), FreeBSD MD5, Cisco-IOS MD5"
  431. #define HT_00501 "Juniper IVE"
  432. #define HT_00666 "Plaintext"
  433. #define HT_00900 "MD4"
  434. #define HT_01000 "NTLM"
  435. #define HT_01100 "Domain Cached Credentials (DCC), MS Cache"
  436. #define HT_01400 "SHA256"
  437. #define HT_01410 "sha256($pass.$salt)"
  438. #define HT_01420 "sha256($salt.$pass)"
  439. #define HT_01430 "sha256(unicode($pass).$salt)"
  440. #define HT_01431 "base64(sha256(unicode($pass)))"
  441. #define HT_01440 "sha256($salt.$pass)"
  442. #define HT_01450 "HMAC-SHA256 (key = $pass)"
  443. #define HT_01460 "HMAC-SHA256 (key = $salt)"
  444. #define HT_01500 "descrypt, DES(Unix), Traditional DES"
  445. #define HT_01600 "md5apr1, MD5(APR), Apache MD5"
  446. #define HT_01700 "SHA512"
  447. #define HT_01710 "sha512($pass.$salt)"
  448. #define HT_01720 "sha512($salt.$pass)"
  449. #define HT_01730 "sha512(unicode($pass).$salt)"
  450. #define HT_01740 "sha512($salt.unicode($pass))"
  451. #define HT_01750 "HMAC-SHA512 (key = $pass)"
  452. #define HT_01760 "HMAC-SHA512 (key = $salt)"
  453. #define HT_01800 "sha512crypt, SHA512(Unix)"
  454. #define HT_02400 "Cisco-PIX MD5"
  455. #define HT_02410 "Cisco-ASA MD5"
  456. #define HT_02500 "WPA/WPA2"
  457. #define HT_02600 "Double MD5"
  458. #define HT_03200 "bcrypt, Blowfish(OpenBSD)"
  459. #define HT_03300 "MD5(Sun)"
  460. #define HT_03500 "md5(md5(md5($pass)))"
  461. #define HT_03610 "md5(md5($salt).$pass)"
  462. #define HT_03710 "md5($salt.md5($pass))"
  463. #define HT_03720 "md5($pass.md5($salt))"
  464. #define HT_03800 "md5($salt.$pass.$salt)"
  465. #define HT_03910 "md5(md5($pass).md5($salt))"
  466. #define HT_04010 "md5($salt.md5($salt.$pass))"
  467. #define HT_04110 "md5($salt.md5($pass.$salt))"
  468. #define HT_04210 "md5($username.0.$pass)"
  469. #define HT_04300 "md5(strtoupper(md5($pass)))"
  470. #define HT_04400 "md5(sha1($pass))"
  471. #define HT_04500 "Double SHA1"
  472. #define HT_04600 "sha1(sha1(sha1($pass)))"
  473. #define HT_04700 "sha1(md5($pass))"
  474. #define HT_04800 "MD5(Chap), iSCSI CHAP authentication"
  475. #define HT_04900 "sha1($salt.$pass.$salt)"
  476. #define HT_05000 "SHA-3(Keccak)"
  477. #define HT_05100 "Half MD5"
  478. #define HT_05200 "Password Safe v3"
  479. #define HT_05300 "IKE-PSK MD5"
  480. #define HT_05400 "IKE-PSK SHA1"
  481. #define HT_05500 "NetNTLMv1-VANILLA / NetNTLMv1+ESS"
  482. #define HT_05600 "NetNTLMv2"
  483. #define HT_05700 "Cisco-IOS SHA256"
  484. #define HT_05800 "Android PIN"
  485. #define HT_06300 "AIX {smd5}"
  486. #define HT_06400 "AIX {ssha256}"
  487. #define HT_06500 "AIX {ssha512}"
  488. #define HT_06700 "AIX {ssha1}"
  489. #define HT_06900 "GOST R 34.11-94"
  490. #define HT_07000 "Fortigate (FortiOS)"
  491. #define HT_07100 "OSX v10.8+"
  492. #define HT_07200 "GRUB 2"
  493. #define HT_07300 "IPMI2 RAKP HMAC-SHA1"
  494. #define HT_07400 "sha256crypt, SHA256(Unix)"
  495. #define HT_07900 "Drupal7"
  496. #define HT_08400 "WBB3, Woltlab Burning Board 3"
  497. #define HT_08900 "scrypt"
  498. #define HT_09200 "Cisco $8$"
  499. #define HT_09300 "Cisco $9$"
  500. #define HT_09900 "Radmin2"
  501. #define HT_10000 "Django (PBKDF2-SHA256)"
  502. #define HT_10200 "Cram MD5"
  503. #define HT_10300 "SAP CODVN H (PWDSALTEDHASH) iSSHA-1"
  504. #define HT_11000 "PrestaShop"
  505. #define HT_11100 "PostgreSQL Challenge-Response Authentication (MD5)"
  506. #define HT_11200 "MySQL Challenge-Response Authentication (SHA1)"
  507. #define HT_11400 "SIP digest authentication (MD5)"
  508. #define HT_99999 "Plaintext"
  509. #define HT_00011 "Joomla < 2.5.18"
  510. #define HT_00012 "PostgreSQL"
  511. #define HT_00021 "osCommerce, xt:Commerce"
  512. #define HT_00023 "Skype"
  513. #define HT_00101 "SHA-1(Base64), nsldap, Netscape LDAP SHA"
  514. #define HT_00111 "SSHA-1(Base64), nsldaps, Netscape LDAP SSHA"
  515. #define HT_00112 "Oracle S: Type (Oracle 11+)"
  516. #define HT_00121 "SMF > v1.1"
  517. #define HT_00122 "OSX v10.4, v10.5, v10.6"
  518. #define HT_00123 "EPi"
  519. #define HT_00124 "Django (SHA-1)"
  520. #define HT_00131 "MSSQL(2000)"
  521. #define HT_00132 "MSSQL(2005)"
  522. #define HT_00133 "PeopleSoft"
  523. #define HT_00141 "EPiServer 6.x < v4"
  524. #define HT_01421 "hMailServer"
  525. #define HT_01441 "EPiServer 6.x > v4"
  526. #define HT_01711 "SSHA-512(Base64), LDAP {SSHA512}"
  527. #define HT_01722 "OSX v10.7"
  528. #define HT_01731 "MSSQL(2012)"
  529. #define HT_02611 "vBulletin < v3.8.5"
  530. #define HT_02612 "PHPS"
  531. #define HT_02711 "vBulletin > v3.8.5"
  532. #define HT_02811 "IPB2+, MyBB1.2+"
  533. #define HT_03711 "Mediawiki B type"
  534. #define HT_03721 "WebEdition CMS"
  535. #define HT_07600 "Redmine Project Management Web App"
  536. static const char constant_phrase[] =
  537. "To be, or not to be,--that is the question:--\n"
  538. "Whether 'tis nobler in the mind to suffer\n"
  539. "The slings and arrows of outrageous fortune\n"
  540. "Or to take arms against a sea of troubles,\n"
  541. "And by opposing end them?--To die,--to sleep,--\n"
  542. "No more; and by a sleep to say we end\n"
  543. "The heartache, and the thousand natural shocks\n"
  544. "That flesh is heir to,--'tis a consummation\n"
  545. "Devoutly to be wish'd. To die,--to sleep;--\n"
  546. "To sleep! perchance to dream:--ay, there's the rub;\n"
  547. "For in that sleep of death what dreams may come,\n"
  548. "When we have shuffled off this mortal coil,\n"
  549. "Must give us pause: there's the respect\n"
  550. "That makes calamity of so long life;\n"
  551. "For who would bear the whips and scorns of time,\n"
  552. "The oppressor's wrong, the proud man's contumely,\n"
  553. "The pangs of despis'd love, the law's delay,\n"
  554. "The insolence of office, and the spurns\n"
  555. "That patient merit of the unworthy takes,\n"
  556. "When he himself might his quietus make\n"
  557. "With a bare bodkin? who would these fardels bear,\n"
  558. "To grunt and sweat under a weary life,\n"
  559. "But that the dread of something after death,--\n"
  560. "The undiscover'd country, from whose bourn\n"
  561. "No traveller returns,--puzzles the will,\n"
  562. "And makes us rather bear those ills we have\n"
  563. "Than fly to others that we know not of?\n"
  564. "Thus conscience does make cowards of us all;\n"
  565. "And thus the native hue of resolution\n"
  566. "Is sicklied o'er with the pale cast of thought;\n"
  567. "And enterprises of great pith and moment,\n"
  568. "With this regard, their currents turn awry,\n"
  569. "And lose the name of action.--Soft you now!\n"
  570. "The fair Ophelia!--Nymph, in thy orisons\n"
  571. "Be all my sins remember'd.\n";
  572. #define STATUS_STARTING 0
  573. #define STATUS_INIT 1
  574. #define STATUS_RUNNING 2
  575. #define STATUS_PAUSED 3
  576. #define STATUS_ABORTED 6
  577. #define STATUS_QUIT 7
  578. #define STATUS_BYPASS 8
  579. uint64_t get_thread_words_total (uint32_t num_threads);
  580. uint64_t get_thread_plains_total (uint32_t num_threads);
  581. void descrypt_decode (unsigned char digest[DIGEST_SIZE_DESCRYPT], unsigned char buf[HASH_SIZE_DESCRYPT]);
  582. void descrypt_encode (unsigned char digest[DIGEST_SIZE_DESCRYPT], unsigned char buf[HASH_SIZE_DESCRYPT]);
  583. void phpass_decode (unsigned char digest[DIGEST_SIZE_MD5], unsigned char buf[HASH_SIZE_PHPASS]);
  584. void phpass_encode (unsigned char digest[DIGEST_SIZE_MD5], unsigned char buf[HASH_SIZE_PHPASS]);
  585. void md5unix_decode (unsigned char digest[DIGEST_SIZE_MD5], unsigned char buf[HASH_SIZE_MD5UNIX]);
  586. void md5unix_encode (unsigned char digest[DIGEST_SIZE_MD5], unsigned char buf[HASH_SIZE_MD5UNIX]);
  587. void md5sun_decode (unsigned char digest[DIGEST_SIZE_MD5], unsigned char buf[HASH_SIZE_MD5SUN]);
  588. void md5sun_encode (unsigned char digest[DIGEST_SIZE_MD5], unsigned char buf[HASH_SIZE_MD5SUN]);
  589. void md5apr_decode (unsigned char digest[DIGEST_SIZE_MD5], unsigned char buf[HASH_SIZE_MD5APR]);
  590. void md5apr_encode (unsigned char digest[DIGEST_SIZE_MD5], unsigned char buf[HASH_SIZE_MD5APR]);
  591. void sha512unix_decode (unsigned char digest[DIGEST_SIZE_SHA512], unsigned char buf[HASH_SIZE_SHA512UNIX]);
  592. void sha512unix_encode (unsigned char digest[DIGEST_SIZE_SHA512], unsigned char buf[HASH_SIZE_SHA512UNIX]);
  593. void sha1b64_decode (unsigned char digest[DIGEST_SIZE_SHA1], unsigned char buf[HASH_SIZE_SHA1B64]);
  594. void sha1b64_encode (unsigned char digest[DIGEST_SIZE_SHA1], unsigned char buf[HASH_SIZE_SHA1B64]);
  595. void sha1b64s_decode (unsigned char digest[DIGEST_SIZE_SHA1], unsigned char salt[BLOCK_SIZE], uint32_t in_len, uint32_t *out_len, char *buf);
  596. void sha1b64s_encode (unsigned char digest[DIGEST_SIZE_SHA1], unsigned char salt[BLOCK_SIZE], uint32_t salt_len, char *buf);
  597. void sha256b64_decode (unsigned char digest[DIGEST_SIZE_SHA256], unsigned char buf[HASH_SIZE_SHA256B64]);
  598. void sha256b64_encode (unsigned char digest[DIGEST_SIZE_SHA256], unsigned char buf[HASH_SIZE_SHA256B64]);
  599. void sha1aix_decode (unsigned char digest[DIGEST_SIZE_SHA1], unsigned char buf[HASH_SIZE_SHA1AIX]);
  600. void sha1aix_encode (unsigned char digest[DIGEST_SIZE_SHA1], unsigned char buf[HASH_SIZE_SHA1AIX]);
  601. void sha256aix_decode (unsigned char digest[DIGEST_SIZE_SHA256], unsigned char buf[HASH_SIZE_SHA256AIX]);
  602. void sha256aix_encode (unsigned char digest[DIGEST_SIZE_SHA256], unsigned char buf[HASH_SIZE_SHA256AIX]);
  603. void sha512aix_decode (unsigned char digest[DIGEST_SIZE_SHA512], unsigned char buf[HASH_SIZE_SHA512AIX]);
  604. void sha512aix_encode (unsigned char digest[DIGEST_SIZE_SHA512], unsigned char buf[HASH_SIZE_SHA512AIX]);
  605. void sha1fortigate_decode (unsigned char digest[DIGEST_SIZE_SHA1], unsigned char salt[BLOCK_SIZE], char *buf);
  606. void sha1fortigate_encode (unsigned char digest[DIGEST_SIZE_SHA1], unsigned char salt[BLOCK_SIZE], char *buf);
  607. void sha256unix_decode (unsigned char digest[DIGEST_SIZE_SHA256], unsigned char buf[HASH_SIZE_SHA256UNIX]);
  608. void sha256unix_encode (unsigned char digest[DIGEST_SIZE_SHA256], unsigned char buf[HASH_SIZE_SHA256UNIX]);
  609. void md5cisco_decode (char in_buf[HASH_SIZE_MD5CISCO], uint32_t out_buf[4]);
  610. void md5cisco_encode (uint32_t in_buf[4], unsigned char *out_buf);
  611. void bcrypt_encode (char digest[DIGEST_SIZE_BCRYPT], char salt[16], char *bcrypt_str);
  612. void bcrypt_decode (char digest[HASH_SIZE_BCRYPT], char salt[SALT_SIZE_MIN_BCRYPT], char *hash_buf, char *salt_buf);
  613. void sha512b64s_encode (unsigned char digest[DIGEST_SIZE_SHA512], unsigned char salt[BLOCK_SIZE], uint32_t salt_len, char *buf);
  614. void sha512b64s_decode (unsigned char digest[DIGEST_SIZE_SHA512], unsigned char salt[BLOCK_SIZE], uint32_t in_len, uint32_t *out_len, char *buf);
  615. void drupal7_encode (unsigned char digest[DIGEST_SIZE_SHA512], unsigned char buf[HASH_SIZE_DRUPAL7]);
  616. void drupal7_decode (unsigned char digest[DIGEST_SIZE_SHA512], unsigned char buf[HASH_SIZE_DRUPAL7]);
  617. void format_plain (FILE *fp, char *plain_ptr, uint plain_len, uint32_t output_authex);
  618. void format_output (FILE *fp, engine_parameter_t *engine_parameter, char *out_buf, char *plain_ptr, uint plain_len, uint64_t pos);
  619. int sort_by_pot (const void *v1, const void *v2);
  620. void handle_show_request (FILE *out_fp, engine_parameter_t *engine_parameter, pot_t *pot, char *input_buf, int input_len, char *hash_buf, char *salt_buf, uint32_t salt_len, uint user_len);
  621. void handle_left_request (FILE *out_fp, engine_parameter_t *engine_parameter, pot_t *pot, char *input_buf, int input_len, char *hash_buf, char *salt_buf, uint32_t salt_len);
  622. char *strhashtype (const uint hash_mode);
  623. uint is_valid_hex_char (const char c);
  624. char hex_convert (char c);
  625. char hex_to_char (char hex[2]);
  626. char int_to_itoa64 (const char c);
  627. char itoa64_to_int (const char c);
  628. int base64_decode (char (*f) (const char), char *in_buf, int in_len, char *out_buf);
  629. int base64_encode (char (*f) (const char), char *in_buf, int in_len, char *out_buf);
  630. uint32_t hex_to_uint (char hex[ 8]);
  631. uint64_t hex_to_uint64 (char hex[16]);
  632. void uint_to_hex_lower (uint32_t uint, char hex[8]);
  633. void uint_to_hex_upper (uint32_t uint, char hex[8]);
  634. void transform_netntlmv1_key (const uint8_t *nthash, uint8_t *key);
  635. int compare_digest_plain (const void *p1, const void *p2);
  636. int compare_digest_md5 (const void *p1, const void *p2);
  637. int compare_digest_sha1 (const void *p1, const void *p2);
  638. int compare_digest_mysql (const void *p1, const void *p2);
  639. int compare_digest_md4 (const void *p1, const void *p2);
  640. int compare_digest_sha256 (const void *p1, const void *p2);
  641. int compare_digest_sha512 (const void *p1, const void *p2);
  642. int compare_digest_descrypt (const void *p1, const void *p2);
  643. int compare_digest_keccak (const void *p1, const void *p2);
  644. int compare_digest_netntlmv1 (const void *p1, const void *p2);
  645. int compare_digest_gost (const void *p1, const void *p2);
  646. int compare_digest_bcrypt (const void *p1, const void *p2);
  647. void descrypt_64 (plain_t *plains, digest_t *digests);
  648. void keccak_64 (plain_t *plains, digest_t *digests);
  649. void gost_64 (plain_t *plains, digest_t *digests);
  650. void _des_keysetup (uint32_t data[2], uint32_t Kc[16], uint32_t Kd[16], const uint s_skb[8][64]);
  651. void _des_encrypt (uint32_t data[2], uint32_t Kc[16], uint32_t Kd[16], const uint s_SPtrans[8][64]);
  652. void hashcat_md4_64 (__m128i digests[4], __m128i W[16]);
  653. void hashcat_md5_64 (__m128i digests[4], __m128i W[16]);
  654. void hashcat_sha1_64 (__m128i digests[5], __m128i W[16]);
  655. void hashcat_sha256_64 (__m128i digests[8], __m128i W[16]);
  656. void hashcat_sha512_64 (__m128i digests[8], __m128i W[16]);
  657. void init_sse2 ();
  658. void run_threads (engine_parameter_t *engine_parameter, db_t *db, void (*store_out) (plain_t *, digest_t *, salt_t *), void (*store_debug) (char *, int), void (*done) (), digest_t *quick_digest);
  659. extern plain_t **plains_iteration;
  660. #endif /* ENGINE_H */