unit Trip;
-{
- \83g\83\8a\83b\83v\82Ì\90¶\90¬
+{!
+\file Trip.pas
+\brief \83g\83\8a\83b\83v\82Ì\90¶\90¬
http://ghanyan.monazilla.org/trip.html
\82ð\8c³\82É\83M\83R\83i\83r\97p\82É\88Ú\90A\82³\82¹\82Ä\82¢\82½\82¾\82«\82Ü\82µ\82½\81B
EP : ^CryptOrdering;
end;
-// \83g\83\8a\83b\83v\82Ì\90¶\90¬
+{!
+\brief \83g\83\8a\83b\83v\82Ì\90¶\90¬
+\param pw \8c³\82É\82È\82é\83p\83X\83\8f\81[\83h
+\return \90¶\90¬\82³\82ê\82½\83g\83\8a\83b\83v
+}
function get_2ch_trip(
- const pw : PChar // \8c³\82É\82È\82é\83p\83X\83\8f\81[\83h
-) : string; // \90¶\90¬\82³\82ê\82½\83g\83\8a\83b\83v
+ 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: (
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.