File: README

package info (click to toggle)
libmojolicious-plugin-bcrypt-perl 0.14-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 108 kB
  • sloc: perl: 100; makefile: 2
file content (74 lines) | stat: -rw-r--r-- 1,976 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
NAME
    Mojolicious::Plugin::Bcrypt - bcrypt your passwords!

VERSION
    Version 0.04

SYNOPSIS
    Provides a helper for crypting and validating passwords via bcrypt.

        use Mojolicious::Plugin::Bcrypt;

        sub startup {
            my $self = shift;
            $self->plugin('bcrypt', { cost => 4 });
        }

        ...

    Optional parameter "cost" is a non-negative integer controlling the cost
    of the hash function. The number of operations is proportional to
    2^cost. The current default value is 6.

HELPERS
  bcrypt
    Crypts a password via the bcrypt algorithm.

        $self->bcrypt( $password, $settings );

    $settings is an optional string which encodes the algorithm parameters,
    as described in Crypt::Eksblowfish::Bcrypt.

        sub signup {
            my $self = shift;
            my $crypted_pass = $self->bcrypt( $self->param('password') );
            ...
        }

  bcrypt_validate
    Validates a password against a crypted copy (for example from your
    database).

        sub login {
            my $self = shift;
            my $entered_pass = $self->param('password');
            my $crypted_pass = $self->get_password_from_db();
            if ( $self->bcrypt_validate( $entered_pass, $crypted_pass ) ) {

                # Authenticated
                ...;
            }
            else {

                # Wrong password
                ...;
            }
        }

DEVELOPMENT AND REPOSITORY
    Clone it on GitHub at
    https://github.com/naturalist/Mojolicious--Plugin--Bcrypt

SEE ALSO
    Crypt::Eksblowfish::Bcrypt, Mojolicious, Mojolicious::Plugin

AUTHOR
    Stefan G., "<minimal at cpan.org>"

LICENSE AND COPYRIGHT
    This program is free software; you can redistribute it and/or modify it
    under the terms of either: the GNU General Public License as published
    by the Free Software Foundation; or the Artistic License.

    See http://dev.perl.org/licenses/ for more information.