LCKB
Unknown check sum in IteamAll.lod - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196)
+---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192)
+---- Thread: Unknown check sum in IteamAll.lod (/showthread.php?tid=2107)



- Maxes727 - 06-30-2013


Hi all Wink

 

Sorry for my bad english) Im new to this forum.

 

Interested in this question. Does anyone versed in the structure of itemall from the new client?

 

Particularly interested in the last 4 bytes, based on the considerations, I realized that this is the sum but how to calculate it for me is a mystery. My guess is it CRC32. Share your guesses, I will be very grateful ^_^




- Maxes727 - 07-01-2013

Buy checksum algorithm in itemall. My skype satana7272




- lawilas805 - 01-09-2016

I have the same problem. Anyone can help with an algorithm?




- ZaTii - 01-09-2016

Which Episode ?




- lawilas805 - 01-09-2016


Ep3
I'm interested in last 8 bytes:

static F1 D8 FF FF (what are these bytes?)

and checksum 37 0C A5 7A (how to calculate it?)

File if you need it:

2




- lawilas805 - 01-09-2016


I found how to calculate checksum (thanks rrbkmz)

Still don't know about this:

static F1 D8 FF FF (what are these bytes?)




- ZaTii - 01-09-2016



Ep3

I'm interested in last 8 bytes:

static F1 D8 FF FF (what are these bytes?)

and checksum 37 0C A5 7A (how to calculate it?)

File if you need it:

2

 

Use the HateMe editor, nothing else is needed.




- lawilas805 - 01-09-2016


I'm writing my own editors =)

That's why I asked this question

Hope, this bytes (C1 D8 FF FF) aren't so important Big Grin

Here's a bit of code, if someone needs: (author [member=filix_93] )

 

 

namespace Checksum
{
using System;
using System.Diagnostics;
using System.IO;

public static class DoWork
{
public static int CalculateSum(string filepath, int size)
{
int num = 0;
BinaryReader reader = new BinaryReader(File.Open(filepath, FileMode.Open));
try
{
for (int i = 0; i < size; i += 20)
{
reader.BaseStream.Seek((long) i, SeekOrigin.Begin);
num += reader.ReadInt32();
}
reader.Close();
}
catch (Exception exception)
{
Debug.WriteLine(exception);
throw exception;
}
finally
{
if (reader != null)
{
reader.Dispose();
}
}
return num;
}

public static bool CheckSumExist(string filepath)
{
return (GetCurrentSum(filepath) == CalculateSum(filepath, GetFileSize(filepath)));
}

public static bool EncodeFile(string filepath)
{
try
{
BinaryWriter writer;
int num;
Exception exception;
if (!CheckSumExist(filepath))
{
num = CalculateSum(filepath, GetFileSize(filepath));
writer = new BinaryWriter(File.OpenWrite(filepath));
try
{
writer.BaseStream.Seek(0L, SeekOrigin.End);
writer.Write(num);
writer.Close();
}
catch (Exception exception1)
{
exception = exception1;
Debug.WriteLine(exception);
throw exception;
}
finally
{
if (writer != null)
{
writer.Dispose();
}
}
return true;
}
num = CalculateSum(filepath, GetFileSize(filepath));
writer = new BinaryWriter(File.OpenWrite(filepath));
try
{
writer.BaseStream.Seek(-4L, SeekOrigin.End);
writer.Write(num);
writer.Close();
}
catch (Exception exception2)
{
exception = exception2;
Debug.WriteLine(exception);
throw exception;
}
finally
{
if (writer != null)
{
writer.Dispose();
}
}
return true;
}
catch
{
return false;
}
}

public static int GetCurrentSum(string filepath)
{
int num = 0;
BinaryReader reader = new BinaryReader(File.Open(filepath, FileMode.Open));
try
{
reader.BaseStream.Seek(-4L, SeekOrigin.End);
num = reader.ReadInt32();
reader.Close();
}
catch (Exception exception)
{
Debug.WriteLine(exception);
throw exception;
}
finally
{
if (reader != null)
{
reader.Dispose();
}
}
return num;
}

public static int GetFileSize(string filepath)
{
return Convert.ToInt32(new FileInfo(filepath).Length);
}
}
}

 

 

Solved.




- Wizatek - 01-22-2016

The original code is in the client source that you can find on this forum. 
The in Secure\FileSecure.cpp