#include "sha256.hpp"#include <stdio.h>#include <signal.h>#include <cstring>#include <string>#include <sstream>#include <iomanip>#include <iostream>

Ir al código fuente de este archivo.
Namespaces | |
| namespace | Mt77 |
Definiciones | |
| #define | Ch(x, y, z) (z ^ (x & (y ^ z))) |
| #define | Maj(x, y, z) (((x | y) & z) | (x & y)) |
| #define | S(x, n) RORc((x),(n)) |
| #define | R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) |
| #define | Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) |
| #define | Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) |
| #define | Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) |
| #define | Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) |
| #define | RND(a, b, c, d, e, f, g, h, i, ki) |
Funciones | |
| void | crypt_argchk (char *v, char *s, int d) |
| int | sha256_init (hash_state *md) |
| int | sha256_done (hash_state *md, unsigned char *out) |
| string | hexaDeHash (unsigned char *hash, int l) |
| std::string | sha256archivo (std::string narch) |
Variables | |
| struct ltc_hash_descriptor | sha256_desc |
Copiado de sha256.c y encabezados de LibTomCrypt
Definición en el archivo sha256.cpp.
| #define Ch | ( | x, | |||
| y, | |||||
| z | ) | (z ^ (x & (y ^ z))) |
Definición en la línea 78 del archivo sha256.cpp.
| #define Gamma0 | ( | x | ) | (S(x, 7) ^ S(x, 18) ^ R(x, 3)) |
Definición en la línea 84 del archivo sha256.cpp.
| #define Gamma1 | ( | x | ) | (S(x, 17) ^ S(x, 19) ^ R(x, 10)) |
Definición en la línea 85 del archivo sha256.cpp.
| #define Maj | ( | x, | |||
| y, | |||||
| z | ) | (((x | y) & z) | (x & y)) |
Definición en la línea 79 del archivo sha256.cpp.
| #define R | ( | x, | |||
| n | ) | (((x)&0xFFFFFFFFUL)>>(n)) |
Definición en la línea 81 del archivo sha256.cpp.
| #define RND | ( | a, | |||
| b, | |||||
| c, | |||||
| d, | |||||
| e, | |||||
| f, | |||||
| g, | |||||
| h, | |||||
| i, | |||||
| ki | ) |
| #define S | ( | x, | |||
| n | ) | RORc((x),(n)) |
Definición en la línea 80 del archivo sha256.cpp.
| #define Sigma0 | ( | x | ) | (S(x, 2) ^ S(x, 13) ^ S(x, 22)) |
Definición en la línea 82 del archivo sha256.cpp.
| #define Sigma1 | ( | x | ) | (S(x, 6) ^ S(x, 11) ^ S(x, 25)) |
Definición en la línea 83 del archivo sha256.cpp.
| void crypt_argchk | ( | char * | v, | |
| char * | s, | |||
| int | d | |||
| ) |
Definición en la línea 33 del archivo sha256.cpp.
| string hexaDeHash | ( | unsigned char * | hash, | |
| int | l | |||
| ) |
| int sha256_done | ( | hash_state * | md, | |
| unsigned char * | hash | |||
| ) |
Termina el cálculo para retornar el condensado final.
| md | Estado del condensado | |
| hash | [out] Destino del condensado (32 bytes) |
Definición en la línea 254 del archivo sha256.cpp.
Hace referencia a CRYPT_INVALID_ARG, CRYPT_OK, LTC_ARGCHK, STORE32H, y STORE64H.
Referenciado por sha256archivo().
| int sha256_init | ( | hash_state * | md | ) |
Inicializa el estado del condensado
| md | Estado del condensado que usted desea inicializar |
Definición en la línea 235 del archivo sha256.cpp.
Hace referencia a CRYPT_OK, sha256_state::curlen, sha256_state::length, LTC_ARGCHK, Hash_state::sha256, y sha256_state::state.
Referenciado por sha256archivo().
| std::string sha256archivo | ( | std::string | narch | ) |
Calcula sha256 al archivo dado
| narch | nombre de archivo (debe existir) |
Definición en la línea 329 del archivo sha256.cpp.
Hace referencia a hexaDeHash(), sha256_done(), sha256_init(), y sha256_process().
Referenciado por indexa(), y main().

| struct ltc_hash_descriptor sha256_desc |
Valor inicial:
{
"sha256",
0,
32,
64,
{ 2, 16, 840, 1, 101, 3, 4, 2, 1, },
9,
&sha256_init,
&sha256_process,
&sha256_done,
NULL,
NULL
}
Definición en la línea 40 del archivo sha256.cpp.
1.5.4