Referencia del Archivo sha256.hpp

#include <signal.h>
#include <string>

Dependencia gráfica adjunta para sha256.hpp:

Este gráfico muestra que archivos directa o indirectamente incluyen a este archivo:

Ir al código fuente de este archivo.

Namespaces

namespace  Mt77

Clases

struct  sha256_state
union  Hash_state
struct  ltc_hash_descriptor

Definiciones

#define ENDIAN_LITTLE
#define CRYPT   0x0116
#define SCRYPT   "1.16"
#define MAXBLOCKSIZE   128
#define TAB_SIZE   32
#define CONST64(n)   n ## ULL
#define STORE32H(x, y)
#define LOAD32H(x, y)
#define STORE64H(x, y)
#define LOAD64H(x, y)
#define STORE32L(x, y)   { ulong32 __t = (x); XMEMCPY(y, &__t, 4); }
#define LOAD32L(x, y)   { XMEMCPY(&(x), y, 4); x &= 0xFFFFFFFF; }
#define STORE64L(x, y)   { ulong64 __t = (x); XMEMCPY(y, &__t, 8); }
#define LOAD64L(x, y)   { XMEMCPY(&(x), y, 8); }
#define BSWAP(x)
#define ROLc   ROL
#define RORc   ROR
#define ROL(x, y)   ( (((unsigned long)(x)<<(unsigned long)((y)&31)) | (((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL)
#define ROR(x, y)   ( ((((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)((y)&31)) | ((unsigned long)(x)<<(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL)
#define ROL64c   ROL64
#define ROR64c   ROR64
#define ROL64(x, y)
#define ROR64(x, y)
#define MAX(x, y)   ( ((x)>(y))?(x):(y) )
#define MIN(x, y)   ( ((x)<(y))?(x):(y) )
#define byte(x, n)   (((x) >> (8 * (n))) & 255)
#define LTC_ARGCHK(x)   if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); }
#define LTC_ARGCHKVD(x)   LTC_ARGCHK(x)
#define HASH_PROCESS(func_name, compress_name, state_var, block_size)

Tipos definidos

typedef unsigned long long ulong64
typedef unsigned ulong32
typedef union Hash_state hash_state

Enumeraciones

enum  {
  CRYPT_OK = 0, CRYPT_ERROR, CRYPT_NOP, CRYPT_INVALID_KEYSIZE,
  CRYPT_INVALID_ROUNDS, CRYPT_FAIL_TESTVECTOR, CRYPT_BUFFER_OVERFLOW, CRYPT_INVALID_PACKET,
  CRYPT_INVALID_PRNGSIZE, CRYPT_ERROR_READPRNG, CRYPT_INVALID_CIPHER, CRYPT_INVALID_HASH,
  CRYPT_INVALID_PRNG, CRYPT_MEM, CRYPT_PK_TYPE_MISMATCH, CRYPT_PK_NOT_PRIVATE,
  CRYPT_INVALID_ARG, CRYPT_FILE_NOTFOUND, CRYPT_PK_INVALID_TYPE, CRYPT_PK_INVALID_SYSTEM,
  CRYPT_PK_DUP, CRYPT_PK_NOT_FOUND, CRYPT_PK_INVALID_SIZE, CRYPT_INVALID_PRIME_SIZE,
  CRYPT_PK_INVALID_PADDING
}

Funciones

void crypt_argchk (char *v, char *s, int d)
int sha256_init (hash_state *md)
int sha256_process (hash_state *md, const unsigned char *in, unsigned long inlen)
int sha256_done (hash_state *md, unsigned char *hash)
std::string sha256archivo (std::string narch)

Variables

struct ltc_hash_descriptor hash_descriptor []
struct ltc_hash_descriptor sha256_desc


Descripción detallada

Calcula hash sha256

Agradablemente copiado de sha256.c y encabezados de LibTomCrypt 1.16

Definición en el archivo sha256.hpp.


Documentación de las definiciones

#define BSWAP (  ) 

Valor:

( ((x>>24)&0x000000FFUL) | ((x<<24)&0xFF000000UL)  | \
                    ((x>>8)&0x0000FF00UL)  | ((x<<8)&0x00FF0000UL) )

Definición en la línea 288 del archivo sha256.hpp.

#define byte ( x,
 )     (((x) >> (8 * (n))) & 255)

