BugTrack/2469
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
* パスワードハッシュアルゴリズムのSHA-2対応 [#i424f475]
- ページ: [[BugTrack]]
- 投稿者: [[umorigu]]
- 優先順位: 低
- 状態: 完了
- カテゴリー: 本体新機能
- 投稿日: 2018-04-28 (土) 00:51:06
- バージョン: 1.5.1
- リリース予定バージョン: 1.5.2
** メッセージ [#z673f016]
//パスワード用のハッシュアルゴリズムにSHA-2(SHA-256, SHA-...
パスワード用のハッシュアルゴリズムにSHA-2(SHA-256, SHA-51...
関連:
- [[BugTrack/709]]: パスワードのフォーマットを選択可能に(...
- [[official:質問箱/5298]]: アカウント登録のリモート登録
--------
*** 使用できるフォーマット (追加) [#p7b992f7]
|~ |>|~保存フォーマット / scheme prefix ...
| | | ...
| 1| LDAP SSHA512 (sha-512 with a seed) | {SSHA512} ...
| 2| LDAP SHA512 | {SHA512} ...
//| 3| LDAP SSHA384 (sha-384 with a seed) | {SSHA384} ...
//| 4| LDAP SHA384 | {SHA384} ...
| 5| LDAP SSHA256 (sha-256 with a seed) | {SSHA256} ...
| 6| LDAP SHA256 | {SHA256} ...
| 7| PHP hash('sha512')関数の出力 | {x-php-sha512} ...
//| 8| PHP hash('sha384')関数の出力 | {x-php-sha384...
| 9| PHP hash('sha256')関数の出力 | {x-php-sha256} ...
*** 使用例 [#h1efc54c]
//$adminpass = 'pass'; // Cleartext
//$adminpass = '{SSHA512}e/6TcRqTNIviKydZM8Alb62LbUPw8i...
//$adminpass = '{SHA512}W3IrMH/ObJRJBdEyaR1eSiIUt/6Stzi...
// //$adminpass = '{SSHA384}QjFEKtJxCeqMSInJZaGwcj0CsLxP...
// //$adminpass = '{SHA384}rREZcHCKr/B1JNgfcVgpUrda3nSVH...
//$adminpass = '{SSHA256}ghLA4HsiVHGnj9uFEG17o/LacIQ837...
//$adminpass = '{SHA256}10/w7o2juYBrGMh32/KbveULW9jk2te...
//$adminpass = '{x-php-sha512}5b722b307fce6c944905d1326...
// '19511c3010a0e7712b054daef...
// //$adminpass = '{x-php-sha384}ad111970708aaff07524d81...
// // 'e8d3e8fbc7c271114462fe6...
//$adminpass = '{x-php-sha256}d74ff0ee8da3b9806b18c877d...
*** SHA-2 ハッシュの生成方法 [#z9e39f86]
基本的にオフラインで((信用できないネットワークを経由せず...
- OpenLDAP付属 の slappasswd コマンドによる生成方法 (Cent...
$ alias slappasswd="slappasswd -o module-path=/usr/lib64...
$ slappasswd -h '{SHA256}' -s pass
// $ slappasswd -h '{SHA384}' -s pass
$ slappasswd -h '{SHA512}' -s pass
$ slappasswd -h '{SSHA256}' -s pass # saltは指定不可、ラ...
// $ slappasswd -h '{SSHA384}' -s pass # saltは指定不可、...
$ slappasswd -h '{SSHA512}' -s pass # saltは指定不可、ラ...
-- 備考: pw-sha2 モジュールが使用するsaltの長さ(上記ソー...
slapd-sha2.c:#define SHA2_SALT_SIZE 8
slapd-sha2.c: char saltdata[SHA2_SALT_SIZE];
- OpenLDAP pw-sha2 モジュールのソースコード 上のREADMEに ...
$ echo -n "secret" | openssl dgst -sha256 -binary | open...
// $ echo -n "secret" | openssl dgst -sha384 -binary | op...
$ echo -n "secret" | openssl dgst -sha512 -binary | open...
- openssl_slappasswd.sh -- OpenLDAP slappasswd(with pw-sh...
$ ./openssl_slappasswd.sh -h '{SHA256}' -s pass
// $ ./openssl_slappasswd.sh -h '{SHA384}' -s pass
$ ./openssl_slappasswd.sh -h '{SHA512}' -s pass
$ ./openssl_slappasswd.sh -h '{SSHA256}' -s pass # salt...
// $ ./openssl_slappasswd.sh -h '{SSHA384}' -s pass # sal...
$ ./openssl_slappasswd.sh -h '{SSHA512}' -s pass # salt...
-- 上記の openssl を用いるアイデアを拡張し、SHA-2に関して...
*** 参考文献など [#e800f99b]
- RFC 6234: US Secure Hash Algorithms (SHA and SHA-based ...
-- パスワードハッシュアルゴリズム SHA-2 (SHA-256, SHA-384...
- Internet-Draft: Lightweight Directory Access Protocol (...
https:// tools.ietf.org/html/draft-stroeder-hashed-userpa...
-- OpenLDAPが使用している scheme prefix の名称 "{SHA256}"...
- OpenLDAP pw-sha2 モジュールのソースコード (GitHub上のミ...
-- github.com/openldap/openldap/tree/master/contrib/slapd...
- 他製品での事例
-- Dovecot v2.x documentation: Authentication / Password ...
{SSHA256}SoR/78T5q0UPFng8UCXWQxOUKhzrJZlwfNtllAupAeUT+kQv
-- CA Directory - 12.6: 管理 / CA Directory を管理するツ...
https:// docops.ca.com/cad126jp/%E7%AE%A1%E7%90%86/ca-dir...
-- iRedMail: Password hashes supported by iRedMail https:...
{SSHA512}FxgXDhBVYmTqoboW+ibyyzPv/wGG7y4VJtuHWrx+wfqrs/l...
-- Hashcat: Example hashes https:// hashcat.net/wiki/doku...
--- AIXは少々イレギュラーのようだ
--------
- 対応しました。[[commit:4669d6b232]] {x-php-sha256} と {...
- 上記を受けて{x-php-sha384} {SHA256} {SSHA256} {SHA384} ...
- OpenLDAPでSHA-2の指定方法があるのですね。RFCにはなって...
-- (解説とまとめです) OpenLDAP互換、という [[BugTrack/70...
-- 上にある様にInternet-Draftも発行されているので、{SMD5}...
-- x- で始まる scheme prefix は、RFC 2307に則った「その他...
-- SHA-224, SHA-512/224, SHA-512/256 が実装対象でない理由...
※PukiWiki 1.5.2 に収録されている話題はここまで
----
*** 1.5.x [#nef467d4]
- md5.inc.php について (1) SHA-384が漏れていたので追加 (2...
diff --git a/plugin/md5.inc.php b/plugin/md5.inc.php
index 854baa0..67e2bad 100644
--- a/plugin/md5.inc.php
+++ b/plugin/md5.inc.php
@@ -5,12 +5,16 @@
// License: GPL v2 or (at your option) any later version
//
// MD5 plugin: Allow to convert password/passphrase
-// * PHP sha1() -- If you have sha1() or mhash extension
// * PHP md5()
-// * PHP hash('sha256')
-// * PHP hash('sha512')
-// * LDAP SHA / SSHA -- If you have sha1() or mhash ext...
+// * PHP sha1() -- If you have sha1() or mhash extension
+// * PHP hash('sha256') -- If you have hash() (PHP 5 >=...
+// * PHP hash('sha384') --
+// * PHP hash('sha512') --
// * LDAP MD5 / SMD5
+// * LDAP SHA / SSHA -- If you have sha1() or mhash ext...
+// * LDAP SHA256 / SSHA256 -- If you have hash() (PHP 5...
+// * LDAP SHA384 / SSHA384 --
+// * LDAP SHA512 / SSHA512 --
// User interface of pkwk_hash_compute() for system admin
function plugin_md5_action()
@@ -39,6 +43,9 @@ function plugin_md5_action()
if ($algos_enabled->sha256) {
array_push($scheme_list, 'x-php-sha256', 'SHA256', '...
}
+ if ($algos_enabled->sha384) {
+ array_push($scheme_list, 'x-php-sha384', 'SHA384', '...
+ }
if ($algos_enabled->sha512) {
array_push($scheme_list, 'x-php-sha512', 'SHA512', '...
}
@@ -67,8 +74,10 @@ function plugin_md5_show_form($nophra...
}
if ($value != '') $value = 'value="' . htmlsc($value) ...
$algos_enabled = plugin_md5_get_algos_enabled();
- $sha1_checked = $md5_checked = '';
- if ($algos_enabled->sha1) {
+ $sha256_checked = $sha1_checked = $md5_checked = '';
+ if ($algos_enabled->sha256) {
+ $sha256_checked = 'checked="checked" ';
+ } elseif ($algos_enabled->sha1) {
$sha1_checked = 'checked="checked" ';
} else {
$md5_checked = 'checked="checked" ';
@@ -85,48 +94,68 @@ EOD;
<input type="hidden" name="plugin" value="md5" />
<label for="_p_md5_phrase">Phrase:</label>
<input type="text" name="phrase" id="_p_md5_phrase" ...
+
+
EOD;
- $form .= <<<EOD
- <input type="radio" name="scheme" id="_p_md5_md5" va...
- <label for="_p_md5_md5">PHP md5</label><br />
+ if ($algos_enabled->sha512) $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_sha512" ...
+ <label for="_p_md5_sha512">PHP sha512</label><br />
+
EOD;
- if ($algos_enabled->sha1) $form .= <<<EOD
- <input type="radio" name="scheme" id="_p_md5_sha1" va...
- <label for="_p_md5_sha1">PHP sha1</label><br />
+ if ($algos_enabled->sha384) $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_sha384" ...
+ <label for="_p_md5_sha384">PHP sha384</label><br />
+
EOD;
if ($algos_enabled->sha256) $form .= <<<EOD
<input type="radio" name="scheme" id="_p_md5_sha256" ...
<label for="_p_md5_sha256">PHP sha256</label><br />
+
+EOD;
+ if ($algos_enabled->sha1) $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_sha1" va...
+ <label for="_p_md5_sha1">PHP sha1</label><br />
+
+EOD;
+ $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_md5" va...
+ <label for="_p_md5_md5">PHP md5</label><br />
+
EOD;
if ($algos_enabled->sha512) $form .= <<<EOD
- <input type="radio" name="scheme" id="_p_md5_sha512" ...
- <label for="_p_md5_sha512">PHP sha512</label><br />
+ <input type="radio" name="scheme" id="_p_md5_lssha512...
+ <label for="_p_md5_lssha512">LDAP SSHA512 (sha-512 wi...
+ <input type="radio" name="scheme" id="_p_md5_lsha512"...
+ <label for="_p_md5_lsha512">LDAP SHA512 (sha-512)</la...
+
+EOD;
+ if ($algos_enabled->sha384) $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_lssha384...
+ <label for="_p_md5_lssha384">LDAP SSHA384 (sha-384 wi...
+ <input type="radio" name="scheme" id="_p_md5_lsha384"...
+ <label for="_p_md5_lsha384">LDAP SHA384 (sha-384)</la...
+
+EOD;
+ if ($algos_enabled->sha256) $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_lssha256...
+ <label for="_p_md5_lssha256">LDAP SSHA256 (sha-256 wi...
+ <input type="radio" name="scheme" id="_p_md5_lsha256"...
+ <label for="_p_md5_lsha256">LDAP SHA256 (sha-256)</la...
+
EOD;
if ($algos_enabled->sha1) $form .= <<<EOD
<input type="radio" name="scheme" id="_p_md5_lssha" v...
<label for="_p_md5_lssha">LDAP SSHA (sha-1 with a see...
<input type="radio" name="scheme" id="_p_md5_lsha" va...
<label for="_p_md5_lsha">LDAP SHA (sha-1)</label><br />
+
EOD;
$form .= <<<EOD
<input type="radio" name="scheme" id="_p_md5_lsmd5" v...
<label for="_p_md5_lsmd5">LDAP SMD5 (md5 with a seed)...
<input type="radio" name="scheme" id="_p_md5_lmd5" va...
<label for="_p_md5_lmd5">LDAP MD5</label><br />
-EOD;
- if ($algos_enabled->sha256) $form .= <<<EOD
- <input type="radio" name="scheme" id="_p_md5_lssha256...
- <label for="_p_md5_lssha256">LDAP SSHA256 (sha256 wit...
- <input type="radio" name="scheme" id="_p_md5_lsha256"...
- <label for="_p_md5_lsha256">LDAP SHA256</label><br />
-EOD;
- if ($algos_enabled->sha512) $form .= <<<EOD
- <input type="radio" name="scheme" id="_p_md5_lssha512...
- <label for="_p_md5_lssha512">LDAP SSHA512 (sha512 wit...
- <input type="radio" name="scheme" id="_p_md5_lsha512"...
- <label for="_p_md5_lsha512">LDAP SHA512</label><br />
-EOD;
- $form .= <<<EOD
+
<input type="checkbox" name="prefix" id="_p_md5_prefi...
<label for="_p_md5_prefix">Add scheme prefix (RFC2307...
@@ -139,6 +168,7 @@ EOD;
<p>* = Salt enabled<p/>
</div>
</form>
+
EOD;
return $form;
@@ -149,21 +179,11 @@ EOD;
*/
function plugin_md5_get_algos_enabled()
{
- $sha1_enabled = function_exists('sha1');
- $sha256_enabled = false;
- $sha512_enabled = false;
- if (function_exists('hash') && function_exists('hash_a...
- $algos = hash_algos();
- if (in_array('sha256', $algos)) {
- $sha256_enabled = true;
- }
- if (in_array('sha512', $algos)) {
- $sha512_enabled = true;
- }
- }
+ $algos = function_exists('hash_algos') ? hash_algos() ...
return (object) array(
- 'sha1' => $sha1_enabled,
- 'sha256' => $sha256_enabled,
- 'sha512' => $sha512_enabled,
+ 'sha1' => function_exists('sha1'),
+ 'sha256' => in_array('sha256', $algos),
+ 'sha384' => in_array('sha384', $algos),
+ 'sha512' => in_array('sha512', $algos),
);
}
#comment
終了行:
* パスワードハッシュアルゴリズムのSHA-2対応 [#i424f475]
- ページ: [[BugTrack]]
- 投稿者: [[umorigu]]
- 優先順位: 低
- 状態: 完了
- カテゴリー: 本体新機能
- 投稿日: 2018-04-28 (土) 00:51:06
- バージョン: 1.5.1
- リリース予定バージョン: 1.5.2
** メッセージ [#z673f016]
//パスワード用のハッシュアルゴリズムにSHA-2(SHA-256, SHA-...
パスワード用のハッシュアルゴリズムにSHA-2(SHA-256, SHA-51...
関連:
- [[BugTrack/709]]: パスワードのフォーマットを選択可能に(...
- [[official:質問箱/5298]]: アカウント登録のリモート登録
--------
*** 使用できるフォーマット (追加) [#p7b992f7]
|~ |>|~保存フォーマット / scheme prefix ...
| | | ...
| 1| LDAP SSHA512 (sha-512 with a seed) | {SSHA512} ...
| 2| LDAP SHA512 | {SHA512} ...
//| 3| LDAP SSHA384 (sha-384 with a seed) | {SSHA384} ...
//| 4| LDAP SHA384 | {SHA384} ...
| 5| LDAP SSHA256 (sha-256 with a seed) | {SSHA256} ...
| 6| LDAP SHA256 | {SHA256} ...
| 7| PHP hash('sha512')関数の出力 | {x-php-sha512} ...
//| 8| PHP hash('sha384')関数の出力 | {x-php-sha384...
| 9| PHP hash('sha256')関数の出力 | {x-php-sha256} ...
*** 使用例 [#h1efc54c]
//$adminpass = 'pass'; // Cleartext
//$adminpass = '{SSHA512}e/6TcRqTNIviKydZM8Alb62LbUPw8i...
//$adminpass = '{SHA512}W3IrMH/ObJRJBdEyaR1eSiIUt/6Stzi...
// //$adminpass = '{SSHA384}QjFEKtJxCeqMSInJZaGwcj0CsLxP...
// //$adminpass = '{SHA384}rREZcHCKr/B1JNgfcVgpUrda3nSVH...
//$adminpass = '{SSHA256}ghLA4HsiVHGnj9uFEG17o/LacIQ837...
//$adminpass = '{SHA256}10/w7o2juYBrGMh32/KbveULW9jk2te...
//$adminpass = '{x-php-sha512}5b722b307fce6c944905d1326...
// '19511c3010a0e7712b054daef...
// //$adminpass = '{x-php-sha384}ad111970708aaff07524d81...
// // 'e8d3e8fbc7c271114462fe6...
//$adminpass = '{x-php-sha256}d74ff0ee8da3b9806b18c877d...
*** SHA-2 ハッシュの生成方法 [#z9e39f86]
基本的にオフラインで((信用できないネットワークを経由せず...
- OpenLDAP付属 の slappasswd コマンドによる生成方法 (Cent...
$ alias slappasswd="slappasswd -o module-path=/usr/lib64...
$ slappasswd -h '{SHA256}' -s pass
// $ slappasswd -h '{SHA384}' -s pass
$ slappasswd -h '{SHA512}' -s pass
$ slappasswd -h '{SSHA256}' -s pass # saltは指定不可、ラ...
// $ slappasswd -h '{SSHA384}' -s pass # saltは指定不可、...
$ slappasswd -h '{SSHA512}' -s pass # saltは指定不可、ラ...
-- 備考: pw-sha2 モジュールが使用するsaltの長さ(上記ソー...
slapd-sha2.c:#define SHA2_SALT_SIZE 8
slapd-sha2.c: char saltdata[SHA2_SALT_SIZE];
- OpenLDAP pw-sha2 モジュールのソースコード 上のREADMEに ...
$ echo -n "secret" | openssl dgst -sha256 -binary | open...
// $ echo -n "secret" | openssl dgst -sha384 -binary | op...
$ echo -n "secret" | openssl dgst -sha512 -binary | open...
- openssl_slappasswd.sh -- OpenLDAP slappasswd(with pw-sh...
$ ./openssl_slappasswd.sh -h '{SHA256}' -s pass
// $ ./openssl_slappasswd.sh -h '{SHA384}' -s pass
$ ./openssl_slappasswd.sh -h '{SHA512}' -s pass
$ ./openssl_slappasswd.sh -h '{SSHA256}' -s pass # salt...
// $ ./openssl_slappasswd.sh -h '{SSHA384}' -s pass # sal...
$ ./openssl_slappasswd.sh -h '{SSHA512}' -s pass # salt...
-- 上記の openssl を用いるアイデアを拡張し、SHA-2に関して...
*** 参考文献など [#e800f99b]
- RFC 6234: US Secure Hash Algorithms (SHA and SHA-based ...
-- パスワードハッシュアルゴリズム SHA-2 (SHA-256, SHA-384...
- Internet-Draft: Lightweight Directory Access Protocol (...
https:// tools.ietf.org/html/draft-stroeder-hashed-userpa...
-- OpenLDAPが使用している scheme prefix の名称 "{SHA256}"...
- OpenLDAP pw-sha2 モジュールのソースコード (GitHub上のミ...
-- github.com/openldap/openldap/tree/master/contrib/slapd...
- 他製品での事例
-- Dovecot v2.x documentation: Authentication / Password ...
{SSHA256}SoR/78T5q0UPFng8UCXWQxOUKhzrJZlwfNtllAupAeUT+kQv
-- CA Directory - 12.6: 管理 / CA Directory を管理するツ...
https:// docops.ca.com/cad126jp/%E7%AE%A1%E7%90%86/ca-dir...
-- iRedMail: Password hashes supported by iRedMail https:...
{SSHA512}FxgXDhBVYmTqoboW+ibyyzPv/wGG7y4VJtuHWrx+wfqrs/l...
-- Hashcat: Example hashes https:// hashcat.net/wiki/doku...
--- AIXは少々イレギュラーのようだ
--------
- 対応しました。[[commit:4669d6b232]] {x-php-sha256} と {...
- 上記を受けて{x-php-sha384} {SHA256} {SSHA256} {SHA384} ...
- OpenLDAPでSHA-2の指定方法があるのですね。RFCにはなって...
-- (解説とまとめです) OpenLDAP互換、という [[BugTrack/70...
-- 上にある様にInternet-Draftも発行されているので、{SMD5}...
-- x- で始まる scheme prefix は、RFC 2307に則った「その他...
-- SHA-224, SHA-512/224, SHA-512/256 が実装対象でない理由...
※PukiWiki 1.5.2 に収録されている話題はここまで
----
*** 1.5.x [#nef467d4]
- md5.inc.php について (1) SHA-384が漏れていたので追加 (2...
diff --git a/plugin/md5.inc.php b/plugin/md5.inc.php
index 854baa0..67e2bad 100644
--- a/plugin/md5.inc.php
+++ b/plugin/md5.inc.php
@@ -5,12 +5,16 @@
// License: GPL v2 or (at your option) any later version
//
// MD5 plugin: Allow to convert password/passphrase
-// * PHP sha1() -- If you have sha1() or mhash extension
// * PHP md5()
-// * PHP hash('sha256')
-// * PHP hash('sha512')
-// * LDAP SHA / SSHA -- If you have sha1() or mhash ext...
+// * PHP sha1() -- If you have sha1() or mhash extension
+// * PHP hash('sha256') -- If you have hash() (PHP 5 >=...
+// * PHP hash('sha384') --
+// * PHP hash('sha512') --
// * LDAP MD5 / SMD5
+// * LDAP SHA / SSHA -- If you have sha1() or mhash ext...
+// * LDAP SHA256 / SSHA256 -- If you have hash() (PHP 5...
+// * LDAP SHA384 / SSHA384 --
+// * LDAP SHA512 / SSHA512 --
// User interface of pkwk_hash_compute() for system admin
function plugin_md5_action()
@@ -39,6 +43,9 @@ function plugin_md5_action()
if ($algos_enabled->sha256) {
array_push($scheme_list, 'x-php-sha256', 'SHA256', '...
}
+ if ($algos_enabled->sha384) {
+ array_push($scheme_list, 'x-php-sha384', 'SHA384', '...
+ }
if ($algos_enabled->sha512) {
array_push($scheme_list, 'x-php-sha512', 'SHA512', '...
}
@@ -67,8 +74,10 @@ function plugin_md5_show_form($nophra...
}
if ($value != '') $value = 'value="' . htmlsc($value) ...
$algos_enabled = plugin_md5_get_algos_enabled();
- $sha1_checked = $md5_checked = '';
- if ($algos_enabled->sha1) {
+ $sha256_checked = $sha1_checked = $md5_checked = '';
+ if ($algos_enabled->sha256) {
+ $sha256_checked = 'checked="checked" ';
+ } elseif ($algos_enabled->sha1) {
$sha1_checked = 'checked="checked" ';
} else {
$md5_checked = 'checked="checked" ';
@@ -85,48 +94,68 @@ EOD;
<input type="hidden" name="plugin" value="md5" />
<label for="_p_md5_phrase">Phrase:</label>
<input type="text" name="phrase" id="_p_md5_phrase" ...
+
+
EOD;
- $form .= <<<EOD
- <input type="radio" name="scheme" id="_p_md5_md5" va...
- <label for="_p_md5_md5">PHP md5</label><br />
+ if ($algos_enabled->sha512) $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_sha512" ...
+ <label for="_p_md5_sha512">PHP sha512</label><br />
+
EOD;
- if ($algos_enabled->sha1) $form .= <<<EOD
- <input type="radio" name="scheme" id="_p_md5_sha1" va...
- <label for="_p_md5_sha1">PHP sha1</label><br />
+ if ($algos_enabled->sha384) $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_sha384" ...
+ <label for="_p_md5_sha384">PHP sha384</label><br />
+
EOD;
if ($algos_enabled->sha256) $form .= <<<EOD
<input type="radio" name="scheme" id="_p_md5_sha256" ...
<label for="_p_md5_sha256">PHP sha256</label><br />
+
+EOD;
+ if ($algos_enabled->sha1) $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_sha1" va...
+ <label for="_p_md5_sha1">PHP sha1</label><br />
+
+EOD;
+ $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_md5" va...
+ <label for="_p_md5_md5">PHP md5</label><br />
+
EOD;
if ($algos_enabled->sha512) $form .= <<<EOD
- <input type="radio" name="scheme" id="_p_md5_sha512" ...
- <label for="_p_md5_sha512">PHP sha512</label><br />
+ <input type="radio" name="scheme" id="_p_md5_lssha512...
+ <label for="_p_md5_lssha512">LDAP SSHA512 (sha-512 wi...
+ <input type="radio" name="scheme" id="_p_md5_lsha512"...
+ <label for="_p_md5_lsha512">LDAP SHA512 (sha-512)</la...
+
+EOD;
+ if ($algos_enabled->sha384) $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_lssha384...
+ <label for="_p_md5_lssha384">LDAP SSHA384 (sha-384 wi...
+ <input type="radio" name="scheme" id="_p_md5_lsha384"...
+ <label for="_p_md5_lsha384">LDAP SHA384 (sha-384)</la...
+
+EOD;
+ if ($algos_enabled->sha256) $form .= <<<EOD
+ <input type="radio" name="scheme" id="_p_md5_lssha256...
+ <label for="_p_md5_lssha256">LDAP SSHA256 (sha-256 wi...
+ <input type="radio" name="scheme" id="_p_md5_lsha256"...
+ <label for="_p_md5_lsha256">LDAP SHA256 (sha-256)</la...
+
EOD;
if ($algos_enabled->sha1) $form .= <<<EOD
<input type="radio" name="scheme" id="_p_md5_lssha" v...
<label for="_p_md5_lssha">LDAP SSHA (sha-1 with a see...
<input type="radio" name="scheme" id="_p_md5_lsha" va...
<label for="_p_md5_lsha">LDAP SHA (sha-1)</label><br />
+
EOD;
$form .= <<<EOD
<input type="radio" name="scheme" id="_p_md5_lsmd5" v...
<label for="_p_md5_lsmd5">LDAP SMD5 (md5 with a seed)...
<input type="radio" name="scheme" id="_p_md5_lmd5" va...
<label for="_p_md5_lmd5">LDAP MD5</label><br />
-EOD;
- if ($algos_enabled->sha256) $form .= <<<EOD
- <input type="radio" name="scheme" id="_p_md5_lssha256...
- <label for="_p_md5_lssha256">LDAP SSHA256 (sha256 wit...
- <input type="radio" name="scheme" id="_p_md5_lsha256"...
- <label for="_p_md5_lsha256">LDAP SHA256</label><br />
-EOD;
- if ($algos_enabled->sha512) $form .= <<<EOD
- <input type="radio" name="scheme" id="_p_md5_lssha512...
- <label for="_p_md5_lssha512">LDAP SSHA512 (sha512 wit...
- <input type="radio" name="scheme" id="_p_md5_lsha512"...
- <label for="_p_md5_lsha512">LDAP SHA512</label><br />
-EOD;
- $form .= <<<EOD
+
<input type="checkbox" name="prefix" id="_p_md5_prefi...
<label for="_p_md5_prefix">Add scheme prefix (RFC2307...
@@ -139,6 +168,7 @@ EOD;
<p>* = Salt enabled<p/>
</div>
</form>
+
EOD;
return $form;
@@ -149,21 +179,11 @@ EOD;
*/
function plugin_md5_get_algos_enabled()
{
- $sha1_enabled = function_exists('sha1');
- $sha256_enabled = false;
- $sha512_enabled = false;
- if (function_exists('hash') && function_exists('hash_a...
- $algos = hash_algos();
- if (in_array('sha256', $algos)) {
- $sha256_enabled = true;
- }
- if (in_array('sha512', $algos)) {
- $sha512_enabled = true;
- }
- }
+ $algos = function_exists('hash_algos') ? hash_algos() ...
return (object) array(
- 'sha1' => $sha1_enabled,
- 'sha256' => $sha256_enabled,
- 'sha512' => $sha512_enabled,
+ 'sha1' => function_exists('sha1'),
+ 'sha256' => in_array('sha256', $algos),
+ 'sha384' => in_array('sha384', $algos),
+ 'sha512' => in_array('sha512', $algos),
);
}
#comment
ページ名: