| 1 | package Crypt::Passwd::XS; | ||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||
| 3 | 11 | our $VERSION = '0.701'; | |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||
| 5 | 11 | require XSLoader; | |||||||||||||||||||||||||||||
| 6 | 11 | XSLoader::load( 'Crypt::Passwd::XS', $VERSION ); | |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||
| 8 | 31 | ▶ | sub crypt { | ||||||||||||||||||||||||||||
|
Subroutine
crypt: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 9 | 31 | my $password = shift; | |||||||||||||||||||||||||||||
| 10 | 31 | my $salt = shift; | |||||||||||||||||||||||||||||
| 11 | 31 | ▶ | return unless $salt; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 12 | 29 | my $crypt_type = substr( $salt, 0, 3 ); | |||||||||||||||||||||||||||||
| 13 | 29 | ▶ | if ( $crypt_type eq '$1$' ) { | ||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||
| 14 | 2 | return unix_md5_crypt( $password, $salt ); | |||||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||||
| 16 | elsif ( $crypt_type eq '$6$' ) { | ||||||||||||||||||||||||||||||
| 17 | 7 | return unix_sha512_crypt( $password, $salt ); | |||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||
| 19 | elsif ( $crypt_type eq '$5$' ) { | ||||||||||||||||||||||||||||||
| 20 | 7 | return unix_sha256_crypt( $password, $salt ); | |||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||
| 22 | elsif ( $crypt_type eq '$y$' ) { | ||||||||||||||||||||||||||||||
| 23 | 5 | return unix_yescrypt_crypt( $password, $salt ); | |||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||
| 25 | elsif ( substr( $salt, 0, 1 ) ne '$' ) { | ||||||||||||||||||||||||||||||
| 26 | 7 | return unix_des_crypt( $password, $salt ); | |||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||
| 28 | elsif ( substr( $salt, 0, 6 ) eq '$apr1$' ) { | ||||||||||||||||||||||||||||||
| 29 | 1 | return apache_md5_crypt( $password, $salt ); | |||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||
| 31 | else { | ||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||
| 33 | # Unimplemented hashing scheme | ||||||||||||||||||||||||||||||
| 34 | 0 | return; | |||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||
| 38 | 11 | 1; | |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||
| 40 | __END__ | ||||||||||||||||||||||||||||||