There is some code we have. It implements part of its security by calculating a digest that is not entirely unlike MD5. Well, to be exact, it's specified as taking the
Digest::MD5 source code
/* Start state */
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
ctx->C = 0x98badcfe;
ctx->D = 0x10325476;
/* message length */
ctx->bytes_low = ctx->bytes_high = 0;
and replacing those 4 values with 4 others.
Now, I don't like repeating myself (in code at least. Real life is another matter) and I was trying to find a way to avoid having a complete patched fork of the
Digest::MD5 source. That's a static C function, so I can't replace it in a subclass. I've skimmed the source, and I can't see any way to directly knobble
D. Am I right in thinking that changing the start state in this fashion before digesting a string
$glurpp is exactly equivalent to computing the (true) MD5 of a string
$prefix is some fixed prefix string that I don't know yet? If yes, is there any efficient way of computing that prefix, short of brute force?