Data Structures | Defines | Functions

# sha512.c File Reference

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

## Data Structures

struct | _SHA512Info

## Defines

#define | SHA512Blocksize 128
#define | SHA512Digestsize 64
#define | Sigma0(x) (RotateRight(x,1) ^ RotateRight(x,8) ^ Trunc64((x) >> 7))
#define | Sigma1(x) (RotateRight(x,19) ^ RotateRight(x,61) ^ Trunc64((x) >> 6))
#define | Suma0(x) (RotateRight(x,28) ^ RotateRight(x,34) ^ RotateRight(x,39))
#define | Suma1(x) (RotateRight(x,14) ^ RotateRight(x,18) ^ RotateRight(x,41))

## Functions

static void | TransformSHA512 (SHA512Info *)
WizardExport SHA512Info * | AcquireSHA512Info (void)
WizardExport SHA512Info * | DestroySHA512Info (SHA512Info *sha_info)
WizardExport void | FinalizeSHA512 (SHA512Info *sha_info)
WizardExport unsigned int | GetSHA512Blocksize (const SHA512Info *sha512_info)
WizardExport const StringInfo * | GetSHA512Digest (const SHA512Info *sha512_info)
WizardExport unsigned int | GetSHA512Digestsize (const SHA512Info *sha512_info)
WizardExport void | InitializeSHA512 (SHA512Info *sha_info)
static WizardSizeType | Ch (WizardSizeType x, WizardSizeType y, WizardSizeType z)
static WizardSizeType | Maj (WizardSizeType x, WizardSizeType y, WizardSizeType z)
static WizardSizeType | Trunc64 (WizardSizeType x)
static WizardSizeType | RotateRight (WizardSizeType x, WizardSizeType n)
WizardExport void | UpdateSHA512 (SHA512Info *sha_info, const StringInfo *message)

## Define Documentation

#define SHA512Blocksize 128

Referenced by AcquireSHA512Info().

#define SHA512Digestsize 64

Referenced by AcquireSHA512Info(), and FinalizeSHA512().

#define Sigma0 | ( |  | x | ) | (RotateRight(x,1) ^ RotateRight(x,8) ^ Trunc64((x) >> 7))

#define Sigma1 | ( |  | x | ) | (RotateRight(x,19) ^ RotateRight(x,61) ^ Trunc64((x) >> 6))

#define Suma0 | ( |  | x | ) | (RotateRight(x,28) ^ RotateRight(x,34) ^ RotateRight(x,39))

#define Suma1 | ( |  | x | ) | (RotateRight(x,14) ^ RotateRight(x,18) ^ RotateRight(x,41))

## Function Documentation

WizardExport SHA512Info* AcquireSHA512Info | ( | void |  | ) |

References _SHA512Info::accumulator, AcquireQuantumMemory(), AcquireStringInfo(), AcquireWizardMemory(), _SHA512Info::blocksize, _SHA512Info::digest, _SHA512Info::digestsize, HashError, InitializeSHA512(), _SHA512Info::lsb_first, MemoryError, _SHA512Info::message, ResetWizardMemory(), SHA512Blocksize, SHA512Digestsize, _SHA512Info::signature, ThrowWizardFatalError, _SHA512Info::timestamp, WizardFalse, and WizardTrue.

Referenced by AcquireHashInfo().

static WizardSizeType Ch | ( | WizardSizeType | x,
|  | WizardSizeType | y,
|  | WizardSizeType | z |
| ) |  |  | `[inline, static]`

Referenced by TransformSHA512().

WizardExport SHA512Info* DestroySHA512Info | ( | SHA512Info * | sha_info | ) |

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

Referenced by DestroyHashInfo().

WizardExport void FinalizeSHA512 | ( | SHA512Info * | sha_info | ) |

References _SHA512Info::accumulator, _SHA512Info::digest, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _SHA512Info::high_order, LogWizardEvent(), _SHA512Info::low_order, _SHA512Info::message, ResetWizardMemory(), SHA512Digestsize, _SHA512Info::signature, TraceEvent, TransformSHA512(), and WizardSignature.

Referenced by FinalizeHash().

WizardExport unsigned int GetSHA512Blocksize | ( | const SHA512Info * | sha512_info | ) |

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

Referenced by GetHashBlocksize().

WizardExport const StringInfo* GetSHA512Digest | ( | const SHA512Info * | sha512_info | ) |

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

Referenced by FinalizeHash().

WizardExport unsigned int GetSHA512Digestsize | ( | const SHA512Info * | sha512_info | ) |

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

Referenced by AcquireHashInfo(), and GetHashDigestsize().

WizardExport void InitializeSHA512 | ( | SHA512Info * | sha_info | ) |

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

Referenced by AcquireSHA512Info(), and InitializeHash().

static WizardSizeType Maj | ( | WizardSizeType | x,
|  | WizardSizeType | y,
|  | WizardSizeType | z |
| ) |  |  | `[inline, static]`

Referenced by TransformSHA512().

static WizardSizeType RotateRight | ( | WizardSizeType | x,
|  | WizardSizeType | n |
| ) |  |  | `[static]`

References Trunc64().

static void TransformSHA512 | ( | SHA512Info * | sha_info | ) | `[static]`

References _SHA512Info::accumulator, Ch(), GetStringInfoDatum(), _SHA512Info::lsb_first, Maj(), _SHA512Info::message, ResetWizardMemory(), Sigma0, Sigma1, Suma0, Suma1, Trunc64(), WizardFalse, and WizardULLConstant.

Referenced by FinalizeSHA512(), and UpdateSHA512().

static WizardSizeType Trunc64 | ( | WizardSizeType | x | ) | `[inline, static]`

References WizardULLConstant.

Referenced by RotateRight(), TransformSHA512(), and UpdateSHA512().

WizardExport void UpdateSHA512 | ( | SHA512Info * | sha_info,
|  | const StringInfo * | message |
| ) |  |  |

References CopyWizardMemory(), GetStringInfoDatum(), GetStringInfoLength(), _SHA512Info::high_order, _SHA512Info::low_order, _SHA512Info::message, _SHA512Info::offset, SetStringInfoDatum(), _SHA512Info::signature, TransformSHA512(), Trunc64(), and WizardSignature.

Referenced by UpdateHash().