File: 011_alternative_bcrypt.t

package info (click to toggle)
libdancer2-plugin-passphrase-perl 3.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 168 kB
  • sloc: perl: 190; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 627 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use Test::More tests => 3;

use strict;
use warnings;

use Dancer2;
use Dancer2::Plugin::Passphrase;

my $secret = "Super Secret Squirrel";
my $two_a  = '{CRYPT}$2a$04$MjkMhQxasFQod1qq56DXCOvWu6YTWk9X.EZGnmSSIbbtyEBIAixbS';
my $two_x  = '{CRYPT}$2x$04$MjkMhQxasFQod1qq56DXCOvWu6YTWk9X.EZGnmSSIbbtyEBIAixbS';
my $two_y  = '{CRYPT}$2y$04$MjkMhQxasFQod1qq56DXCOvWu6YTWk9X.EZGnmSSIbbtyEBIAixbS';

ok(passphrase($secret)->matches($two_a),  'Matches $2a$ (ambiguous bcrypt)');
ok(passphrase($secret)->matches($two_x),  'Matches $2x$ (broken bcrypt)');
ok(passphrase($secret)->matches($two_a),  'Matches $2y$ (new standard bcrypt)');