Created
August 10, 2017 16:12
-
-
Save jofese/81e24f1a2535152211494beaf3415218 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string CifrarClave(string clave) | |
{ | |
//Declaramos un Objeto de tipo SHA512Managed | |
SHA512Managed passwd = new SHA512Managed(); | |
//Declarmos un arreglo bytes donde se guardara el texto a cifrar en formato de bytes | |
byte[] texto = System.Text.Encoding.ASCII.GetBytes(clave); | |
//Declaramos otro arrego de bytes donde se guardará la contraseña ya cifrada. | |
byte[] textocifrado = passwd.ComputeHash(texto); | |
//convertimo en texto lo bytes cifrado | |
string contrasena = Convert.ToBase64String(textocifrado); | |
//regresamos la contraseña cifrada | |
return contrasena; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment