AnarchyOnline

Hash.xys 0.5

Jul 3rd, 2013
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.79 KB | None | 0 0
  1. "List hashes by file"
  2.  {
  3.  $Files = get('SelectedItemsPathNames', '|', 'a');
  4.  $Report = '';
  5.  
  6.  global $g_Sha1;
  7.  global $g_Md5;
  8.  global $g_Crc;
  9.  
  10.  foreach($File, $Files)
  11.  {
  12.  $Name = getpathcomponent($File , 'file', );
  13.  $Size = report('{Size B}', $File, , );
  14.  
  15.  $g_Crc = hash('crc32', $File, '1');
  16.  $g_Md5 = hash('md5', $File, '1');
  17.  $g_Sha1 = hash('sha1', $File, '1');
  18.  
  19.  $Report = <<<#
  20. $Report
  21. $Name
  22. ----------------------------------------
  23. Size: $Size Bytes
  24. CRC : $g_Crc
  25. MD5 : $g_Md5
  26. SHA : $g_Sha1
  27.  
  28. #;
  29.  }
  30.  text $Report;
  31.  }
  32.  
  33. "List hashes by checksum"
  34.  {
  35.  $Files = get('SelectedItemsPathNames', '|', 'a');
  36.  $Report = '';
  37.  
  38.  global $g_Sha1;
  39.  global $g_Md5;
  40.  global $g_Crc;
  41.  
  42.  /*
  43.   * Hash: SHA1
  44.   */
  45.  $Report = "---------------Hash: SHA1---------------<crlf>";
  46.  foreach($File, $Files)
  47.  {
  48.  $Name = getpathcomponent($File , 'file', );
  49.  $Size = report('{Size B}', $File, , );
  50.  $g_Sha1 = hash('sha1', $File, '1');
  51.  $Report = "$Report$g_Sha1 $Name <crlf>";
  52.  }
  53.  $Report = "$Report<crlf>";
  54.  
  55.   /*
  56.    * Hash: MD5
  57.    */
  58.  $Report = "$Report---------------Hash:  MD5---------------<crlf>" ;
  59.  foreach($File,$Files)
  60.  {
  61.  $Name = getpathcomponent($File , 'file', );
  62.  $Size = report('{Size B}', $File, , );
  63.  $g_Md5 = hash('md5', $File, '1');
  64.  $Report = "$Report$g_Md5         $Name <crlf>";
  65.  }
  66.  $Report = "$Report<crlf>";
  67.  
  68.   /*
  69.    * Hash: CRC32
  70.    */
  71.  $Report = "$Report---------------Hash:  CRC---------------<crlf>" ;
  72.  foreach($File,$Files)
  73.  {
  74.  $Name = getpathcomponent($File , 'file', );
  75.  $Size = report('{Size B}', $File, , );
  76.  $g_Crc = hash('crc32', $File, '1');
  77.  $Report = "$Report$g_Crc                                 $Name <crlf>";
  78.  }
  79.  
  80.  $Report = "$Report<crlf>";
  81.  text ($Report, '1000', '500', , , );
  82.  }
  83.  
  84. "Compare to known checksum"
  85.  {
  86.  $Files = get('SelectedItemsPathNames', '|', 'a');
  87.  $Checksums = input ('Hash', 'Paste text containing known checksums below:', , 'm', , , );
  88.  
  89.  global $g_Sha1;
  90.  global $g_Md5;
  91.  global $g_Crc;
  92.  
  93.  $Report = '';
  94.  
  95.  foreach($File, $Files)
  96.  {
  97.  $Name = getpathcomponent($File , 'file', );
  98.  $Size = report('{Size B}', $File, , );
  99.  
  100.  $g_Crc = hash('crc32', $File, '1');
  101.  $g_Md5 = hash('md5', $File, '1');
  102.  $g_Sha1 = hash('sha1', $File, '1');
  103.  
  104.  $Report = <<<#
  105. $Report$Name
  106. ----------------------------------------
  107. Size: $Size Bytes
  108. CRC : $g_Crc#;
  109.  $Hit = regexmatches($Checksums, $g_Crc, '|', '0');
  110.  if($Hit){
  111.  $Report = <<<#
  112. $Report
  113. >HIT: $Hit#;
  114.  }
  115.  
  116.  $Report = <<<#
  117. $Report
  118. MD5 : $g_Md5#;
  119.  $Hit = regexmatches($Checksums, $g_Md5, '|', '0');
  120.  if($Hit){
  121.  $Report = <<<#
  122. $Report
  123. >HIT: $Hit#;
  124.  }
  125.  
  126.  $Report = <<<#
  127. $Report
  128. SHA : $g_Sha1#;
  129.  $Hit = regexmatches($Checksums, $g_Sha1, '|', '0');
  130.  if($Hit){
  131.  $Report = <<<#
  132. $Report
  133. >HIT: $Hit#;
  134.  }
  135.  $Report = <<<#
  136. $Report
  137.  
  138. #;
  139.  }
  140.  text $Report;
  141.  }
Advertisement
Add Comment
Please, Sign In to add comment