linux\u7684crypt<\/h1> \n
\u6700\u8fd1\u5b66\u6821\u5e03\u7f6e\u4e86\u4e00\u4e2a\u7f51\u5b89\u7684\u5c0f\u4f5c\u4e1a\uff0c\u8981\u7528\u5230linux\u91cc\u9762\u7684\u8fd9\u4e2a <\/p> \n \u5bc6\u7801\u5f71\u5b50\u6587\u4ef6\u4e2d\u5b58\u50a8\u4e86\u6bcf\u4e00\u4e2a\u7528\u6237\u7684\u7528\u6237\u660e\u6587\u548c\u5176\u5355\u5411\u54c8\u5e0c\u8fc7\u7684\u79d8\u6587<\/p> \n \u5bc6\u7801\u5b57\u6bb5\u7528\\(id\\)<\/span>salt$hashed<\/strong>\u7684\u683c\u5f0f\u5b58\u50a8\uff0c\u5176\u4e2did\u5b57\u6bb5\u662f1\uff0csalt\u662fC68vnJ27<\/strong>,hash\u4e3a1ttFZ1\/Rylq\/xi350A0NI0<\/strong><\/p> \n \u5176\u4e2d$id\u8868\u793a\u8ba1\u7b97\u5bc6\u7801\u5bc6\u6587\u6240\u7528\u7684\u54c8\u5e0c\u7b97\u6cd5\uff0c\u5bf9\u5e94\u5173\u7cfb\u5982\u4e0b:<\/p> \n \u90a3\u8fd9\u4e2a\u7531\u660e\u6587\u52a0\u5bc6\u7684\u8fc7\u5c31\u662f\u7531crypt()\u51fd\u6570\u5b8c\u6210\u7684\uff0ccrypt()\u662f\u4e00\u4e2a\u5bc6\u7801\u52a0\u5bc6\u51fd\u6570\uff08\u5c06\u5bc6\u7801\u52a0\u5bc6\uff0c\u660e\u6587\u53d8\u6210\u5bc6\u6587\uff09\uff0c\u8be5\u51fd\u6570\u57fa\u4e8e\u6570\u636e\u52a0\u5bc6\u6807\u51c6\uff08DES\uff0cData Encryption Standard \uff09\u7b97\u6cd5\u4ee5\u53ca\u57fa\u4e8eDES\u7684\u5176\u4ed6\u53d8\u79cd\u7b97\u6cd5\uff0c\u8be5\u51fd\u6570\u4e0d\u4f9d\u8d56\u4e8e\u8ba1\u7b97\u673a\u786c\u4ef6\u5b9e\u73b0\u6570\u636e\u52a0\u5bc6\u3002DES\u7b97\u6cd5\u4ec5\u9002\u5408\u4e8e\u52a0\u5bc6\u5b57\u7b26\u4e32\uff0c\u4e5f\u5c31\u662f\u7528\u4e8e\u751f\u6210\u5bc6\u7801\u3002\u5c3d\u7ba1\u5bc6\u7801\u7684\u751f\u6210\u6709\u5f88\u591a\u79cd\u65b9\u6cd5\u3002<\/p> \n salt\u7684\u5b9a\u4e49\u662f <\/p> \n \u5b98\u65b9\u7ed9\u51fa\u7684crypt\u7684\u7528\u6cd5\u662f\u8981\u4f20\u5165\u4e00\u4e2a\u5bc6\u94a5\u548c\u4e00\u4e2asalt\uff0c\u8fd9\u4e2a\u5bc6\u94a5\u5c31\u662f\u7528\u6237\u5bc6\u7801\u3002\u5728\u7f16\u8bd1c\u8bed\u8a00\u6587\u4ef6\u65f6\uff0c\u6211\u4eec\u4e3b\u8981\u5199\u6210"gcc -o crypt crypt.c -lcrypt"<\/strong>\u53bb\u8c03\u7528crypt\u8fd9\u4e2a\u5e93<\/p> \n \u73b0\u5728\u9898\u76ee\u7ed9\u51fa\u4e8612\u4f4d\u5bc6\u94a5\u4e2d\u7684\u524d\u4e94\u4f4d\u548c\u540e\u4e24\u4f4d\uff0c\u4e2d\u95f45\u4e2a\u90fd\u662f\u6570\u5b57\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u7206\u7834\u7684\u65b9\u5f0f\u53bb\u5b9e\u73b0\u4e00\u4e0bcrypt\u65b9\u6cd5\u3002<\/p> \n <\/p> \n \u76f4\u63a5\u7ed9\u51fa\u4ee3\u7801<\/p> \n \u4e3b\u8981\u5f53\u6211\u4eec\u4e86\u89e3\u4e86\u76d0\u662f\u4ec0\u4e48\uff0ccrypt\u662f\u600e\u4e48\u52a0\u5bc6\u7684\uff0c\u8fd9\u4e2a\u5224\u65ad\u7206\u7834\u5bc6\u7801\u7684\u5f88\u7b80\u5355\u4e86\uff0c\u4ece00000\u5f00\u59cb\u523099999\u4f9d\u6b21\u62fc\u63a5\u8fdb\u53bb\u8fdb\u884c\u52a0\u5bc6\uff0c\u534a\u5206\u949f\u5de6\u53f3\u5c31\u7206\u51fa\u5bc6\u7801\u4e86<\/p> \n <\/p> \n<\/div>","orderid":"0","title":"linux\u4e0bc\u8bed\u8a00\u7684crypt\u51fd\u6570\u600e\u4e48\u7528\uff1f","smalltitle":"","mid":"0","fname":"Linux","special_id":"0","bak_id":"0","info":"0","hits":"13","pages":"1","comments":"0","posttime":"2023-07-23 13:35:20","list":"1690090520","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"linux<\/A> crypt<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"119.59.235.169","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"linux\u4e0bc\u8bed\u8a00\u7684crypt\u51fd\u6570\u600e\u4e48\u7528\uff1f","lastview":"1700983328","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}crypt<\/code>\u51fd\u6570\uff0c\u5199\u4e00\u7bc7\u603b\u7ed3\u4e00\u4e0b\u3002\u9996\u5148\u6211\u4eec\u8981\u4e86\u89e3\u8fd9\u4e2a\u51fd\u6570\u662f\u7528\u6765\u505a\u4ec0\u4e48\u7684\u3002<\/p> \n
cipher = "$1$C68vnJ27$1ttFZ1\/Rylq\/xi350A0NI0";\n<\/code><\/pre> \n
\n
$1$<\/code> \u8868\u793a MD5<\/li> \n
$5$<\/code> \u8868\u793a SHA-256<\/li> \n
$6$<\/code> \u8868\u793a SHA-512<\/li> \n
$2a$<\/code> \u548c
$2y$<\/code>\u8868\u793aBlowfish\u7b97\u6cd5<\/li> \n <\/ul> \n
\u5728\u5bc6\u7801\u5b66\u4e2d\uff0c\u662f\u6307\u901a\u8fc7\u5728\u5bc6\u7801\u4efb\u610f\u56fa\u5b9a\u4f4d\u7f6e\u63d2\u5165\u7279\u5b9a\u7684\u5b57\u7b26\u4e32\uff0c\u8ba9\u6563\u5217\u540e\u7684\u7ed3\u679c\u548c\u4f7f\u7528\u539f\u59cb\u5bc6\u7801\u7684\u6563\u5217\u7ed3\u679c\u4e0d\u76f8\u7b26\uff0c\u8fd9\u79cd\u8fc7\u7a0b\u79f0\u4e4b\u4e3a\u201c\u52a0\u76d0\u201d\u3002<\/code>Salt \u53ef\u4ee5\u662f\u4efb\u610f\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u6216\u662f\u5b57\u6bcd\u6216\u6570\u5b57\u7684\u7ec4\u5408\uff0c\u4f46\u5fc5\u987b\u662f\u968f\u673a\u4ea7\u751f\u7684\uff0c\u6bcf\u4e2a\u7528\u6237\u7684 Salt \u90fd\u4e0d\u4e00\u6837\uff0c\u7528\u6237\u6ce8\u518c\u7684\u65f6\u5019\uff0c\u6570\u636e\u5e93\u4e2d\u5b58\u5165\u7684\u4e0d\u662f\u660e\u6587\u5bc6\u7801\uff0c\u4e5f\u4e0d\u662f\u7b80\u5355\u7684\u5bf9\u660e\u6587\u5bc6\u7801\u8fdb\u884c\u6563\u5217\uff0c\u800c\u662f MD5( \u660e\u6587\u5bc6\u7801 + Salt)\u3002salt\u662f\u4e00\u79cd\u6df7\u6dc6key\u7684\u4e00\u6bb5\u8303\u56f4\u5728abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.\/\u4e2d\u7684\u201c\u968f\u673a\u201d\u5b57\u7b26\u4e32\uff0c\u5177\u4f53\u6700\u5c0f\u957f\u5ea6\u548c\u6700\u5927\u957f\u5ea6\u6839\u636e\u52a0\u5bc6\u65b9\u6cd5\u7684\u4e0d\u540c\u800c\u4e0d\u540c\u3002<\/p> \n
```c\n\/\/\n\/\/ Created by ivanlee on 2023\/3\/26.\n\/\/\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <crypt.h>\n\nconst char* ans_cipher = "$1$XwynSv0a$qgSbP2GtPyeEyq6ZVWPUZ1";\nconst char* first5 = "*CMS";\nconst char* last2 = "c#";\nconst char* salt = "$1$XwynSv0a$";\n\nint main(int argc, char* argv[]){\n for(int a=0; a<10;a++){\n char str[30];\n strcpy(str,first5);\n char tmpa;\n tmpa = '0' + a;\n str[5] = tmpa;\n for(int b=0; b<10;b++){\n char tmpb;\n tmpb = '0' + b;\n str[6] = tmpb;\n for(int c=0; c<10;c++){\n char tmpc;\n tmpc = '0' + c;\n str[7] = tmpc;\n for(int d=0; d<10;d++){\n char tmpd;\n tmpd = '0' + d;\n str[8] = tmpd;\n for(int e=0; e<10;e++){\n char tmpe;\n tmpe = '0'+e;\n str[9]=tmpe;\n str[10]='c';\n str[11]='#';\n char cipher[50];\n char new[12];\n strncpy(new,str,12);\n strcpy(cipher,crypt(new,salt));\n if(strcmp(cipher,ans_cipher)==0) {\n printf("the ans is: %s\\n", new);\n return 0;\n }\n\n }\n }\n }\n }\n }\n return 0;\n\n}\n<\/code><\/pre> \n