const pw : PChar
) : string;
+{!
+\brief \83g\83\8a\83b\83v\82Ì\90¶\90¬\82É\95K\97v\82Èsalt\82Ì\90¶\90¬
+\parm pw salt\82Ì\8c³\82É\82È\82é\83p\83X\83\8f\81[\83h
+\param salt \90¶\90¬\82µ\82½salt\82ª\8ai\94[\82³\82ê\82é (array[0..2] of char)
+}
+procedure get_salt(
+ const pw : PChar;
+ salt : PChar
+);
+
const
kCryptInitialTr : CryptOrdering = ( o_data: (
#58,#50,#42,#34,#26,#18,#10, #2,#60,#52,#44,#36,#28,#20,#12, #4,
var
s : CryptData;
salt : array [0..2] of char;
-
- i : Integer;
- len : Integer;
begin
- salt[ 0 ] := #0;
if pw[ 0 ] = #0 then
begin
Result := '';
Exit;
end;
+ get_salt( pw, salt );
+
+
+ Result := Copy( crypt_r( pw, salt, s ), 4, 100 );
+
+end;
+
+procedure get_salt(
+ const pw : PChar;
+ salt : PChar
+);
+var
+ i, len : Integer;
+begin
+ salt[ 0 ] := #0;
+
if pw[ 1 ] <> #0 then
begin
if pw[ 2 ] <> #0 then
else
salt[ i ] := '.';
- if Pos( salt[ i ], ':;<=>?@[\\]^_`' ) > 0 then
- salt[ i ] := Char( Integer( salt[ i ] ) + 7 );
+ if Pos ( salt[ i ], ':;<=>?@' ) > 0 then begin
+ salt[ i ] := Char( Integer( salt[ i ] ) + 7 );
+ end else if Pos( salt[ i ], '[\\]^_`' ) > 0 then begin
+ salt[ i ] := Char( Integer( salt[ i ] ) + 6 );
+ end;
end;
if len = 1 then
salt[ 1 ] := 'H';
salt[ 0 ] := 'H';
salt[ 1 ] := '.';
end;
-
- Result := Copy( crypt_r( pw, salt, s ), 4, 100 );
-
end;
end.