2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

メモ: mhash関数は7.0(5.3以降)でも使えた

Last updated at Posted at 2016-11-10

PHP 5.2.x から PHP 5.3.x への移行

説明

PHP 5.3.0 以降では、 Hash 拡張モジュールが mhash 拡張モジュールの動作をエミュレートするようになりました。 そのため、mhash インストールディレクトリの指定は無意味となりました。 また、hash 拡張モジュールで mhash サポートを有効にしておく必要があります。

書き方

<?php
$Input = date("Y-m-d");

$MD4Hash=bin2hex(mhash(MHASH_MD4,$Input));
echo $MD4Hash."\n";

// You could use this instead, but mhash works on PHP 4 and 5 or above
// The hash function only works on 5 or above
$MD4Hash=hash('md4',$Input);
echo $MD4Hash."\n";

両方とも 1315f4cec4dd5efd5693b1d7fbff61b9 のような同じ値が出力されることを確認。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?