Advertisement
Guest User

encodePass

a guest
Oct 14th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public static string EncodePassword(string pass, string salt) //encrypt password
  2. {
  3. byte[] bytes = Encoding.Unicode.GetBytes(pass);
  4. byte[] src = Encoding.Unicode.GetBytes(salt);
  5. byte[] dst = new byte[src.Length + bytes.Length];
  6. Buffer.BlockCopy(src, 0, dst, 0, src.Length);
  7. Buffer.BlockCopy(bytes, 0, dst, src.Length, bytes.Length);
  8. HashAlgorithm algorithm = HashAlgorithm.Create("SHA1");
  9. byte[] inArray = algorithm.ComputeHash(dst);
  10. //return Convert.ToBase64String(inArray);
  11. return EncodePasswordMd5(Convert.ToBase64String(inArray));
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement