home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / zkuste / delphi / kompon / d3456 / EHS.ZIP / setup.exe / {app} / ehshshtb.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-03-25  |  3.4 KB  |  87 lines

  1. { EC Software Help Suite
  2.  
  3.   ⌐ 2000-2001 EC Software. All rights reserved.
  4.  
  5.   This product and it's source code is protected by copyright laws and
  6.   international copyright treaties, as well as other intellectual property
  7.   laws and treaties. The product is licensed, not sold.
  8.  
  9.   The source code and sample programs in this package or parts hereof
  10.   as well as the documentation shall not be copied, modified or redistributed
  11.   without permission, explicit or implied, of the author.
  12.  
  13.  
  14.   EMail: info@ec-software.com
  15.   Internet: http://www.ec-software.com
  16.  
  17.   Disclaimer of Warranty
  18.   ----------------------
  19.  
  20.   THIS SOFTWARE AND THE ACCOMPANYING FILES ARE PROVIDED "AS IS" AND
  21.   WITHOUT WARRANTIES OF ANY KIND WHETHER EXPRESSED OR IMPLIED.
  22.  
  23.   In no event shall the author be held liable for any damages whatsoever,
  24.   including without limitation, damages for loss of business profits,
  25.   business interruption, loss of business information, or any other loss
  26.   arising from the use or inability to use the software. }
  27.  
  28.  
  29. unit ehshshtb;
  30.  
  31. interface
  32.  
  33. function GetHashValue(TopicID: string): longint;
  34.  
  35. implementation
  36.  
  37. {$Q-}
  38. function GetHashValue(TopicID: string): longint;
  39. { With credits for M. Winterhoff - this hash table is based on his
  40.   excellent documentation of the - officially undocumented - HLP file format }
  41. const
  42.    Table: array [0..255] of longint = (
  43.     $00, $D1, $D2, $D3, $D4, $D5, $D6, $D7,     //0-7
  44.     $D8, $D9, $DA, $DB, $DC, $DD, $DE, $DF,     //8-15
  45.     $E0, $E1, $E2, $E3, $E4, $E5, $E6, $E7,     //16-23
  46.     $E8, $E9, $EA, $EB, $EC, $ED, $EE, $EF,     //24-31
  47.     -16, $0B, -14, $F3, $F4, $F5, -10, -9,      //32-39
  48.     -8,  -7,  $FA, $FB, -4,  -3,  $0C, -1,      //40-47
  49.     $0A, $01, $02, $03, $04, $05, $06, $07,     //48-55
  50.     $08, $09, $0A, $0B, $0C, $0D, $0E, $0F,     //56-63
  51.     $10, $11, $12, $13, $14, $15, $16, $17,     //64-71
  52.     $18, $19, $1A, $1B, $1C, $1D, $1E, $1F,     //72-79
  53.     $20, $21, $22, $23, $24, $25, $26, $27,     //80-87
  54.     $28, $29, $2A, $0B, $0C, $0D, $0E, $0D,     //88-95
  55.     $10, $11, $12, $13, $14, $15, $16, $17,     //96-103
  56.     $18, $19, $1A, $1B, $1C, $1D, $1E, $1F,     //104-111
  57.     $20, $21, $22, $23, $24, $25, $26, $27,     //112-119
  58.     $28, $29, $2A, $2B, $2C, $2D, $2E, $2F,     //120-127
  59.    -176,-175,-174,-173,-172,-171,-170,-169,     //128-135
  60.    -168,-167,-166,-165,-164,-163,-162,-161,     //136-143
  61.    -160, $61, $62, $63, $64, $65, $66, $67,     //144-151
  62.    -152,-151,-150,-149,-148,-147,-146,-145,     //152-159
  63.    -144,-143,-142,-141,-140,-139,-138,-137,     //160-167
  64.    -136,-135,-134,-133,-132,-131,-130,-129,     //168-175
  65.    -128,-127,-126,-125,-124,-123,-122,-121,     //176-183
  66.    -120,-119,-118,-117,-116,-115,-114,-113,     //184-191
  67.    -112,-111,-110,-109,-108,-107,-106,-105,     //192-199
  68.    -104,-103,-102,-101,-100, -99, -98, -97,     //200-207
  69.     -96, -95, -94, -93, -92, -91, -90, -89,     //208-215
  70.     -88, -87, -86, -85, -84, -83, -82, -81,     //216-223
  71.     -80, -79, -78, -77, -76, -75, -74, -73,     //224-231
  72.     -72, -71, -70, -69, -68, -67, -66, -65,     //232-239
  73.     -64, -63, -62, -61, -60, -59, -58, -57,     //240-247
  74.     -56, -55, -54, -53, -52, -51, -50, -49  );  //248-255
  75. var
  76.    i: integer;
  77. begin
  78.      result := 0;
  79.      try
  80.        for I := 1 to length(TopicID) do result := (result * 43) + Table[ ord(TopicID[i]) ];
  81.      except
  82.      end;
  83. end;
  84. {$Q+}
  85.  
  86. end.
  87.