Definición en la línea 324 del archivo sha256.hpp.

#define CONST64 (  )     n ## ULL

Definición en la línea 73 del archivo sha256.hpp.

#define CRYPT   0x0116

Definición en la línea 24 del archivo sha256.hpp.

#define ENDIAN_LITTLE

Definición en la línea 20 del archivo sha256.hpp.

#define HASH_PROCESS ( func_name,
compress_name,
state_var,
block_size   ) 

Definición en la línea 435 del archivo sha256.hpp.

#define LOAD32H ( x,
 ) 

Valor:

{ x = ((unsigned long)((y)[0] & 255)<<24) | \
           ((unsigned long)((y)[1] & 255)<<16) | \
           ((unsigned long)((y)[2] & 255)<<8)  | \
           ((unsigned long)((y)[3] & 255)); }

Definición en la línea 149 del archivo sha256.hpp.

#define LOAD32L ( x,
 )     { XMEMCPY(&(x), y, 4); x &= 0xFFFFFFFF; }

Definición en la línea 215 del archivo sha256.hpp.

#define LOAD64H ( x,
 ) 

Valor:

{ x = (((ulong64)((y)[0] & 255))<<56)|(((ulong64)((y)[1] & 255))<<48) | \
         (((ulong64)((y)[2] & 255))<<40)|(((ulong64)((y)[3] & 255))<<32) | \
         (((ulong64)((y)[4] & 255))<<24)|(((ulong64)((y)[5] & 255))<<16) | \
         (((ulong64)((y)[6] & 255))<<8)|(((ulong64)((y)[7] & 255))); }

Definición en la línea 182 del archivo sha256.hpp.

#define LOAD64L ( x,
 )     { XMEMCPY(&(x), y, 8); }

Definición en la línea 221 del archivo sha256.hpp.

#define LTC_ARGCHK (  )     if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); }

Definición en la línea 335 del archivo sha256.hpp.

Referenciado por sha256_done(), y sha256_init().

#define LTC_ARGCHKVD (  )     LTC_ARGCHK(x)

Definición en la línea 336 del archivo sha256.hpp.

#define MAX ( x,
 )     ( ((x)>(y))?(x):(y) )

Definición en la línea 313 del archivo sha256.hpp.

#define MAXBLOCKSIZE   128

Definición en la línea 28 del archivo sha256.hpp.

#define MIN ( x,
 )     ( ((x)<(y))?(x):(y) )

Definición en la línea 317 del archivo sha256.hpp.

