FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1841
|
||||
|
||||
Cita:
|
#1842
|
||||
|
||||
Cita:
Yo lo que creo es que tristemente la gente que tiene que definir estos asuntos parece que no están en este mundo y que no han visto una factura en su puñetera vida. Saludos.
__________________
Be water my friend. |
#1843
|
|||
|
|||
Fijo que después de esto van a permitir ambas posibilidades.
Y sinceramente, me extrañaría que no fueran conscientes de lo que se va comentando en los foros sobre el tema, y como este foro tampoco hay muchos. Como comentaban hace unos post, esperamos una paralela los quejicas. |
#1844
|
||||
|
||||
Cita:
No no zeñó ispestor.... yo zoy gueno y no hablo malamente de nuestros dioses. Ezo habrá zido otro
__________________
Be water my friend. |
#1845
|
|||
|
|||
Crear Hash
Hola, buenas , aprovechando que han actualizado la documentacion de como crear la huella, aprovecho para postear la clase que uso en c# para generarla, la he prbado con los ejemplos del documento y me funciona ok, las salidas a consola, las podeis eliminar sin problema.
Código:
public class Huella { /// <summary> /// Clase que devuelve el hash en mayusculas como nos indica la web /// </summary> /// <param name="source">Cadena a encriptar.</param> /// <returns>Hash de la cadena.</returns>public string creaHuella(string source) { string hash = ""; using (SHA256 sha256Hash = SHA256.Create()) { hash = GetHash(sha256Hash, source); return hash.ToUpper(); } private static string GetHash(HashAlgorithm hashAlgorithm, string input) { // Convert the input string to a byte array and compute the hash. byte[] data = hashAlgorithm.ComputeHash(Encoding.UTF8.GetBytes(input)); // Create a new Stringbuilder to collect the bytes // and create a string. var sBuilder = new StringBuilder(); // Loop through each byte of the hashed data // and format each one as a hexadecimal string. for (int i = 0; i < data.Length; i++) { sBuilder.Append(data[i].ToString("x2")); } // Return the hexadecimal string. return sBuilder.ToString(); } // Verify a hash against a string. private static bool VerifyHash(HashAlgorithm hashAlgorithm, string input, string hash) { // Hash the input. var hashOfInput = GetHash(hashAlgorithm, input); // Create a StringComparer an compare the hashes. StringComparer comparer = StringComparer.OrdinalIgnoreCase; return comparer.Compare(hashOfInput, hash) == 0; } } |
#1846
|
|||
|
|||
Código:
public class Huella { /// <summary> /// Clase que devuelve el hash en mayusculas como nos indica la web /// </summary> /// <param name="source">Cadena a encriptar.</param> /// <returns>Hash de la cadena.</returns>public string creaHuella(string source) { string hash = ""; using (SHA256 sha256Hash = SHA256.Create()) { hash = GetHash(sha256Hash, source); return hash.ToUpper(); } } private static string GetHash(HashAlgorithm hashAlgorithm, string input) { // Convert the input string to a byte array and compute the hash. byte[] data = hashAlgorithm.ComputeHash(Encoding.UTF8.GetBytes(input)); // Create a new Stringbuilder to collect the bytes // and create a string. var sBuilder = new StringBuilder(); // Loop through each byte of the hashed data // and format each one as a hexadecimal string. for (int i = 0; i < data.Length; i++) { sBuilder.Append(data[i].ToString("x2")); } // Return the hexadecimal string. return sBuilder.ToString(); } // Verify a hash against a string. private static bool VerifyHash(HashAlgorithm hashAlgorithm, string input, string hash) { // Hash the input. var hashOfInput = GetHash(hashAlgorithm, input); // Create a StringComparer an compare the hashes. StringComparer comparer = StringComparer.OrdinalIgnoreCase; return comparer.Compare(hashOfInput, hash) == 0; } } |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Hijo de Informáticos | gluglu | Humor | 3 | 13-03-2007 11:05:35 |
Adictos informaticos ... | Trigger | Humor | 2 | 11-10-2004 12:18:32 |
Nosotros los Informáticos | Trigger | Humor | 1 | 10-10-2004 14:58:09 |
Patrón de los Informáticos. | obiwuan | Varios | 20 | 10-09-2003 14:44:54 |
Chistes Informaticos | jhonny | Humor | 2 | 11-08-2003 21:59:09 |
|