Jump to content

CRC32 Checksum Creator/Verifier (.sfv)


MadBoy
 Share

Recommended Posts

Sometime ago on forum I saw the example how to use the CRC32 (http://www.autoitscript.com/forum/index.php?showtopic=60890). So what i did is made it usable the same way that Total Commander does it, along with other minor programs for .sfv creating/verifying. All credits go to LazyCat and Laszlo for this.

checksum_verify_1.0.au3

checksum_creator_1.0.au3

Enjoy,

MadBoy

Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

hey, nice job.

but there must be an error in your verifier.

i create an sfv file, deletes some letters from checksums in the sfv-file and let it check.

verifier says that everything is fine ... but this can´t be (verifier does not check a file).

PS: Found the Error. Its caused in this line:

If $sfv_line_split[0] = 2 Then

because, what, if a file contains space in the name? than this is > 2 ;-)

PPS: my solution:

Dim $sfv_line_split[3]

$sfv_line_split[2] = StringTrimLeft($sfv_file_list[$a], StringInStr($sfv_file_list[$a], " ", 0, -1))

$sfv_line_split[1] = StringTrimRight($sfv_file_list[$a], StringLen($sfv_line_split[2])+1)

Edited by sc4ry
Link to comment
Share on other sites

hey, nice job.

but there must be an error in your verifier.

i create an sfv file, deletes some letters from checksums in the sfv-file and let it check.

verifier says that everything is fine ... but this can´t be (verifier does not check a file).

PS: Found the Error. Its caused in this line:

If $sfv_line_split[0] = 2 Then

because, what, if a file contains space in the name? than this is > 2 ;-)

PPS: my solution:

Dim $sfv_line_split[3]

$sfv_line_split[2] = StringTrimLeft($sfv_file_list[$a], StringInStr($sfv_file_list[$a], " ", 0, -1))

$sfv_line_split[1] = StringTrimRight($sfv_file_list[$a], StringLen($sfv_line_split[2])+1)

That's why downloadable files shouldn't have spaces. URL's don't like it, ftp sites dont like it :-) If you have to use space use _ . or whatever just don't use real space :-)

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

  • 10 years later...

Thanks, I just figured out:

Func _ChecksumVerify($sFileSFV)
    ; Returns 0 if success
    ; Returns $array of failed files if there was at least one failure
    ; Return 1 if file doesn't exists or something else is wrong with the file
    Local $sfv_file_list
    Local $sfv_failed[1], $sfv_passed[1]
    Local $sFileSFVDirectory = StringLeft($sFileSFV, StringInStr($sFileSFV, "\", 1, -1) - 1)
    Local $status = _FileReadToArray($sFileSFV, $sfv_file_list)
    If $status = 0 Then Return SetError(1, 0, -1)
    For $a = 1 To $sfv_file_list[0]

        If StringLeft($sfv_file_list[$a], 1) <> ";" And StringLeft($sfv_file_list[$a], 1) <> "" Then
            $sfv_line_split = StringSplit($sfv_file_list[$a], " ", 1)

            Dim $sfv_line_split[3]
            $sfv_line_split[2] = StringTrimLeft($sfv_file_list[$a], StringInStr($sfv_file_list[$a], " ", 0, -1))
            $sfv_line_split[1] = StringTrimRight($sfv_file_list[$a], StringLen($sfv_line_split[2])+1)

            ;If $sfv_line_split[0] = 2 Then
            $checksum_return = _ChecksumGetInfo($sFileSFVDirectory & "\" & $sfv_line_split[1])
            If $checksum_return = $sfv_line_split[2] Then
                ;ConsoleWrite(@CR & $sfv_line_split[1] & " -> PASSED")
                _ArrayAdd($sfv_passed, $sfv_line_split[1])
            Else
                ;ConsoleWrite(@CR & $sfv_line_split[1] & " -> FAILED")
                _ArrayAdd($sfv_failed, $sfv_line_split[1])
            EndIf
            ;EndIf
        EndIf
    Next
    $sfv_failed[0] = UBound($sfv_failed) - 1
    $sfv_passed[0] = UBound($sfv_passed) - 1
    If $sfv_failed[0] = 0 Then
        Return 0
    Else
        Return $sfv_failed
    EndIf
EndFunc   ;==>_ChecksumVerify

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...