The Sleuth Kit 4.15.0-develop
sha1c.c File Reference

Local copy of the public domain SHA-1 library code by David Ireland. More...

#include "tsk_base_i.h"

Macros

#define expand(W, i)
#define f1(x, y, z)
#define f2(x, y, z)
#define f3(x, y, z)
#define f4(x, y, z)
#define h0init   0x67452301UL
#define h1init   0xEFCDAB89UL
#define h2init   0x98BADCFEUL
#define h3init   0x10325476UL
#define h4init   0xC3D2E1F0UL
#define K1   0x5A827999UL /* Rounds 0-19 */
#define K2   0x6ED9EBA1UL /* Rounds 20-39 */
#define K3   0x8F1BBCDCUL /* Rounds 40-59 */
#define K4   0xCA62C1D6UL /* Rounds 60-79 */
#define ROTL(n, X)
#define SHS_DATASIZE   64
#define SHS_DIGESTSIZE   20
#define subRound(a, b, c, d, e, f, k, data)

Functions

void TSK_SHA_Final (TSK_SHA_CTX *shsInfo, BYTE *output)
 Calculate the hash of the data added to the context.
void TSK_SHA_Init (TSK_SHA_CTX *shsInfo)
 Initialize a SHA-1 context so that data can be added to it.
void TSK_SHA_Update (TSK_SHA_CTX *shsInfo, const BYTE *buffer, unsigned int count)
 Add data to an initialized SHA-1 context.

Detailed Description

Local copy of the public domain SHA-1 library code by David Ireland.

Macro Definition Documentation

◆ expand

#define expand ( W,
i )
Value:
( W[ i & 15 ] = ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \
W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) ) )

◆ f1

#define f1 ( x,
y,
z )
Value:
( z ^ ( x & ( y ^ z ) ) ) /* Rounds 0-19 */

◆ f2

#define f2 ( x,
y,
z )
Value:
( x ^ y ^ z ) /* Rounds 20-39 */

◆ f3

#define f3 ( x,
y,
z )
Value:
( ( x & y ) | ( z & ( x | y ) ) ) /* Rounds 40-59 */

◆ f4

#define f4 ( x,
y,
z )
Value:
( x ^ y ^ z ) /* Rounds 60-79 */

◆ ROTL

#define ROTL ( n,
X )
Value:
( ( ( X ) << n ) | ( ( X ) >> ( 32 - n ) ) )

◆ subRound

#define subRound ( a,
b,
c,
d,
e,
f,
k,
data )
Value:
( e += ROTL( 5, a ) + f( b, c, d ) + k + data, b = ROTL( 30, b ) )

Copyright © 2007-2020 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.