This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Skip the crypt test if no crypt.
[perl5.git] / t / op / crypt.t
1 use Test::More tests => 2;
2 use Config;
3
4 # Can't assume too much about the string returned by crypt(),
5 # and about how many bytes of the encrypted (really, hashed)
6 # string matter.
7 #
8 # HISTORICALLY the results started with the first two bytes of the salt,
9 # followed by 11 bytes from the set [./0-9A-Za-z], and only the first
10 # eight characters mattered, but those are probably no more safe
11 # bets, given alternative encryption/hashing schemes like MD5,
12 # C2 (or higher) security schemes, and non-UNIX platforms.
13
14 SKIP: {
15     skip "crypt unimplemented", 2, unless $Config{d_crypt};
16     
17     ok(substr(crypt("ab", "cd"), 2) ne substr(crypt("ab", "ce"), 2), "salt");
18
19     ok(crypt("HI", "HO") eq crypt(v4040.4041, "HO"), "Unicode");
20 }