Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 00:51

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Help] Changing CRC32 code

Discussion on [Help] Changing CRC32 code within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2009
Posts: 2
Received Thanks: 0
[Help] Changing CRC32 code

Hi there,
I'm making a program that can calculate and change the CRC32 code of files. Now I found the CRC32 calculation but not how to change it. Someone told me that I can't change the CRC32 but I have to write a new file and then add bytes to it. Any ideas?
I'm using vb 2008

CRC32 Calculation:
Code:
Option Explicit On
Option Strict On

<System.Diagnostics.DebuggerStepThrough()> _
Friend Class CRC32

    Private crc32Table() As Integer
    Private Const BUFFER_SIZE As Integer = 1024I

    Friend Function GetCrc32(ByRef stream As System.IO.FileStream) As Integer
        Dim crc32Result As Integer = &HFFFFFFFF

        Dim buffer(BUFFER_SIZE) As Byte
        Dim readSize As Integer = BUFFER_SIZE
        Dim count As Integer = stream.Read(buffer, 0I, readSize)
        Dim i As Integer
        Dim iLookup As Integer

        Do While (count > 0I)
            For i = 0I To count - 1I
                iLookup = (crc32Result And &HFF) Xor buffer(i)
                crc32Result = ((crc32Result And &HFFFFFF00) \ &H100) And &HFFFFFF   ' nasty shr 8 with vb :/
                crc32Result = crc32Result Xor crc32Table(iLookup)
            Next i
            count = stream.Read(buffer, 0I, readSize)
        Loop
        Return Not (crc32Result)
    End Function

    Friend Function GetCrc32String(ByRef stream As System.IO.FileStream) As String
        Return String.Format("{0:X8}", GetCrc32(stream))
    End Function

    Friend Sub New()
        ' This is the official polynomial used by CRC32 in PKZip.
        ' Often the polynomial is shown reversed (04C11DB7).
        Dim dwPolynomial As Integer = &HEDB88320
        Dim i, j As Integer

        ReDim crc32Table(256I)
        Dim dwCrc As Integer

        For i = 0I To 255I
            dwCrc = i
            For j = 8I To 1I Step -1I
                If (dwCrc And 1I) > 0I Then
                    dwCrc = ((dwCrc And &HFFFFFFFE) \ 2I) And &H7FFFFFFF
                    dwCrc = dwCrc Xor dwPolynomial
                Else
                    dwCrc = ((dwCrc And &HFFFFFFFE) \ 2I) And &H7FFFFFFF
                End If
            Next j
            crc32Table(i) = dwCrc
        Next i
    End Sub
End Class
ynzedekiller5 is offline  
Reply


Similar Threads Similar Threads
CRC32
04/30/2012 - Dragonica Hacks, Bots, Cheats & Exploits - 0 Replies
how to change file firmware whithout crc32 error? I want to change the serial number no crc32 errors.
[Release] [Adler32~Crc32]
12/25/2010 - Grand Chase - 10 Replies
Here it is.. the adler and crc is coming to town.. hehe.. Juk.. http://adler32-crc32-panama.getabest.com/page-1.h tml then here http://www.woodmann.com/collaborative/tools/index .php/Category:Crypto_Tools
[Guide] Just changing the drops of VIP maps without changing of its place
10/08/2010 - EO PServer Guides & Releases - 2 Replies
in revo's DB when u add the VIP tele it apears on the old market .. some ppl dont know how to change its place thats why i made this query for them delete from cq_generator where id >= 0113 and id <= 0128; INSERT INTO `cq_generator` VALUES ('0113', '8900', '0062', '0033', '0001', '0001', '0001', '0025', '0001', '0110', '0000', '0000', '0000', '0000', '0000'); INSERT INTO `cq_generator` VALUES ('0114', '8900', '0072', '0037', '0001', '0001', '0001', '0025', '0001', '0110', '0000',...
ned crc32
10/21/2009 - Grand Chase Philippines - 3 Replies
pwd po mka inge nang link sa crc32??? nawala kasi usb ko huhu....
crc32 values
06/02/2008 - Dekaron - 3 Replies
anyone know how they are calculated for dekaron.exe and .nsse? because when you try to get the crc for the whole thing it's different from the one on the patch server.



All times are GMT +2. The time now is 00:51.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.