Data Structures | Defines | Functions

# sha1.c File Reference

`#include "wizard/studio.h"`
`#include "wizard/exception.h"`
`#include "wizard/exception-private.h"`
`#include "wizard/memory_.h"`
`#include "wizard/sha1.h"`

## Data Structures
struct | _SHA1Info
## Defines
#define | SHA1Blocksize 64
#define | SHA1Digestsize 20
## Functions
static void | TransformSHA1 (SHA1Info *)
WizardExport SHA1Info * | AcquireSHA1Info (void)
WizardExport SHA1Info * | DestroySHA1Info (SHA1Info *sha_info)
WizardExport void | FinalizeSHA1 (SHA1Info *sha_info)
WizardExport unsigned int | GetSHA1Blocksize (const SHA1Info *sha1_info)
WizardExport const StringInfo * | GetSHA1Digest (const SHA1Info *sha1_info)
WizardExport unsigned int | GetSHA1Digestsize (const SHA1Info *sha1_info)
WizardExport void | InitializeSHA1 (SHA1Info *sha_info)
static unsigned int | Trunc32 (unsigned int x)
static unsigned int | RotateLeft (unsigned int x, unsigned int n)
WizardExport void | UpdateSHA1 (SHA1Info *sha_info, const StringInfo *message)

## Define Documentation

#define SHA1Blocksize 64

Referenced by AcquireSHA1Info().

#define SHA1Digestsize 20

Referenced by AcquireSHA1Info(), and FinalizeSHA1().

## Function Documentation

WizardExport SHA1Info* AcquireSHA1Info | ( | void |  | ) |

References _SHA1Info::accumulator, AcquireQuantumMemory(), AcquireStringInfo(), AcquireWizardMemory(), _SHA1Info::blocksize, _SHA1Info::digest, _SHA1Info::digestsize, HashDomain, InitializeSHA1(), _SHA1Info::lsb_first, MemoryError, _SHA1Info::message, ResetWizardMemory(), SHA1Blocksize, SHA1Digestsize, _SHA1Info::signature, ThrowWizardFatalError, _SHA1Info::timestamp, WizardFalse, and WizardTrue.

Referenced by AcquireHashInfo().

WizardExport SHA1Info* DestroySHA1Info | ( | SHA1Info * | sha_info | ) |

References _SHA1Info::accumulator, DestroyStringInfo(), _SHA1Info::digest, GetWizardModule, LogWizardEvent(), _SHA1Info::message, RelinquishWizardMemory(), _SHA1Info::signature, TraceEvent, and WizardSignature.

Referenced by DestroyHashInfo().

WizardExport void FinalizeSHA1 | ( | SHA1Info * | sha_info | ) |

References _SHA1Info::accumulator, _SHA1Info::digest, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _SHA1Info::high_order, LogWizardEvent(), _SHA1Info::low_order, _SHA1Info::message, ResetWizardMemory(), SHA1Digestsize, _SHA1Info::signature, TraceEvent, TransformSHA1(), and WizardSignature.

Referenced by FinalizeHash().

WizardExport unsigned int GetSHA1Blocksize | ( | const SHA1Info * | sha1_info | ) |

References _SHA1Info::blocksize, CipherDomain, GetWizardModule, LogWizardEvent(), _SHA1Info::signature, TraceEvent, WizardAssert, and WizardSignature.

Referenced by GetHashBlocksize().

WizardExport const StringInfo* GetSHA1Digest | ( | const SHA1Info * | sha1_info | ) |

References _SHA1Info::digest, GetWizardModule, HashDomain, LogWizardEvent(), _SHA1Info::signature, TraceEvent, WizardAssert, and WizardSignature.

Referenced by FinalizeHash().

WizardExport unsigned int GetSHA1Digestsize | ( | const SHA1Info * | sha1_info | ) |

References CipherDomain, _SHA1Info::digestsize, GetWizardModule, LogWizardEvent(), _SHA1Info::signature, TraceEvent, WizardAssert, and WizardSignature.

Referenced by AcquireHashInfo(), and GetHashDigestsize().

WizardExport void InitializeSHA1 | ( | SHA1Info * | sha_info | ) |

References _SHA1Info::accumulator, GetWizardModule, _SHA1Info::high_order, LogWizardEvent(), _SHA1Info::low_order, _SHA1Info::offset, _SHA1Info::signature, TraceEvent, and WizardSignature.

Referenced by AcquireSHA1Info(), and InitializeHash().

static unsigned int RotateLeft | ( | unsigned int | x,
|  | unsigned int | n |
| ) |  |  | `[static]`

References Trunc32().

Referenced by TransformSHA1().

static void TransformSHA1 | ( | SHA1Info * | sha_info | ) | `[static]`

References _SHA1Info::accumulator, GetStringInfoDatum(), _SHA1Info::lsb_first, _SHA1Info::message, ResetWizardMemory(), RotateLeft(), Trunc32(), and WizardFalse.

Referenced by FinalizeSHA1(), and UpdateSHA1().

static unsigned int Trunc32 | ( | unsigned int | x | ) | `[inline, static]`

Referenced by RotateLeft(), TransformSHA1(), and UpdateSHA1().

WizardExport void UpdateSHA1 | ( | SHA1Info * | sha_info,
|  | const StringInfo * | message |
| ) |  |  |

References CopyWizardMemory(), GetStringInfoDatum(), GetStringInfoLength(), _SHA1Info::high_order, _SHA1Info::low_order, _SHA1Info::message, _SHA1Info::offset, SetStringInfoDatum(), _SHA1Info::signature, TransformSHA1(), Trunc32(), and WizardSignature.

Referenced by UpdateHash().