Skip to content

Latest commit

 

History

History
130 lines (86 loc) · 3.49 KB

File metadata and controls

130 lines (86 loc) · 3.49 KB

������

Crypt::Blowfish - Perl���Blowfish����垩�≪�吾�ャ�若�

网�荀�

use Crypt::Blowfish;
my $cipher = new Crypt::Blowfish $key; 
my $ciphertext = $cipher->encrypt($plaintext);
my $plaintext  = $cipher->decrypt($ciphertext);

茯㋛�

Blowfish��壠七�����ʋ���垸�������������ŝ�������������с�������㏍�若�勐ぇ������������56�����ゃ�� (448�����������祉�㏍�種����˨�障�с�㏍�若��紊с����������������������с����障����������勉�≪�吾�ャ�若�˨� �櫝�純�ʋ�����綣桁����ʋ���垩�с��������������腆阪����˨����������������˨�勉�㏍�若�泣�ゃ�冴�� ��ñ����������������������с�������障�����

Crypt::Blowfish��壚札筝���勉�<�純�������������c�⓾����障��:

    blocksize()
    keysize()
    encrypt()
    decrypt()

��∽�

blocksize

����垩����㏍����壔�勐ぇ������(�����ゃ�����)���菴������障�����

Crypt::Blowfish��壔���櫔����激�勉�㏍�若��篏睡������������������櫝�純�ŝ����� ��㏍�若�勐ぇ���������菴������障��������(������罩g∈��̬�������違��2.09���������...��� �憜����虁�������障�������������壠����眼�������������勉�������c�⓾�����������)

new
my $cipher = new Crypt::Blowfish $key;

��������壔��$key���篏帥�c�〠�違�����Crypt::Blowfish BlockCipher��ŝ����吾�с�壔����� 篏���������障�����$key��勉����������˨��keysize()�����ゃ����勉�㏍�若�˨�ŝ����障�����(���絨����8�����ゃ��)

encrypt
my $cipher = new Crypt::Blowfish $key;
my $ciphertext = $cipher->encrypt($plaintext);

�����勰�∽�違��$plaintext�������垸��������$ciphertext���菴������障����� $plaintext���$ciphertext���blocksize()�����ゃ����˨�ŝ����壔����с����� (�����潟��:Blowfish���8�����ゃ����勉����㏍����壩���垩�с��)

decrypt
my $cipher = new Crypt::Blowfish $key;
my $plaintext = $cipher->decrypt($ciphertext);

�����勰�∽�違��$ciphertext���緇ï垸��������$plaintext���菴������障����� $plaintext���$ciphertext���blocksize()�����ゃ����˨�ŝ����壔����с����� (�����潟��:�����勉����潟��������荀с�����������)

篏睡��箴�

my $key = pack("H16", "0123456789ABCDEF");  # min. 8 bytes
my $cipher = new Crypt::Blowfish $key;
my $ciphertext = $cipher->encrypt("plaintex");  # SEE NOTES 
print unpack("H16", $ciphertext), "\n";

�����í����������若��

�����í����������若�������������í�若����潟�鴻����鴻����˨�ゃ����⓾��README������荀с�����������

羈���

�����勉�≪�吾�ャ�若�˨��Crypt::CBC��т戎��������������堺�ャ�障����� ����垸�������㏍����奝�i����≪�若��(Cipher Block Chaining mode)��勉�������˨�� �����勉�≪�吾�ャ�若�˨��篏帥����勉�с�������違��Crypt::CBC���perldoc���茯㏍����������� �����с�������障�����篋�絎����8�����ゃ�����������紊с����������若�帥����������ф���垸�������� ��ゃ�������с�������違��篏������������帥�ゃ����勉����㏍����奝�i����勐�í�����綽�荀���������� ��с�����������8�����ゃ�����������紊��������垸�������ŝ����勉�с�������違�������ŝ����勉����若�帥� 罩g∈�����激��8�����ゃ�������ŝ�������違�ŝ����障��������綽�荀���с�������亥�㋝�ŝ� ��������c�潟�違����⓾��������������null�����ゃ����с�����"\0"��壠�������˨�������������ñ� ��������勉�̹�í����⓾����障�������������˨���憜�����Crypt::Blowfish��勉�<�潟������� Crypt::CBC��с�勉�������í�˨�����'RandomIV'��������������壔����˨����í�潟������� ��������������壔����˨�х舟���������Crypt::CBC_R�����ŝ�ŝ�若�鴻�������������������障����������� �����ŝ����������������障��������(/dev/urandom��������勰�∫�c�勐�狗����˨�������障��) ��í�<����勐�翫����с����c�⓾�����Crypt::CBC_R��˨�ゃ����⓾��amused@pobox.com�� ��<�若�˨����⓾��������������

������莖����

Crypt::CBC, Crypt::DES, Crypt::IDEA

Bruce Schneier, Applied Cryptography, 1995, Second Edition, published by John Wiley & Sons, Inc.

���篏�罔�(COPYRIGHT)

The implementation of the Blowfish algorithm was developed by, and is copyright of, A.M. Kuchling.

Other parts of the perl extension and module are copyright of Systemics Ltd ( http://www.systemics.com/ ).

Code revisions, updates, and standalone release are copyright 1999-2001 W3Works, LLC.

篏����

Original algorithm, Bruce Shneier. Original implementation, A.M. Kuchling. Original Perl implementation, Systemics Ltd. Current maintenance by W3Works, LLC.

Current revision and maintainer: Dave Paris <amused@pobox.com>

膺肢┳���

綏����絖����(GCD00051@nifty.ne.jp)