mirror of
https://github.com/php/doc-ja.git
synced 2026-03-25 15:42:08 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@327055 c90b9560-bf6c-de11-be94-00142212c4b1
63 lines
2.3 KiB
XML
63 lines
2.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: ed119ce3ba1a8a04cd25947fb7557ffbf51f1ca3 Maintainer: takagi Status: ready -->
|
|
<!-- CREDITS: hirokawa -->
|
|
|
|
<appendix xml:id="mcrypt.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
&reftitle.examples;
|
|
<para>
|
|
mcrypt は、上に示した暗号を用いて暗号化および復号化を
|
|
行うことが可能です。<literal>libmcrypt-2.2.x</literal> とリンクした場合、4つの重要な
|
|
mcrypt コマンド (<function>mcrypt_cfb</function>,
|
|
<function>mcrypt_cbc</function>,<function>mcrypt_ecb</function>,
|
|
<function>mcrypt_ofb</function>) は、<constant>MCRYPT_ENCRYPT</constant> および
|
|
<constant>MCRYPT_DECRYPT</constant> という 2つのモードの両方で実行可能です。
|
|
</para>
|
|
<para>
|
|
libmcrypt 2.4.x または 2.5.x とリンクした場合、上記の関数も利用可能
|
|
ですが、新しい関数を使用されることを推奨します。
|
|
<example>
|
|
<title>2.4.x 以降において <literal>ECB</literal> モードで <literal>TripleDES</literal> により入力を暗号化する</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$key = "this is a secret key";
|
|
$input = "Let us meet at 9 o'clock at the secret place.";
|
|
|
|
$td = mcrypt_module_open('tripledes', '', 'ecb', '');
|
|
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
|
|
mcrypt_generic_init($td, $key, $iv);
|
|
$encrypted_data = mcrypt_generic($td, $input);
|
|
mcrypt_generic_deinit($td);
|
|
mcrypt_module_close($td);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
この例は、<literal>$encrypted_data</literal> に文字列として
|
|
暗号化されたデータを取得します。詳細な例については、
|
|
<function>mcrypt_module_open</function> を参照してください。
|
|
</para>
|
|
</appendix>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|