Dumpcast

The Official Forum of the Dumpcast Project
It is currently Mon Dec 18, 2017 2:28 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Nov 20, 2015 6:35 am 
Offline

Joined: Fri Nov 20, 2015 6:29 am
Posts: 1
Hi,

I have dumped a couple of rare discs and would like to post their hashes but I have absolutely no clue about how to do it.

Can anyone point me out on how to generate hashes for the dumped tracks?

Thank you


Top
 Profile  
 
PostPosted: Mon Dec 21, 2015 3:32 pm 
Offline
User avatar

Joined: Mon Jul 25, 2011 8:13 pm
Posts: 462
CLRMame Pro is what you need to do them all. It is what maddog had me use when I used to have a DC


Top
 Profile  
 
PostPosted: Fri Apr 22, 2016 7:10 pm 
Offline
User avatar

Joined: Mon Apr 18, 2016 10:15 pm
Posts: 70
I use PowerShell to generate the hash values. I borrowed some code from the link mentioned below. All you have to do is update the following code section to whatever path your files exist in.

Replace everything between the "" with your path and run the code from PowerShell ISE or save it as a ".ps1" and run let it loose. :)
Code:
$Test  = "C:\DreamCast\Crazy Taxi"


CRC32 code borrowed from greg zakharov at http://poshcode.org/4946

Full code with a bit of error handling thrown in to account for files that are in use by other programs.
Code:
$Test  = "C:\DreamCast\Crazy Taxi"
$Files = (Get-ChildItem $Test -Recurse).fullname

Write-Host $Test

ForEach ($File in $Files) {

Try {
     $New_CRC32 = Get-Crc32 $File
     $New_CRC32 = $New_CRC32 -replace ("0x","")
     $New_CRC32 = $New_CRC32.PadLeft(8,'0')
     $New_CRC32 = $New_CRC32.ToLower()
     }
     Catch {
            $New_CRC32 = "ERROR"
            }


$File_Name   = (Get-Item $File).Name
$File_Size   = (Get-Item $File).Length


Try {
     $File_MD5    = (Get-FileHash $File -Algorithm MD5 -ErrorAction Stop).Hash
     $File_MD5    = $File_MD5.ToLower()
     }
     Catch {
            $File_MD5 = "ERROR"
            }


Try {
     $File_SHA1   = (Get-FileHash $File -Algorithm SHA1 -ErrorAction Stop).Hash
     $File_SHA1   = $File_SHA1.ToLower()
     }
     Catch {
            $File_SHA1 = "ERROR"
            }


Write-Host $File_Name "size" $File_Size "crc" $New_CRC32 "md5" $File_MD5 "sha1" $File_SHA1

}


Set-Alias crc32 Get-Crc32
 
$asm = Add-Type -Mem @'
   [DllImport("ntdll.dll")]
   internal static extern UInt32 RtlComputeCrc32(
       UInt32 InitialCrc,
       Byte[] Buffer,
       Int32 Length
   );
   
   public static String ComputeCrc32(String file) {
     UInt32 crc32 = 0;
     Int32  read;
     Byte[] buf = new Byte[4096];
     
     using (FileStream fs = File.OpenRead(file)) {
       while ((read = fs.Read(buf, 0, buf.Length)) != 0)
         crc32 = RtlComputeCrc32(crc32, buf, read);
     }
           
     return ("0x" + crc32.ToString("X", CultureInfo.CurrentCulture));
   }
'@ -Name Check -NameSpace Crc32 -Using System.IO, System.Globalization -PassThru
 
function Get-Crc32 {
  <#
    .NOTES
        Author: greg zakharov
  #>
  param(
    [Parameter(Mandatory=$true, ValueFromPipeline=$true)]
    [ValidateScript({Test-Path $_})]
    [String]$FileName
  )
 
  $FileName = cvpa $FileName
  $asm::ComputeCrc32($FileName)
}



If the code refuses to run you may have to run the script with one of these commands.

in PowerShell ISE:
Code:
Set-ExecutionPolicy ByPass


or if you are running it from ".ps1" you may want to launch it from CMD prompt with this:
Code:
powershell -ExecutionPolicy ByPass -File script.ps1




P.S. By the way, it's worth mentioning that if you trade the two lines below it perfectly formats it for copy and pasting it to a code call out on this site...

Replace this:
Code:
Write-Host $File_Name "size" $File_Size "crc" $New_CRC32 "md5" $File_MD5 "sha1" $File_SHA1


With this:
Code:
Write-Host $File_Name "[color=red]size" $File_Size "[/color] [color=green]crc" $New_CRC32 "[/color] [color=blue]md5" $File_MD5 "[/color] [color=red]sha1" $File_SHA1 "[/color]"



Enjoy.... :wink:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group