Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "
- Security:
- -> Custom SHA1
- -> Offset: 8
- -> Calculation Start: 32
- -> Calculation Length: See Code
- Additional:
- The SHA1 hash is moved to a buffer with the size of 24 bytes.
- After that the 3 UInt64 parts of the buffer are combined using XOR.
- "
- byte[] data = File.ReadAllBytes(fileName);
- using (var r = new Reader(data, Endian.BIG)) {
- r.Position = 24;
- int cLen = r.ReadInt32() + r.ReadInt32() - 32;
- byte[] hash = new byte[24];
- using (var sha = new SHA1Managed()) {
- sha.TransformFinalBlock(data, 32, cLen);
- Buffer.BlockCopy(sha.Hash, 0, hash, 0, 20);
- }
- long checksum = 0;
- fixed (byte* x = hash) {
- long* hashP = (long*) x;
- for (int i = 0; i < 3; ++i, ++hashP)
- checksum ^= *hashP;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement