Commit | Line | Data |
---|---|---|
85c16d83 | 1 | use Test::More tests => 2; |
17f79ebb | 2 | use Config; |
85c16d83 JH |
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 | ||
17f79ebb JH |
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"); | |
85c16d83 | 18 | |
17f79ebb JH |
19 | ok(crypt("HI", "HO") eq crypt(v4040.4041, "HO"), "Unicode"); |
20 | } |