xref: /onnv-gate/usr/src/common/openssl/crypto/des/t/test (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateBEGIN { push(@INC, qw(../../../lib ../../lib ../lib lib)); }
4*0Sstevel@tonic-gate
5*0Sstevel@tonic-gateuse DES;
6*0Sstevel@tonic-gate
7*0Sstevel@tonic-gate$key='00000000';
8*0Sstevel@tonic-gate$ks=DES::set_key($key);
9*0Sstevel@tonic-gate@a=split(//,$ks);
10*0Sstevel@tonic-gateforeach (@a) { printf "%02x-",ord($_); }
11*0Sstevel@tonic-gateprint "\n";
12*0Sstevel@tonic-gate
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gate$key=DES::random_key();
15*0Sstevel@tonic-gateprint "($_)\n";
16*0Sstevel@tonic-gate@a=split(//,$key);
17*0Sstevel@tonic-gateforeach (@a) { printf "%02x-",ord($_); }
18*0Sstevel@tonic-gateprint "\n";
19*0Sstevel@tonic-gate$str="this is and again into the breach";
20*0Sstevel@tonic-gate($k1,$k2)=DES::string_to_2keys($str);
21*0Sstevel@tonic-gate@a=split(//,$k1);
22*0Sstevel@tonic-gateforeach (@a) { printf "%02x-",ord($_); }
23*0Sstevel@tonic-gateprint "\n";
24*0Sstevel@tonic-gate@a=split(//,$k2);
25*0Sstevel@tonic-gateforeach (@a) { printf "%02x-",ord($_); }
26*0Sstevel@tonic-gateprint "\n";
27*0Sstevel@tonic-gate
28