Re: the remaining bugs in \x escapes (was Re: [PATCH] oct and hex in glorious 64...
[p5sagit/p5-mst-13.2.git] / t / op / crypt.t
CommitLineData
85c16d83 1use Test::More tests => 2;
17f79ebb 2use Config;
85c16d83 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 14SKIP: {
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 19 ok(crypt("HI", "HO") eq crypt(v4040.4041, "HO"), "Unicode");
20}