#define ROL ( x,
 )     ( (((unsigned long)(x)<<(unsigned long)((y)&31)) | (((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL)

Definición en la línea 297 del archivo sha256.hpp.

#define ROL64 ( x,
 ) 

Valor:

( (((x)<<((ulong64)(y)&63)) | \
      (((x)&CONST64(0xFFFFFFFFFFFFFFFF))>>((ulong64)64-((y)&63)))) & CONST64(0xFFFFFFFFFFFFFFFF))

Definición en la línea 304 del archivo sha256.hpp.

#define ROL64c   ROL64

Definición en la línea 301 del archivo sha256.hpp.

#define ROLc   ROL

Definición en la línea 292 del archivo sha256.hpp.

#define ROR ( x,
 )     ( ((((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)((y)&31)) | ((unsigned long)(x)<<(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL)

Definición en la línea 298 del archivo sha256.hpp.

#define ROR64 ( x,
 ) 

Valor:

( ((((x)&CONST64(0xFFFFFFFFFFFFFFFF))>>((ulong64)(y)&CONST64(63))) | \
      ((x)<<((ulong64)(64-((y)&CONST64(63)))))) & CONST64(0xFFFFFFFFFFFFFFFF))

Definición en la línea 308 del archivo sha256.hpp.

#define ROR64c   ROR64

Definición en la línea 302 del archivo sha256.hpp.

#define RORc   ROR

Definición en la línea 293 del archivo sha256.hpp.

#define SCRYPT   "1.16"

Definición en la línea 25 del archivo sha256.hpp.

#define STORE32H ( x,
 ) 

Valor:

{ (y)[0] = (unsigned char)(((x)>>24)&255); (y)[1] = (unsigned char)(((x)>>16)&255);   \
       (y)[2] = (unsigned char)(((x)>>8)&255); (y)[3] = (unsigned char)((x)&255); }

Definición en la línea 145 del archivo sha256.hpp.

Referenciado por sha256_done().

#define STORE32L ( x,
 )     { ulong32 __t = (x); XMEMCPY(y, &__t, 4); }

Definición en la línea 212 del archivo sha256.hpp.

#define STORE64H ( x,
 ) 

Valor:

{ (y)[0] = (unsigned char)(((x)>>56)&255); (y)[1] = (unsigned char)(((x)>>48)&255);     \
     (y)[2] = (unsigned char)(((x)>>40)&255); (y)[3] = (unsigned char)(((x)>>32)&255);     \
     (y)[4] = (unsigned char)(((x)>>24)&255); (y)[5] = (unsigned char)(((x)>>16)&255);     \
     (y)[6] = (unsigned char)(((x)>>8)&255); (y)[7] = (unsigned char)((x)&255); }

Definición en la línea 176 del archivo sha256.hpp.

Referenciado por sha256_done().

#define STORE64L ( x,
 )     { ulong64 __t = (x); XMEMCPY(y, &__t, 8); }

Definición en la línea 218 del archivo sha256.hpp.

#define TAB_SIZE   32

Definición en la línea 31 del archivo sha256.hpp.


Documentación de los tipos definidos

typedef union Hash_state hash_state

typedef unsigned ulong32

Definición en la línea 76 del archivo sha256.hpp.

typedef unsigned long long ulong64

Definición en la línea 74 del archivo sha256.hpp.


Documentación de las enumeraciones

anonymous enum

Valores de la enumeración:
CRYPT_OK 
CRYPT_ERROR 
CRYPT_NOP 
CRYPT_INVALID_KEYSIZE 
CRYPT_INVALID_ROUNDS 
CRYPT_FAIL_TESTVECTOR 
CRYPT_BUFFER_OVERFLOW 
CRYPT_INVALID_PACKET 
CRYPT_INVALID_PRNGSIZE 
CRYPT_ERROR_READPRNG 
CRYPT_INVALID_CIPHER 
CRYPT_INVALID_HASH 
CRYPT_INVALID_PRNG 
CRYPT_MEM 
CRYPT_PK_TYPE_MISMATCH 
CRYPT_PK_NOT_PRIVATE 
CRYPT_INVALID_ARG 
CRYPT_FILE_NOTFOUND 
CRYPT_PK_INVALID_TYPE 
CRYPT_PK_INVALID_SYSTEM 
CRYPT_PK_DUP 
CRYPT_PK_NOT_FOUND 
CRYPT_PK_INVALID_SIZE 
CRYPT_INVALID_PRIME_SIZE 
CRYPT_PK_INVALID_PADDING 

Definición en la línea 34 del archivo sha256.hpp.


Documentación de las funciones

void crypt_argchk ( char *  v,
char *  s,
int  d 
)

Definición en la línea 33 del archivo sha256.cpp.

int sha256_done ( hash_state md,
unsigned char *  hash 
)

Termina el cálculo para retornar el condensado final.

Parámetros:
md Estado del condensado
hash [out] Destino del condensado (32 bytes)
Devuelve:
CRYPT_OK si tiene éxito

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

Parámetros:
md Estado del condensado que usted desea inicializar
Devuelve:
CRYPT_OK si tiene éxito

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().

int sha256_process ( hash_state md,
const unsigned char *  in,
unsigned long  inlen 
)

Procesa un bloque de memoria por el calculador de condensado

Parámetros:
md Estado del condensado
in Datos por pasar por el hash
inlen Longitud de los datos en in (octetos)
Devuelve:
CRYPT_OK si tiene éxito

Referenciado por sha256archivo().

std::string sha256archivo ( std::string  narch  ) 

Calcula sha256 al archivo dado

Parámetros:
narch nombre de archivo (debe existir)
Devuelve:
Cadena de 64 caracteres con los 32 números del hash sha256 del archivo cada uno en hexadecimal

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().

Gráfico de llamadas para esta función:


Documentación de las variables

struct ltc_hash_descriptor hash_descriptor[]

struct ltc_hash_descriptor sha256_desc

Definición en la línea 40 del archivo sha256.cpp.


Generado el Wed Jan 6 06:59:44 2010 para Mt77 por  doxygen 1.5.4