emoose / ExCrypt

Open source replacement for the Xbox360 XeCrypt suite.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve SHA1 & MD5 update functions

emoose opened this issue · comments

(SHA1 & MD5 both seem to be able to use the same update code, since the block size for both is 64 bytes, only the transform algorithm is different between them)

Right now the ExCryptShaUpdate function code is a little bit dumb, handling inputs one byte at a time, which slows things down immensely.

XeCryptShaUpdate on the other hand uses much more optimised code, checking against the input size to see if the input could be memcpy'd directly, etc. Probably worth trying to reverse this and replacing our update function with it.

Once the Update function is more optimised it might be worth looking into using "Intel SHA Extensions" to get even more out of it.

E: It seems ShaUpdate currently isn't updating the SHA_STATE properly after being ran neither, ditto for ShaFinal IIRC. It might be worth disassembling the actual XeCrypt functions and using those instead of a third-party lib.