"Fossies" - the Fresh Open Source Software Archive

Member "src/Crypto/Sha2Small.h" (10 Oct 2018, 1258 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Sha2Small.h" see the Fossies "Dox" file reference documentation.

    1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
    2  *
    3  * LibTomCrypt is a library that provides various cryptographic
    4  * algorithms in a highly modular and flexible manner.
    5  *
    6  * The library is free for all purposes without any express
    7  * guarantee it works.
    8  *
    9  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
   10  *
   11  */
   12 
   13 /* Adapted for VeraCrypt */
   14 
   15 #ifndef _SHA2_SMALL_H
   16 #define _SHA2_SMALL_H
   17 
   18 #include "Common/Tcdefs.h"
   19 #include "Common/Endian.h"
   20 
   21 #define SHA256_DIGEST_SIZE  32
   22 #define SHA256_BLOCK_SIZE   64
   23 
   24 #define VOID_RETURN void
   25 #define INT_RETURN  int
   26 
   27 #if defined(__cplusplus)
   28 extern "C"
   29 {
   30 #endif
   31 
   32 typedef struct {
   33 
   34     uint32      highLength;
   35     uint32      lowLength;
   36     uint32      state[8];
   37     unsigned int curlen;
   38     unsigned char buf[64];
   39 } sha256_ctx;
   40 
   41 /******************************************************************************/
   42 
   43 VOID_RETURN sha256_begin(sha256_ctx* ctx);
   44 VOID_RETURN sha256_hash(unsigned char* data, unsigned int len, sha256_ctx* ctx);
   45 VOID_RETURN sha256_end(unsigned char* hval, sha256_ctx* ctx);
   46 
   47 #if defined(__cplusplus)
   48 }
   49 #endif
   50 
   51 /******************************************************************************/
   52 
   53 #endif /* _h_PS_DIGEST */
   54 /******************************************************************************/
   55