Android Code Snippet Get CRC32 from File

Discussion in 'Code Snippets' started by wonder, Apr 20, 2019.

  1. wonder

    wonder Expert Licensed User

    - Reflection
    - FastIO (ProBundle)
    - ByteConverter
    Sub CRC32(filename As StringAs String
    Dim r As Reflector
    Dim io As FastIO
    Dim bc As ByteConverter
    Dim data() = io.ReadArray(filename, 1024As Byte
        r.Target = r.CreateObject(
    "update"Array As Object(data), Array As String("[B"))
    Dim CRCLong = r.RunMethod("getValue"As Long
    Dim CRCBytes() = bc.LongsToBytes(Array As Long(CRCLong)) As Byte
    Dim hex = bc.HexFromBytes(CRCBytes) As String
    Return hex.SubString(8'Removes the leading zeroes
    End Sub
    Based on Erel's code. :)
    Last edited: Apr 30, 2019
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice