5 //==================================================
7 //==================================================
13 Windows, ShellApi, Forms,
15 Classes, SysUtils, DateUtils;
17 //==================================================
19 //==================================================
21 //
\82í
\82¯
\82í
\82©
\82ç
\82¸
\8dì
\82Á
\82Ä
\82é
\82©
\82ç
\83o
\83O
\82¾
\82ç
\82¯
\82©
\82à
22 XMLDictionary = Record
31 FAttributeCount : Integer;
32 FChildNodes : IXMLNode;
33 FNodes : array of IXMLNode;
34 FAttributes : array of XMLDictionary;
35 function GetAttribute( const Name : string ) : string;
36 function GetNode( Index : Integer ) : IXMLNode;
40 property NodeName : string read FNodeName write FNodeName;
41 property Attributes[ const Name : string ] : string read GetAttribute;
42 property Node[ Index : Integer ] : IXMLNode read GetNode; default;
43 property ChildNodes : IXMLNode read FChildNodes write FChildNodes;
44 property Count : Integer read FCount write FCount;
45 procedure Add( node : IXMLNode );
46 procedure AddAttribute( const Name : string; const Value : string );
49 IXMLDocument = class( IXMLNode )
51 function GetDocumentElement() : IXMLNode;
53 property DocumentElement : IXMLNode read GetDocumentElement;
57 b_data : array [0..63] of char;
59 PCryptBlock = ^CryptBlock;
61 CryptOrdering = record
62 o_data : array [0..63] of char;
70 procedure ExtractHttpFields(
71 const chrSep : TSysCharSet;
72 const chrWhite : TSysCharSet;
73 const strValue : string;
74 var strResult : TStringList;
75 unknownFlag : boolean = false );
78 const strValue : string
82 const strValue : string
86 const strValue : string
90 const filename, mask : string
93 procedure FileThruUntil(
95 const untilSet : TSysCharSet
98 procedure FileThruWhile(
100 const whileSet : TSysCharSet
103 function XMLCloseCheck(
108 out closed : boolean //
\8cÄ
\82Ñ
\8fo
\82µ
\82½
\83\8b\81[
\83`
\83\93\82ª node
\82ð
\95Â
\82¶
\82é
\82×
\82«
\82È
\82ç true
109 ) : boolean; // ch
\82ð
\82±
\82Ì
\83\8b\81[
\83`
\83\93\82ª
\8f\88\97\9d\82µ
\82½
\82È
\82ç true
111 function XMLReadNode(
114 ) : string; // node
\88È
\8aO
\82Ì
\83m
\81[
\83h
\82ª
\95Â
\82¶
\82ç
\82ê
\82½
\8fê
\8d\87\82Ì
\83m
\81[
\83h
\96¼
116 function LoadXMLDocument(
117 const fileName : string
120 function get_2ch_trip(
124 //==================================================
126 //==================================================
127 kXMLWhite : TSysCharSet = [#0..#$20];
128 kXMLDQuote : TSysCharSet = ['"'];
129 kXMLTagStart : TSysCharSet = ['<'];
130 kXMLTagEnd : TSysCharSet = ['>'];
131 kXMLKanji : TSysCharSet = [#$80..#$A0, #$E0..#$ff];
132 kCryptInitialTr : CryptOrdering = ( o_data: (
133 #58,#50,#42,#34,#26,#18,#10, #2,#60,#52,#44,#36,#28,#20,#12, #4,
134 #62,#54,#46,#38,#30,#22,#14, #6,#64,#56,#48,#40,#32,#24,#16, #8,
135 #57,#49,#41,#33,#25,#17, #9, #1,#59,#51,#43,#35,#27,#19,#11, #3,
136 #61,#53,#45,#37,#29,#21,#13, #5,#63,#55,#47,#39,#31,#23,#15, #7
139 kCryptFinalTr : CryptOrdering = ( o_data: (
140 #40, #8,#48,#16,#56,#24,#64,#32,#39, #7,#47,#15,#55,#23,#63,#31,
141 #38, #6,#46,#14,#54,#22,#62,#30,#37, #5,#45,#13,#53,#21,#61,#29,
142 #36, #4,#44,#12,#52,#20,#60,#28,#35, #3,#43,#11,#51,#19,#59,#27,
143 #34, #2,#42,#10,#50,#18,#58,#26,#33, #1,#41, #9,#49,#17,#57,#25
146 kCryptSwap : CryptOrdering = ( o_data: (
147 #33,#34,#35,#36,#37,#38,#39,#40,#41,#42,#43,#44,#45,#46,#47,#48,
148 #49,#50,#51,#52,#53,#54,#55,#56,#57,#58,#59,#60,#61,#62,#63,#64,
149 #1, #2, #3, #4, #5, #6, #7, #8, #9,#10,#11,#12,#13,#14,#15,#16,
150 #17,#18,#19,#20,#21,#22,#23,#24,#25,#26,#27,#28,#29,#30,#31,#32
153 kCryptKeyTr1 : CryptOrdering = ( o_data: (
154 #57, #49, #41, #33, #25, #17, #9, #1, #58, #50, #42, #34, #26, #18,
155 #10, #2, #59, #51, #43, #35, #27, #19, #11, #3, #60, #52, #44, #36,
156 #63, #55, #47, #39, #31, #23, #15, #7, #62, #54, #46, #38, #30, #22,
157 #14, #6, #61, #53, #45, #37, #29, #21, #13, #5, #28, #20, #12, #4,
158 #0, #0, #0, #0, #0, #0, #0, #0
161 kCryptKeyTr2 : CryptOrdering = ( o_data: (
162 #14,#17,#11,#24, #1, #5, #3,#28,#15, #6,#21,#10,
163 #23,#19,#12, #4,#26, #8,#16, #7,#27,#20,#13, #2,
164 #41,#52,#31,#37,#47,#55,#30,#40,#51,#45,#33,#48,
165 #44,#49,#39,#56,#34,#53,#46,#42,#50,#36,#29,#32,
166 #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0,
170 kCryptEtr : CryptOrdering = ( o_data: (
171 #32, #1, #2, #3, #4, #5, #4, #5, #6, #7, #8, #9,
172 #8, #9,#10,#11,#12,#13,#12,#13,#14,#15,#16,#17,
173 #16,#17,#18,#19,#20,#21,#20,#21,#22,#23,#24,#25,
174 #24,#25,#26,#27,#28,#29,#28,#29,#30,#31,#32, #1,
175 #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0,
179 kCryptPtr : CryptOrdering = ( o_data: (
180 #16, #7,#20,#21,#29,#12,#28,#17, #1,#15,#23,#26, #5,#18,#31,#10,
181 #2, #8,#24,#14,#32,#27, #3, #9,#19,#13,#30, #6,#22,#11, #4,#25,
182 #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0,
183 #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0
186 kCryptS_boxes : array [ 0..7, 0..63 ] of Char = (
187 ( #14, #4,#13, #1, #2,#15,#11, #8, #3,#10, #6,#12, #5, #9, #0, #7,
188 #0,#15, #7, #4,#14, #2,#13, #1,#10, #6,#12,#11, #9, #5, #3, #8,
189 #4, #1,#14, #8,#13, #6, #2,#11,#15,#12, #9, #7, #3,#10, #5, #0,
190 #15,#12, #8, #2, #4, #9, #1, #7, #5,#11, #3,#14,#10, #0, #6,#13
193 ( #15, #1, #8,#14, #6,#11, #3, #4, #9, #7, #2,#13,#12, #0, #5,#10,
194 #3,#13, #4, #7,#15, #2, #8,#14,#12, #0, #1,#10, #6, #9,#11, #5,
195 #0,#14, #7,#11,#10, #4,#13, #1, #5, #8,#12, #6, #9, #3, #2,#15,
196 #13, #8,#10, #1, #3,#15, #4, #2,#11, #6, #7,#12, #0, #5,#14, #9
199 ( #10, #0, #9,#14, #6, #3,#15, #5, #1,#13,#12, #7,#11, #4, #2, #8,
200 #13, #7, #0, #9, #3, #4, #6,#10, #2, #8, #5,#14,#12,#11,#15, #1,
201 #13, #6, #4, #9, #8,#15, #3, #0,#11, #1, #2,#12, #5,#10,#14, #7,
202 #1,#10,#13, #0, #6, #9, #8, #7, #4,#15,#14, #3,#11, #5, #2,#12
205 ( #7,#13,#14, #3, #0, #6, #9,#10, #1, #2, #8, #5,#11,#12, #4,#15,
206 #13, #8,#11, #5, #6,#15, #0, #3, #4, #7, #2,#12, #1,#10,#14, #9,
207 #10, #6, #9, #0,#12,#11, #7,#13,#15, #1, #3,#14, #5, #2, #8, #4,
208 #3,#15, #0, #6,#10, #1,#13, #8, #9, #4, #5,#11,#12, #7, #2,#14
211 ( #2,#12, #4, #1, #7,#10,#11, #6, #8, #5, #3,#15,#13, #0,#14, #9,
212 #14,#11, #2,#12, #4, #7,#13, #1, #5, #0,#15,#10, #3, #9, #8, #6,
213 #4, #2, #1,#11,#10,#13, #7, #8,#15, #9,#12, #5, #6, #3, #0,#14,
214 #11, #8,#12, #7, #1,#14, #2,#13, #6,#15, #0, #9,#10, #4, #5, #3
217 ( #12, #1,#10,#15, #9, #2, #6, #8, #0,#13, #3, #4,#14, #7, #5,#11,
218 #10,#15, #4, #2, #7,#12, #9, #5, #6, #1,#13,#14, #0,#11, #3, #8,
219 #9,#14,#15, #5, #2, #8,#12, #3, #7, #0, #4,#10, #1,#13,#11, #6,
220 #4, #3, #2,#12, #9, #5,#15,#10,#11,#14, #1, #7, #6, #0, #8,#13
223 ( #4,#11, #2,#14,#15, #0, #8,#13, #3,#12, #9, #7, #5,#10, #6, #1,
224 #13, #0,#11, #7, #4, #9, #1,#10,#14, #3, #5,#12, #2,#15, #8, #6,
225 #1, #4,#11,#13,#12, #3, #7,#14,#10,#15, #6, #8, #0, #5, #9, #2,
226 #6,#11,#13, #8, #1, #4,#10, #7, #9, #5, #0,#15,#14, #2, #3,#12
229 ( #13, #2, #8, #4, #6,#15,#11, #1,#10, #9, #3,#14, #5, #0,#12, #7,
230 #1,#15,#13, #8,#10, #3, #7, #4,#12, #5, #6,#11, #0,#14, #9, #2,
231 #7,#11, #4, #1, #9,#12,#14, #2, #0, #6,#10,#13,#15, #3, #5, #8,
232 #2, #1,#14, #7, #4,#10, #8,#13,#15,#12, #9, #0, #3, #5, #6,#11
236 kCryptRots : array [ 0..15 ] of Integer = (
237 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1
240 //==================================================
242 //==================================================
245 constructor IXMLNode.Create();
250 function IXMLNode.GetAttribute( const Name : string ) : string;
255 while i < FAttributeCount do
257 if Name = FAttributes[ i ].Name then
259 Result := FAttributes[ i ].Value;
267 function IXMLNode.GetNode( Index : Integer ) : IXMLNode;
269 Result := FNodes[ Index ];
272 procedure IXMLNode.Add( node : IXMLNode );
275 SetLength( FNodes, FCount );
276 FNodes[ FCount - 1 ] := node;
279 procedure IXMLNode.AddAttribute(
286 index := FAttributeCount;
287 Inc( FAttributeCount );
288 SetLength( FAttributes, FAttributeCount );
289 FAttributes[ index ].Name := Name;
290 FAttributes[ index ].Value := Value;
293 function IXMLDocument.GetDocumentElement() : IXMLNode;
295 Result := FChildNodes[ 0 ];
298 //
\82Æ
\82è
\82 \82¦
\82¸
\82Ì
\91ã
\97p
\95i
\82È
\82Ì
\82Å chrWhite
\82ð
\8dl
\97¶
\82µ
\82Ä
\82¢
\82È
\82¢
\82±
\82Æ
\82É
\92\8d\88Ó
\81I
\81I
\81I
299 procedure ExtractHttpFields(
300 const chrSep : TSysCharSet;
301 const chrWhite : TSysCharSet;
302 const strValue : string;
303 var strResult : TStringList;
304 unknownFlag : boolean = false
307 last, p, strLen : Integer;
310 strLen := Length( strValue );
317 if strValue[ p ] in chrSep then
319 strResult.Add( Copy( strValue, last, p - last ) );
328 strResult.Add( Copy( strValue, last, strLen - last + 1 ) );
333 const strValue : string
341 strLen := Length( strValue );
347 case strValue[ i ] of
350 strResult := strResult + '&';
354 strResult := strResult + '<';
358 strResult := strResult + '>';
362 strResult := strResult + '"';
366 if strValue[ i ] in kXMLKanji then
368 strResult := strResult + strValue[ i ];
371 strResult := strResult + strValue[ i ];
384 const strValue : string
390 strResult := StringReplace( strValue, '<', '<', [rfReplaceAll] );
391 strResult := StringReplace( strResult, '>', '>', [rfReplaceAll] );
392 strResult := StringReplace( strResult, '"', '"', [rfReplaceAll] );
393 strResult := StringReplace( strResult, '&', '&', [rfReplaceAll] );
400 const strValue : string
408 kHexCode : array [0..15] of char = (
409 '0', '1', '2', '3', '4', '5', '6', '7',
410 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' );
413 strLen := Length( strValue );
419 case strValue[ i ] of
420 '0' .. '9', 'a' .. 'z', 'A' .. 'Z', '*', '-', '.', '@', '_':
422 strResult := strResult + strValue[ i ];
426 b := Integer( strValue[ i ] );
427 strResult := strResult + '%'
428 + kHexCode[ b div $10 ]
429 + kHexCode[ b mod $10 ];
441 //
\82Æ
\82è
\82 \82¦
\82¸
\82Ì
\91ã
\97p
\95i
\82È
\82Ì
\82Å []
\82ð
\8eg
\82Á
\82½
\90³
\8bK
\95\
\8c»
\82ð
\8dl
\97¶
\82µ
\82Ä
\82¢
\82È
\82¢
\82±
\82Æ
\82É
\92\8d\88Ó
\81I
\81I
\81I
442 function MatchesMask(
443 const filename, mask : string
446 pName, pMask : Integer;
447 nameLen, maskLen : Integer;
451 nameLen := Length( filename );
452 maskLen := Length( mask );
456 while (pMask < maskLen) and (pName < nameLen) do
459 case mask[ pMask ] of
462 //
\82±
\82Ì 1
\8e\9a\82Í
\89½
\82à
\82µ
\82È
\82¢
467 // mask
\82ð
\91\96\8d¸
\82µ
\90Ø
\82Á
\82½
\82ç
\8fI
\97¹
468 if pMask >= maskLen then
474 // *
\82Ì
\8e\9f\82Ì
\95¶
\8e\9a\82ª
\97\88\82é
\82Ü
\82Å
\94ò
\82Î
\82·
475 chrUpMask := upcase( mask[ pMask ] );
476 while chrUpMask <> UpCase( filename[ pName ] ) do
479 if pName >= nameLen then
486 // *
\82Ì
\8e\9f\82Ì
\95¶
\8e\9a\82ª
\8c©
\82Â
\82©
\82ç
\82È
\82©
\82Á
\82½
\82ç
\8fI
\97¹
487 if chrUpMask <> UpCase( filename[ pName ] ) then
498 //
\82±
\82Ì 1
\95¶
\8e\9a\82ª
\88á
\82Á
\82½
\82ç
\8fI
\97¹
499 if UpCase( mask[ pMask ] ) <> UpCase( filename[ pName ] ) then
508 //
\8e\9f\82Ì
\95¶
\8e\9a\82Ö
514 if (pMask >= maskLen) and (pName >= nameLen) then
521 // untilSet
\82É
\82È
\82é
\82Ü
\82Å
\94ò
\82Î
\82·
522 procedure FileThruUntil(
524 const untilSet : TSysCharSet
529 while f.Position < f.Size do
531 f.ReadBuffer( ch, 1 );
532 if ch in untilSet then
534 f.Seek( -1, soFromCurrent );
536 end else if ch in kXMLKanji then
537 f.Seek( 1, soFromCurrent );
541 // whileSet
\82Ì
\8aÔ
\94ò
\82Î
\82·
542 procedure FileThruWhile(
544 const whileSet : TSysCharSet
549 while f.Position < f.Size do
551 f.ReadBuffer( ch, 1 );
552 if ch in whileSet then
554 if ch in kXMLKanji then
555 f.ReadBuffer( ch, 1 );
557 f.Seek( -1, soFromCurrent );
563 function XMLCloseCheck(
569 ) : boolean; // ch
\82ð
\82±
\82Ì
\83\8b\81[
\83`
\83\93\82ª
\8f\88\97\9d\82µ
\82½
\82È
\82ç true
580 //
\8aJ
\8en
\83^
\83O
\82Ì
\8dÅ
\8cã
\82Ü
\82Å
\93Ç
\82ñ
\82¾
582 end else if ch = '?' then
584 // <?xml?>
\82Ý
\82½
\82¢
\82È
\82â
\82Â
\81B
\82æ
\82Á
\82Ä
\96³
\8e\8b
585 FileThruUntil( f, kXMLTagEnd );
586 FileThruUntil( f, kXMLTagStart );
587 f.Seek( 1, soFromCurrent );
588 FileThruWhile( f, kXMLWhite );
591 end else if ch = '/' then
593 //
\83^
\83O
\96¼
\82ð
\93Ç
\82Ý
\8d\9e\82ñ
\82Å
\95Ô
\82·
595 FileThruUntil( f, kXMLTagEnd );
596 tagLen := f.Position - last;
597 SetLength( tag, tagLen );
599 f.Seek( last, soFromBeginning );
600 f.ReadBuffer( PChar( tag )^, tagLen );
602 f.Seek( f.Position + 1, soFromBeginning ); // '>'
\94ò
\82Î
\82µ
608 function XMLReadNode(
611 ) : string; // node
\88È
\8aO
\82Ì
\83m
\81[
\83h
\82ª
\95Â
\82¶
\82ç
\82ê
\82½
\8fê
\8d\87\82Ì
\83m
\81[
\83h
\96¼
621 attributeName : string;
622 attributeValue : string;
629 // node
\82Ì
\93Ç
\82Ý
\8d\9e\82Ý(1
\83\8b\81[
\83v
\82É
\82Â
\82« 1
\83m
\81[
\83h)
630 node.ChildNodes := IXMLNode.Create;
632 while f.Position < f.Size do
634 // NodeName
\93Ç
\82Ý
\8d\9e\82Ý
635 FileThruWhile( f, kXMLWhite );
637 while f.Position < f.Size do
639 f.ReadBuffer( ch, 1 );
641 if XMLCloseCheck( f, node, ch, tag, isClosed ) then
650 end else if ch = '<' then
652 //
\90V
\8bK
\83m
\81[
\83h
653 child := IXMLNode.Create;
654 tag := XMLReadNode( f, child );
655 node.ChildNodes.Add( child );
657 //
\83^
\83O
\82ª
\95Â
\82¶
\82ç
\82ê
\82½
658 if Length( tag ) > 0 then
660 //
\8e©
\95ª
\82Ì
\82à
\82Ì
\82©
\83`
\83F
\83b
\83N
\82µ
\82Ä
\81A
\88á
\82¦
\82Î
\90e
\82É
\95Ô
\82·
661 if tag <> node.NodeName then
667 end else if ch in kXMLWhite then
672 node.NodeName := node.NodeName + ch;
674 if ch in kXMLKanji then
676 f.ReadBuffer( ch, 1 );
677 node.NodeName := node.NodeName + ch;
682 // Attribute
\82Ì
\93Ç
\82Ý
\8d\9e\82Ý
683 while f.Position < f.Size do
685 // Attribute
\82Ì
\96¼
\91O
\82ð
\93Ç
\82Ý
\8d\9e\82Ý
687 attributeValue := '';
689 FileThruWhile( f, kXMLWhite );
691 while f.Position < f.Size do
693 f.ReadBuffer( ch, 1 );
695 if XMLCloseCheck( f, node, ch, tag, isClosed ) then
699 //
\83^
\83O
\82ª
\95Â
\82¶
\82ç
\82ê
\82½
\82Ì
\82Å
\83\8a\83^
\81[
\83\93
700 //
\81¦NodeName
\82ð
\92Ê
\89ß
\82µ
\82Ä
\82é
\82Ì
\82Å
\93r
\92\86\82Å
\95Â
\82¶
\82Ä
\82é
\82±
\82Æ
\82É
\82È
\82é
\81B
701 //
\82æ
\82Á
\82Ä
\93Æ
\97§
\83m
\81[
\83h
\81B
705 //
\8e\9f\82Ì
\83m
\81[
\83h
\82Ö
707 end else if ch = '=' then
709 //
\82±
\82±
\82©
\82ç
\82Í
\92l
\82ª
\8en
\82Ü
\82é
\82Ì
\82Å
\96¼
\91O
\82Í
\8fI
\97¹
711 end else if ch in kXMLWhite then
713 // Value
\82ª
\91¶
\8dÝ
\82µ
\82È
\82¢(
\8bK
\8ai
\8aO)
\82Ì
\82Å
\8e\9f\82Ì
\83m
\81[
\83h
\82Ö
716 attributeName := attributeName + ch;
718 if ch in kXMLKanji then
720 f.ReadBuffer( ch, 1 );
721 attributeName := attributeName + ch;
727 // Attribute
\82Ì
\92l
\82ð
\93Ç
\82Ý
\8d\9e\82Ý
728 FileThruWhile( f, kXMLWhite );
730 while f.Position < f.Size do
732 f.ReadBuffer( ch, 1 );
734 if XMLCloseCheck( f, node, ch, tag, isClosed ) then
738 if Length( attributeName ) > 0 then
739 //
\8bK
\8ai
\8aO
\82¾
\82¯
\82Ç
\82Ë
740 node.AddAttribute( attributeName, attributeValue );
742 //
\83^
\83O
\82ª
\95Â
\82¶
\82ç
\82ê
\82½
\82Ì
\82Å
\83\8a\83^
\81[
\83\93
743 //
\81¦NodeName
\82ð
\92Ê
\89ß
\82µ
\82Ä
\82é
\82Ì
\82Å
\93r
\92\86\82Å
\95Â
\82¶
\82Ä
\82é
\82±
\82Æ
\82É
\82È
\82é
\81B
744 //
\82æ
\82Á
\82Ä
\93Æ
\97§
\83m
\81[
\83h
\81B
748 //
\8e\9f\82Ì
\83m
\81[
\83h
\82Ö
750 end else if ch = '"' then
752 //
\92l
\82ª ""
\82Å
\8a\87\82ç
\82ê
\82Ä
\82é
\82Ì
\82Å(
\82Ä
\82¢
\82¤
\82©
\8a\87\82ç
\82ê
\82Ä
\82È
\82«
\82á
\82¢
\82¯
\82È
\82¢
\82ñ
\82¾
\82¯
\82Ç)
753 //
\92l
\82ð
\88ê
\8a\87\93Ç
\82Ý
\8d\9e\82Ý
755 FileThruUntil( f, kXMLDQuote );
756 tagLen := f.Position - last;
757 SetLength( attributeValue, tagLen );
759 f.Seek( last, soFromBeginning );
760 f.ReadBuffer( PChar( attributeValue )^, tagLen );
762 node.AddAttribute( attributeName, HtmlDecode( attributeValue ) );
764 //
\92l
\82ð
\93Ç
\82Ý
\8fI
\82í
\82Á
\82½
\82Ì
\82Å
\8fI
\97¹
765 f.Seek( f.Position + 1, soFromBeginning ); // '"'
\94ò
\82Î
\82µ
767 end else if ch in kXMLWhite then
769 //
\8bK
\8ai
\8aO
\82¾
\82¯
\82Ç
\82Ë
770 node.AddAttribute( attributeName, HtmlDecode( attributeValue ) );
774 //
\8bK
\8ai
\8aO
\82¾
\82¯
\82Ç
\88ê
\89\9e\8eæ
\82Á
\82Ä
\82¨
\82
775 attributeValue := attributeValue + ch;
777 if ch in kXMLKanji then
779 f.ReadBuffer( ch, 1 );
780 attributeValue := attributeValue + ch;
784 end; // Attribute
\82Ì
\93Ç
\82Ý
\8d\9e\82Ý
787 end; // // node
\82Ì
\93Ç
\82Ý
\8d\9e\82Ý(1
\83\8b\81[
\83v
\82É
\82Â
\82« 1
\83m
\81[
\83h)
792 function LoadXMLDocument(
793 const fileName : string
796 xmlMode = ( xmlHoge );
798 xmlFile : TFileStream;
802 doc := IXMLDocument.Create;
804 xmlFile := TFileStream.Create( fileName, fmOpenRead );
805 XMLReadNode( xmlFile, IXMLNode( doc ) );
828 var data : CryptBlock;
829 var t : CryptOrdering;
840 data.b_data[ n ] := x.b_data[ Integer( t.o_data[ n ] ) - 1 ];
850 data0, data28 : Char;
853 ep := @(key.b_data[ 55 ]);
854 data0 := key.b_data[ 0 ];
855 data28 := key.b_data[ 28 ];
862 key.b_data[ 27 ] := data0;
863 key.b_data[ 55 ] := data28;
868 var key : CryptBlock;
874 e, ikey, y : CryptBlock;
880 temp : CryptOrdering;
883 transpose( e, data.EP^, 48 );
884 for k := kCryptRots[ i ] downto 1
887 temp := kCryptKeyTr2; transpose( ikey, temp, 48 );
888 p := @(y.b_data[ 48 ]);
889 q := @(e.b_data[ 48 ]);
890 r := @(ikey.b_data[ 48 ]);
891 while p > y.b_data do
896 p^ := Char( Integer( q^ ) xor Integer( r^ ) );
901 ir := Integer( p^ ) shl 5; Inc( p );
902 ir := ir + Integer( p^ ) shl 3; Inc( p );
903 ir := ir + Integer( p^ ) shl 2; Inc( p );
904 ir := ir + Integer( p^ ) shl 1; Inc( p );
905 ir := ir + Integer( p^ ); Inc( p );
906 ir := ir + Integer( p^ ) shl 4; Inc( p );
908 xb := Integer( kCryptS_Boxes[ k, ir ] );
910 q^ := Char( (xb shr 3) and 1 ); Inc( q );
911 q^ := Char( (xb shr 2) and 1 ); Inc( q );
912 q^ := Char( (xb shr 1) and 1 ); Inc( q );
913 q^ := Char( xb and 1 ); Inc( q );
915 temp := kCryptPtr; transpose( x, temp, 32 );
925 temp : CryptOrdering;
927 memcpy( data.Key.b_data, k, sizeof(CryptBlock) );
928 temp := kCryptKeyTr1; transpose( data.Key, temp, 56 );
945 temp : CryptOrdering;
948 p := PCryptBlock( blck );
950 temp := kCryptInitialTr;transpose( p^, temp, 64 );
951 for i := 15 downto 0 do
960 do p^.b_data[ k ] := b.b_data[ k + 32 ];
961 f( j, key^, p^, x, data );
963 do p^.b_data[ k + 32 ] := Char( Integer( b.b_data[ k ] ) xor Integer( x.b_data[ k ] ) );
965 temp := kCryptSwap; transpose( p^, temp, 64 );
966 temp := kCryptFinalTr; transpose( p^, temp, 64 );
975 pwb : array [0..65] of char;
977 ret : array [0..15] of char;
979 new_etr : CryptOrdering;
989 data.EP := @kCryptEtr;
990 while (pw^ <> #0) and (p < pwb + 64) do
997 p^ := Char( (Integer(pw^) shr j) and 1 );
1006 while (p < pwb + 64) do
1013 setKey_r( p, data );
1015 while (p < pwb + 66) do
1021 new_etr := kCryptEtr;
1022 data.EP := @new_etr;
1023 if (salt[ 0 ] = #0) and (salt[ 1 ] = #0) then
1032 c := Char( Integer(c) - (6 + 7 + Integer('.')) )
1033 else if c > '9' then
1034 c := Char( Integer(c) - (7 + Integer('.')) )
1036 c := Char( (Integer(c) - Integer('.')) and $ff );
1040 if ((Integer(c) shr j) and 1) <> 0 then
1043 temp := Integer( new_etr.o_data[ t ] );
1044 new_etr.o_data[ t ] := new_etr.o_data[ t + 24 ];
1045 new_etr.o_data[ t + 24 ] := Char( temp );
1050 if ret[ 1 ] = #0 then
1051 ret[ 1 ] := ret[ 0 ];
1054 encrypt_r( pwb, 0, data );
1055 data.EP := @kCryptEtr;
1059 while p < pwb + 66 do
1067 c := Char( (Integer(c) shl 1) or Integer(p^) );
1071 c := Char( Integer(c) + Integer('.') );
1073 c := Char( Integer(c) + 7 );
1075 c := Char( Integer(c) + 6 );
1084 function get_2ch_trip(
1089 salt : array [0..2] of char;
1095 if pw[ 0 ] = #0 then
1101 if pw[ 1 ] <> #0 then
1103 if pw[ 2 ] <> #0 then
1107 for i := 0 to len - 1 do
1109 if ('.' <= pw[ i + 1 ]) and (pw[ i + 1 ] <= 'z' ) then
1110 salt[ i ] := pw[ i + 1 ]
1114 if Pos( salt[ i ], ':;<=>?@[\\]^_`' ) > 0 then
1115 salt[ i ] := Char( Integer( salt[ i ] ) + 7 );
1125 Result := Copy( crypt_r( pw, salt, s ), 4, 100 );