Revert "Revert accidentally committed changes."

This reverts commit a62ae8c7576743e24d28655c4544bf9b1b8fab8a.
Update C code for inclusion in ObjC and update scrypt to colin's latest code.