finally found the right way to encode password