Giter Site home page Giter Site logo

bediger4000 / crc32-file-collision-generator Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 2.0 8 KB

Create files whose CRC32 value matches that of another file

License: BSD 3-Clause "New" or "Revised" License

Go 93.58% PHP 2.38% Makefile 4.05%
crc32 collision golang

crc32-file-collision-generator's Introduction

Match the CRC32 value of files

To make my Almost-Narcissist program, I needed to be able to match the CRC32 value of a given file, the source of the Almost-Narcissist itself. I could only find a PHP CRC32-matcher, and it didn't seem to work.

So I wrote a CRC32 value matcher.

I used math from:

Reversing CRC - Theory and Practice
HU Berlin Public Report SAR-PR-2006-05
Martin Stigge, Henryk Plotz, Wolf Muller, Jens-Peter Redlich

I pretty much followed their appendices to get to the final matcher.

Files

  • stdfile: 9 bytes, "123456789", CRC32 cbf43926
  • stdfile2: 4 bytes, "asd\n", CRC32 152ddece
  • bitoriented.go - Code from Appendix A.2, transliterated into Go
  • tabledriven.go - Appendix A.3, transliterated from C to Go
  • crc32.go - calculate CRC32 using standard package hash/crc32
  • matchfile.go - give back bytes to append to a file to match another file's CRC32. Appendix A.5
  • crc32.php - calculate CRC32 using PHP's library routine, just to double check.

To create a file with the same CRC32 value as another file:

$ go build matchfile.go
$ ./matchfile file_to_match some_file > bytes
$ cat bytes >> some_file
$ go build crc32.go
$ ./crc32 file_to_match some_file

To test the code:

$ make test

It should build a file with a CRC32 that matches that of stdfile.

crc32-file-collision-generator's People

Contributors

bediger4000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.