Added optional salt for autogenerated hash
Added method to remove duplicate code