2 # Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
19 ok(compare1stline([qw{openssl passwd password}], '^.{13}\R$'),
20 'crypt password with random salt');
21 ok(compare1stline([qw{openssl passwd -1 password}], '^\$1\$.{8}\$.{22}\R$'),
22 'BSD style MD5 password with random salt');
23 ok(compare1stline([qw{openssl passwd -apr1 password}], '^\$apr1\$.{8}\$.{22}\R$'),
24 'Apache style MD5 password with random salt');
25 ok(compare1stline([qw{openssl passwd -salt xx password}], '^xxj31ZMTZzkVA\R$'),
26 'crypt password with salt xx');
27 ok(compare1stline([qw{openssl passwd -salt xxxxxxxx -1 password}], '^\$1\$xxxxxxxx\$UYCIxa628\.9qXjpQCjM4a\.\R$'),
28 'BSD style MD5 password with salt xxxxxxxx');
29 ok(compare1stline([qw{openssl passwd -salt xxxxxxxx -apr1 password}], '^\$apr1\$xxxxxxxx\$dxHfLAsjHkDRmG83UXe8K0\R$'),
30 'Apache style MD5 password with salt xxxxxxxx');
34 my ($cmdarray, $regexp) = @_;
35 my @lines = run(app($cmdarray), capture => 1);
37 return $lines[0] =~ m|$regexp|;