Hasty Briefsbeta

Bilingual

Diels-grabsch2: Self Hashing C Program (2019)

5 days ago
  • #SHA-512
  • #Obfuscation
  • #Quine
  • The program prints its own SHA-512 hash, verified by comparing the output of sha512sum and the program itself.
  • It started as a complex 'hello world' program that evolved into printing its SHA-512 hash, leveraging mathematical techniques rather than brute force.
  • The program is a quine, aware of its own source code, but instead of printing the source, it computes and prints its SHA-512 hash.
  • Key obfuscation techniques include hiding the quine nature and the SHA-512 computation, achieved algorithmically.
  • The SHA-512 computation is optimized for the specific case of adding one block and finalizing, with round constants calculated at runtime to avoid detection.
  • Calculating the 64-bit precision cube roots of the first 80 primes for round constants presented challenges, solved using integer arithmetic and bisection.
  • The program is portable C99, avoiding non-standard extensions, and fits intermediate results into 64-bit operations despite the complexity.
  • An open problem remains: whether the cubing and bisection can be implemented with two parts instead of three, simplifying the process.