Crypt::MySQL - emulate MySQL PASSWORD() function.


Crypt-MySQL documentation Contained in the Crypt-MySQL distribution.

Index


Code Index:

NAME

Top

Crypt::MySQL - emulate MySQL PASSWORD() function.

SYNOPSIS

Top

  use Crypt::MySQL qw(password password41);

  my $encrypted = password("foobar"); # for MySQL 3.23, 4.0

  my $encrypted = password41("foobar"); # for MySQL 4.1 or later.

DESCRIPTION

Top

Crypt::MySQL emulates MySQL PASSWORD() SQL function, without libmysqlclient. You can compare encrypted passwords, without real MySQL environment.

AUTHOR

Top

IKEBE Tomohiro <ikebe@shebang.jp>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Top

DBD::mysql Digest::SHA1


Crypt-MySQL documentation Contained in the Crypt-MySQL distribution.

package Crypt::MySQL;

use strict;
use vars qw($VERSION @ISA @EXPORT_OK);
use Digest::SHA1 qw(sha1 sha1_hex);

BEGIN {
    $VERSION = '0.04';
    if ($] > 5.006) {
        require XSLoader;
        XSLoader::load(__PACKAGE__, $VERSION);
    } else {
        require DynaLoader;
        @ISA = qw(DynaLoader);
        __PACKAGE__->bootstrap;
    }
    require Exporter;
    push @ISA, 'Exporter';
    @EXPORT_OK = qw(password password41);
}

sub password41($) { "*".uc(sha1_hex(sha1($_[0]))); }

1;
__END__