You should really be passing in the size of salt, and it isn't clear from the name that the salt comes back as a string rather than binary.