Rebase of Zuikki's "Scrypt-nfactor support!"

This is equivalent to https://github.com/Zuikkis/sgminer/commit/5ac07bc700dc0e0e433be04d7971e71a6f491b31 but omits the removal and re-addition of lines in `scrypt.c`.