{"id":189240,"date":"2013-08-07T02:13:03","date_gmt":"2013-08-06T22:13:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=189240"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=189240","title":{"rendered":"<span class=\"post_title\">\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f phpBB \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 C#<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/ba1\/a50\/251\/ba1a502511c37fb7690f4ec6c63a47c0.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0414\u043e\u0431\u0440\u043e\u0439 \u043d\u043e\u0447\u0438, \u0433\u043e\u0441\u043f\u043e\u0434\u0430 \u0438 \u0434\u0430\u043c\u044b!<\/p>\n<p>  \u042f \u0434\u0443\u043c\u0430\u044e, \u0432\u0441\u0435 \u043f\u043e\u043c\u043d\u044f\u0442, \u043a\u0430\u043a \u0432 \u0441\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0431\u044b\u043b\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b \u0444\u043e\u0440\u0443\u043c\u044b \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0431\u044b\u043b\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b \u0444\u043e\u0440\u0443\u043c\u044b \u043d\u0430 phpBB. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043e\u043d\u0438, \u043a \u043c\u043e\u0435\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0443\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u043c\u0435\u0441\u0442\u043e \u0441\u043e\u0446. \u0441\u0435\u0442\u044f\u043c, \u043d\u043e \u0435\u0449\u0435 \u043d\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043e\u0442\u043e\u0448\u043b\u0438 \u0432 \u043c\u0438\u0440 \u0438\u043d\u043e\u0439.<\/p>\n<p>  \u041c\u043e\u0439 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u043f\u043e\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043b phpBB \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 C# \u0432 \u0447\u0430\u0441\u0442\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u041d\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u043c \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d, \u043d\u043e, \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043d\u0430\u0439\u0434\u0443\u0442\u0441\u044f \u043b\u044e\u0434\u0438\u2026<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b <b>includes\\functions.php<\/b> \u0438 \u043d\u0430\u0439\u0434\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>phpbb_check_hash<\/b>, <b>_hash_crypt_private<\/b> \u0438 <b>_hash_encode64<\/b>. \u0418\u043c\u0435\u043d\u043d\u043e \u0438\u0445 \u043d\u0430\u043c \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 C# \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 phpBB.<\/p>\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/p>\n<pre><code class=\"cs\">using System.Security.Cryptography; using System.Text; <\/code><\/pre>\n<p>  \u0418 \u043d\u0430\u0447\u043d\u0435\u043c \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u044f\u0437\u044b\u043a. \u042f \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u043d\u0435 \u043c\u0435\u043d\u044f\u043b \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0441 \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u043c \u0432 C# \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u043c, \u0430 \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0438\u0445 \u0442\u0430\u043a\u0438\u043c\u0438, \u043a\u0430\u043a \u0438 \u0432 phpBB.<\/p>\n<pre><code class=\"cs\">    public bool phpbb_check_hash(string password, string hash)     {         var itoa64 = &quot;.\/0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&quot;;         if (hash.Length == 34)         {             return (_hash_crypt_private(password, hash, itoa64) == hash) ? true : false;         }          return (Md5(Encoding.UTF8.GetBytes(password)) == Encoding.UTF8.GetBytes(hash)) ? true : false;     } <\/code><\/pre>\n<pre><code class=\"cs\">    public string _hash_crypt_private(string password, string setting, string itoa64)     {         var output = &quot;*&quot;;          if (setting.Substring(0, 3) != &quot;$H$&quot; && setting.Substring(0, 3) != &quot;$P$&quot;)         {             return output;         }          var countLog2 = itoa64.IndexOf(setting[3]);          if (countLog2 &lt; 7 || countLog2 &gt; 30)         {             return output;         }          var count = 1 &lt;&lt; countLog2;         var salt = setting.Substring(4, 8);          if (salt.Length != 8)         {             return output;         }          var str = new byte[Encoding.UTF8.GetBytes(salt).Length + Encoding.UTF8.GetBytes(password).Length];         Array.Copy(Encoding.UTF8.GetBytes(salt), 0, str, 0, Encoding.UTF8.GetBytes(salt).Length);         Array.Copy(Encoding.UTF8.GetBytes(password), 0, str, Encoding.UTF8.GetBytes(salt).Length,             Encoding.UTF8.GetBytes(password).Length);          var hash = Md5(str);         do         {             str = new byte[hash.Length + Encoding.UTF8.GetBytes(password).Length];             Array.Copy(hash, 0, str, 0, hash.Length);             Array.Copy(Encoding.UTF8.GetBytes(password), 0, str, hash.Length, Encoding.UTF8.GetBytes(password).Length);              hash = Md5(str);         } while (--count != 0);          output = setting.Substring(0, 12);         output += _hash_encode64(hash, 16, itoa64);          return output;     } <\/code><\/pre>\n<pre><code class=\"cs\">    public string _hash_encode64(byte[] input, int count, string itoa64)     {         var output = &quot;&quot;;         var i = 0;          do         {             int value = input[i++];             output += itoa64[value & 0x3f];              if (i &lt; count)             {                 value |= input[i] &lt;&lt; 8;             }              output += itoa64[(value &gt;&gt; 6) & 0x3f];              if (i++ &gt;= count)             {                 break;             }              if (i &lt; count)             {                 value |= input[i] &lt;&lt; 16;             }              output += itoa64[(value &gt;&gt; 12) & 0x3f];              if (i++ &gt;= count)             {                 break;             }              output += itoa64[(value &gt;&gt; 18) & 0x3f];         } while (i &lt; count);          return output;     } <\/code><\/pre>\n<pre><code class=\"cs\">    public byte[] Md5(byte[] str)     {         var md5CryptoServiceProvider = new MD5CryptoServiceProvider();          return md5CryptoServiceProvider.ComputeHash(str);     } <\/code><\/pre>\n<p>  \u042f \u043d\u0435 \u0437\u043d\u0430\u044e, \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043a\u043e\u043c\u0443-\u0442\u043e, \u043d\u043e \u0432 \u0441\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u043f\u0435\u0440\u0435\u0440\u044b\u043b \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u0443\u043c\u043e\u0432, \u043d\u043e \u0442\u0430\u043a \u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0438 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u0434\u043e\u043c \u0441 \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>  \u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0412\u0430\u0448\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438!    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/189240\/\"> http:\/\/habrahabr.ru\/post\/189240\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/ba1\/a50\/251\/ba1a502511c37fb7690f4ec6c63a47c0.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0414\u043e\u0431\u0440\u043e\u0439 \u043d\u043e\u0447\u0438, \u0433\u043e\u0441\u043f\u043e\u0434\u0430 \u0438 \u0434\u0430\u043c\u044b!<\/p>\n<p>  \u042f \u0434\u0443\u043c\u0430\u044e, \u0432\u0441\u0435 \u043f\u043e\u043c\u043d\u044f\u0442, \u043a\u0430\u043a \u0432 \u0441\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0431\u044b\u043b\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b \u0444\u043e\u0440\u0443\u043c\u044b \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0431\u044b\u043b\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b \u0444\u043e\u0440\u0443\u043c\u044b \u043d\u0430 phpBB. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043e\u043d\u0438, \u043a \u043c\u043e\u0435\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0443\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u043c\u0435\u0441\u0442\u043e \u0441\u043e\u0446. \u0441\u0435\u0442\u044f\u043c, \u043d\u043e \u0435\u0449\u0435 \u043d\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043e\u0442\u043e\u0448\u043b\u0438 \u0432 \u043c\u0438\u0440 \u0438\u043d\u043e\u0439.<\/p>\n<p>  \u041c\u043e\u0439 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u043f\u043e\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043b phpBB \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 C# \u0432 \u0447\u0430\u0441\u0442\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u041d\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u043c \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d, \u043d\u043e, \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043d\u0430\u0439\u0434\u0443\u0442\u0441\u044f \u043b\u044e\u0434\u0438\u2026  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-189240","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/189240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=189240"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/189240\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=189240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=189240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=189240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}