MagickCore 7.0.10
sha2224.c
Go to the documentation of this file.
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3% %
4% %
5% SSSSS H H AAA %
6% SS H H A A %
7% SSS HHHHH AAAAA %
8% SS H H A A %
9% SSSSS H H A A %
10% %
11% %
12% Wizard's Toolkit Secure Hash Algorithm 2-224 Methods %
13% %
14% Software Design %
15% Cristy %
16% March 2003 %
17% %
18% %
19% Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization %
20% dedicated to making software imaging solutions freely available. %
21% %
22% You may not use this file except in compliance with the License. You may %
23% obtain a copy of the License at %
24% %
25% https://imagemagick.org/script/license.php %
26% %
27% Unless required by applicable law or agreed to in writing, software %
28% distributed under the License is distributed on an "AS IS" BASIS, %
29% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
30% See the License for the specific language governing permissions and %
31% limitations under the License. %
32% %
33%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34%
35% See http://csrc.nist.gov/groups/ST/toolkit/index.html.
36%
37*/
38
39/*
40 Include declarations.
41*/
42#include "wizard/studio.h"
43#include "wizard/exception.h"
45#include "wizard/memory_.h"
46#include "wizard/sha2224.h"
47/*
48 Define declarations.
49*/
50#define SHA2224Blocksize 64
51#define SHA2224Digestsize 28
52
53/*
54 Typedef declarations.
55*/
57{
58 unsigned int
61
65
66 unsigned int
70
71 size_t
73
76
77 time_t
79
80 size_t
82};
83
84/*
85 Forward declarations.
86*/
87static void
89
90/*
91%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92% %
93% %
94% %
95% A c q u i r e S H A I n f o %
96% %
97% %
98% %
99%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
100%
101% AcquireSHA2224Info() allocate the SHA2224Info structure.
102%
103% The format of the AcquireSHA2224Info method is:
104%
105% SHA2224Info *AcquireSHA2224Info(void)
106%
107*/
109{
111 *sha_info;
112
113 unsigned int
114 lsb_first;
115
116 sha_info=(SHA2224Info *) AcquireWizardMemory(sizeof(*sha_info));
117 if (sha_info == (SHA2224Info *) NULL)
119 (void) memset(sha_info,0,sizeof(*sha_info));
121 sha_info->blocksize=SHA2224Blocksize;
124 sha_info->accumulator=(unsigned int *) AcquireQuantumMemory(SHA2224Blocksize,
125 sizeof(*sha_info->accumulator));
126 if (sha_info->accumulator == (unsigned int *) NULL)
128 lsb_first=1;
129 sha_info->lsb_first=(*(char *) &lsb_first) != 0 ? WizardTrue : WizardFalse;
130 sha_info->timestamp=time((time_t *) NULL);
131 sha_info->signature=WizardSignature;
132 (void) InitializeSHA2224(sha_info);
133 return(sha_info);
134}
135
136/*
137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
138% %
139% %
140% %
141% D e s t r o y S H A I n f o %
142% %
143% %
144% %
145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
146%
147% DestroySHA2224Info() zeros memory associated with the SHA2224Info structure.
148%
149% The format of the DestroySHA2224Info method is:
150%
151% SHA2224Info *DestroySHA2224Info(SHA2224Info *sha_info)
152%
153% A description of each parameter follows:
154%
155% o sha_info: The cipher sha_info.
156%
157*/
159{
161 assert(sha_info != (SHA2224Info *) NULL);
162 assert(sha_info->signature == WizardSignature);
163 if (sha_info->accumulator != (unsigned int *) NULL)
164 sha_info->accumulator=(unsigned int *) RelinquishWizardMemory(
165 sha_info->accumulator);
166 if (sha_info->message != (StringInfo *) NULL)
167 sha_info->message=DestroyStringInfo(sha_info->message);
168 if (sha_info->digest != (StringInfo *) NULL)
169 sha_info->digest=DestroyStringInfo(sha_info->digest);
170 sha_info->signature=(~WizardSignature);
171 sha_info=(SHA2224Info *) RelinquishWizardMemory(sha_info);
172 return(sha_info);
173}
174
175/*
176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
177% %
178% %
179% %
180% F i n a l i z e S H A %
181% %
182% %
183% %
184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
185%
186% FinalizeSHA2224() finalizes the SHA2224 message accumulator computation.
187%
188% The format of the FinalizeSHA2224 method is:
189%
190% WizardBooleanType FinalizeSHA2224(SHA2224Info *sha_info)
191%
192% A description of each parameter follows:
193%
194% o sha_info: The address of a structure of type SHA2224Info.
195%
196*/
198{
199 ssize_t
200 i;
201
202 unsigned char
203 *q;
204
205 unsigned int
206 *p;
207
208 ssize_t
209 count;
210
211 unsigned char
212 *datum;
213
214 unsigned int
215 high_order,
216 low_order;
217
218 /*
219 Add padding and return the message accumulator.
220 */
222 assert(sha_info != (SHA2224Info *) NULL);
223 assert(sha_info->signature == WizardSignature);
224 low_order=sha_info->low_order;
225 high_order=sha_info->high_order;
226 count=(ssize_t) ((low_order >> 3) & 0x3f);
227 datum=GetStringInfoDatum(sha_info->message);
228 datum[count++]=(unsigned char) 0x80;
229 if (count <= (ssize_t) (GetStringInfoLength(sha_info->message)-8))
230 (void) memset(datum+count,0,GetStringInfoLength(
231 sha_info->message)-8-count);
232 else
233 {
234 (void) memset(datum+count,0,GetStringInfoLength(
235 sha_info->message)-count);
236 TransformSHA2224(sha_info);
237 (void) memset(datum,0,GetStringInfoLength(sha_info->message)-
238 8);
239 }
240 datum[56]=(unsigned char) (high_order >> 24);
241 datum[57]=(unsigned char) (high_order >> 16);
242 datum[58]=(unsigned char) (high_order >> 8);
243 datum[59]=(unsigned char) high_order;
244 datum[60]=(unsigned char) (low_order >> 24);
245 datum[61]=(unsigned char) (low_order >> 16);
246 datum[62]=(unsigned char) (low_order >> 8);
247 datum[63]=(unsigned char) low_order;
248 TransformSHA2224(sha_info);
249 p=sha_info->accumulator;
250 q=GetStringInfoDatum(sha_info->digest);
251 for (i=0; i < (SHA2224Digestsize/4); i++)
252 {
253 *q++=(unsigned char) ((*p >> 24) & 0xff);
254 *q++=(unsigned char) ((*p >> 16) & 0xff);
255 *q++=(unsigned char) ((*p >> 8) & 0xff);
256 *q++=(unsigned char) (*p & 0xff);
257 p++;
258 }
259 /*
260 Reset working registers.
261 */
262 count=0;
263 high_order=0;
264 low_order=0;
265 return(WizardTrue);
266}
267
268/*
269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
270% %
271% %
272% %
273% G e t S H A 2 2 4 B l o c k s i z e %
274% %
275% %
276% %
277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
278%
279% GetSHA2224Blocksize() returns the SHA2224 blocksize.
280%
281% The format of the GetSHA2224Blocksize method is:
282%
283% unsigned int *GetSHA2224Blocksize(const SHA2224Info *sha2224_info)
284%
285% A description of each parameter follows:
286%
287% o sha2224_info: The sha2224 info.
288%
289*/
290WizardExport unsigned int GetSHA2224Blocksize(const SHA2224Info *sha2224_info)
291{
293 WizardAssert(CipherDomain,sha2224_info != (SHA2224Info *) NULL);
295 return(sha2224_info->blocksize);
296}
297
298/*
299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
300% %
301% %
302% %
303% G e t S H A 2 2 4 D i g e s t %
304% %
305% %
306% %
307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
308%
309% GetSHA2224Digest() returns the SHA2224 digest.
310%
311% The format of the GetSHA2224Digest method is:
312%
313% const StringInfo *GetSHA2224Digest(const SHA2224Info *sha2224_info)
314%
315% A description of each parameter follows:
316%
317% o sha2224_info: The sha2224 info.
318%
319*/
321{
323 WizardAssert(HashDomain,sha2224_info != (SHA2224Info *) NULL);
325 return(sha2224_info->digest);
326}
327
328/*
329%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
330% %
331% %
332% %
333% G e t S H A 2 2 4 D i g e s t s i z e %
334% %
335% %
336% %
337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
338%
339% GetSHA2224Digestsize() returns the SHA2224 digest size.
340%
341% The format of the GetSHA2224Digestsize method is:
342%
343% unsigned int *GetSHA2224Digestsize(const SHA2224Info *sha2224_info)
344%
345% A description of each parameter follows:
346%
347% o sha2224_info: The sha2224 info.
348%
349*/
350WizardExport unsigned int GetSHA2224Digestsize(const SHA2224Info *sha2224_info)
351{
353 WizardAssert(CipherDomain,sha2224_info != (SHA2224Info *) NULL);
355 return(sha2224_info->digestsize);
356}
357
358/*
359%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
360% %
361% %
362% %
363% I n i t i a l i z e S H A %
364% %
365% %
366% %
367%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
368%
369% IntializeSHA2224() intializes the SHA2224 accumulator.
370%
371% The format of the DestroySHA2224Info method is:
372%
373% WizardBooleanType InitializeSHA2224Info(SHA2224Info *sha_info)
374%
375% A description of each parameter follows:
376%
377% o sha_info: The cipher sha_info.
378%
379*/
381{
383 assert(sha_info != (SHA2224Info *) NULL);
384 assert(sha_info->signature == WizardSignature);
385 sha_info->accumulator[0]=0xc1059ed8U;
386 sha_info->accumulator[1]=0x367cd507U;
387 sha_info->accumulator[2]=0x3070dd17U;
388 sha_info->accumulator[3]=0xf70e5939U;
389 sha_info->accumulator[4]=0xffc00b31U;
390 sha_info->accumulator[5]=0x68581511U;
391 sha_info->accumulator[6]=0x64f98fa7U;
392 sha_info->accumulator[7]=0xbefa4fa4U;
393 sha_info->low_order=0;
394 sha_info->high_order=0;
395 sha_info->offset=0;
396 return(WizardTrue);
397}
398
399/*
400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
401% %
402% %
403% %
404% T r a n s f o r m S H A %
405% %
406% %
407% %
408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
409%
410% TransformSHA2224() transforms the SHA2224 message accumulator.
411%
412% The format of the TransformSHA2224 method is:
413%
414% TransformSHA2224(SHA2224Info *sha_info)
415%
416% A description of each parameter follows:
417%
418% o sha_info: The address of a structure of type SHA2224Info.
419%
420*/
421
422static inline unsigned int Ch(const unsigned int x,const unsigned int y,
423 const unsigned int z)
424{
425 return((x & y) ^ (~x & z));
426}
427
428static inline unsigned int Maj(const unsigned int x,const unsigned int y,
429 const unsigned int z)
430{
431 return((x & y) ^ (x & z) ^ (y & z));
432}
433
434static inline unsigned int Trunc32(const unsigned int x)
435{
436 return((unsigned int) (x & 0xffffffffU));
437}
438
439static unsigned int RotateRight(const unsigned int x,const unsigned int n)
440{
441 return(Trunc32((x >> n) | (x << (32-n))));
442}
443
444static void TransformSHA2224(SHA2224Info *sha_info)
445{
446#define Sigma0(x) (RotateRight(x,7) ^ RotateRight(x,18) ^ Trunc32((x) >> 3))
447#define Sigma1(x) (RotateRight(x,17) ^ RotateRight(x,19) ^ Trunc32((x) >> 10))
448#define Suma0(x) (RotateRight(x,2) ^ RotateRight(x,13) ^ RotateRight(x,22))
449#define Suma1(x) (RotateRight(x,6) ^ RotateRight(x,11) ^ RotateRight(x,25))
450
451 ssize_t
452 j;
453
454 ssize_t
455 i;
456
457 unsigned char
458 *p;
459
460 static unsigned int
461 K[64] =
462 {
463 0x428a2f98U, 0x71374491U, 0xb5c0fbcfU, 0xe9b5dba5U, 0x3956c25bU,
464 0x59f111f1U, 0x923f82a4U, 0xab1c5ed5U, 0xd807aa98U, 0x12835b01U,
465 0x243185beU, 0x550c7dc3U, 0x72be5d74U, 0x80deb1feU, 0x9bdc06a7U,
466 0xc19bf174U, 0xe49b69c1U, 0xefbe4786U, 0x0fc19dc6U, 0x240ca1ccU,
467 0x2de92c6fU, 0x4a7484aaU, 0x5cb0a9dcU, 0x76f988daU, 0x983e5152U,
468 0xa831c66dU, 0xb00327c8U, 0xbf597fc7U, 0xc6e00bf3U, 0xd5a79147U,
469 0x06ca6351U, 0x14292967U, 0x27b70a85U, 0x2e1b2138U, 0x4d2c6dfcU,
470 0x53380d13U, 0x650a7354U, 0x766a0abbU, 0x81c2c92eU, 0x92722c85U,
471 0xa2bfe8a1U, 0xa81a664bU, 0xc24b8b70U, 0xc76c51a3U, 0xd192e819U,
472 0xd6990624U, 0xf40e3585U, 0x106aa070U, 0x19a4c116U, 0x1e376c08U,
473 0x2748774cU, 0x34b0bcb5U, 0x391c0cb3U, 0x4ed8aa4aU, 0x5b9cca4fU,
474 0x682e6ff3U, 0x748f82eeU, 0x78a5636fU, 0x84c87814U, 0x8cc70208U,
475 0x90befffaU, 0xa4506cebU, 0xbef9a3f7U, 0xc67178f2U
476 }; /* 32-bit fractional part of the cube root of the first 64 primes */
477
478 unsigned int
479 A,
480 B,
481 C,
482 D,
483 E,
484 F,
485 G,
486 H,
487 shift,
488 T,
489 T1,
490 T2,
491 W[64];
492
493 shift=32;
494 p=GetStringInfoDatum(sha_info->message);
495 if (sha_info->lsb_first == WizardFalse)
496 {
497 if (sizeof(unsigned int) <= 4)
498 for (i=0; i < 16; i++)
499 {
500 T=(*((unsigned int *) p));
501 p+=4;
502 W[i]=Trunc32(T);
503 }
504 else
505 for (i=0; i < 16; i+=2)
506 {
507 T=(*((unsigned int *) p));
508 p+=8;
509 W[i]=Trunc32(T >> shift);
510 W[i+1]=Trunc32(T);
511 }
512 }
513 else
514 if (sizeof(unsigned int) <= 4)
515 for (i=0; i < 16; i++)
516 {
517 T=(*((unsigned int *) p));
518 p+=4;
519 W[i]=((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) |
520 ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff);
521 }
522 else
523 for (i=0; i < 16; i+=2)
524 {
525 T=(*((unsigned int *) p));
526 p+=8;
527 W[i]=((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) |
528 ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff);
529 T>>=shift;
530 W[i+1]=((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) |
531 ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff);
532 }
533 /*
534 Copy accumulator to registers.
535 */
536 A=sha_info->accumulator[0];
537 B=sha_info->accumulator[1];
538 C=sha_info->accumulator[2];
539 D=sha_info->accumulator[3];
540 E=sha_info->accumulator[4];
541 F=sha_info->accumulator[5];
542 G=sha_info->accumulator[6];
543 H=sha_info->accumulator[7];
544 for (i=16; i < 64; i++)
545 W[i]=Trunc32(Sigma1(W[i-2])+W[i-7]+Sigma0(W[i-15])+W[i-16]);
546 for (j=0; j < 64; j++)
547 {
548 T1=Trunc32(H+Suma1(E)+Ch(E,F,G)+K[j]+W[j]);
549 T2=Trunc32(Suma0(A)+Maj(A,B,C));
550 H=G;
551 G=F;
552 F=E;
553 E=Trunc32(D+T1);
554 D=C;
555 C=B;
556 B=A;
557 A=Trunc32(T1+T2);
558 }
559 /*
560 Add registers back to accumulator.
561 */
562 sha_info->accumulator[0]=Trunc32(sha_info->accumulator[0]+A);
563 sha_info->accumulator[1]=Trunc32(sha_info->accumulator[1]+B);
564 sha_info->accumulator[2]=Trunc32(sha_info->accumulator[2]+C);
565 sha_info->accumulator[3]=Trunc32(sha_info->accumulator[3]+D);
566 sha_info->accumulator[4]=Trunc32(sha_info->accumulator[4]+E);
567 sha_info->accumulator[5]=Trunc32(sha_info->accumulator[5]+F);
568 sha_info->accumulator[6]=Trunc32(sha_info->accumulator[6]+G);
569 /*
570 Reset working registers.
571 */
572 A=0;
573 B=0;
574 C=0;
575 D=0;
576 E=0;
577 F=0;
578 G=0;
579 H=0;
580 T=0;
581 T1=0;
582 T2=0;
583 (void) memset(W,0,sizeof(W));
584}
585
586/*
587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
588% %
589% %
590% %
591% U p d a t e S H A %
592% %
593% %
594% %
595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
596%
597% UpdateSHA2224() updates the SHA2224 message accumulator.
598%
599% The format of the UpdateSHA2224 method is:
600%
601% WizardBooleanType UpdateSHA2224(SHA2224Info *sha_info,
602% const StringInfo *message)
603%
604% A description of each parameter follows:
605%
606% o sha_info: The address of a structure of type SHA2224Info.
607%
608% o message: The message.
609%
610*/
612 const StringInfo *message)
613{
614 size_t
615 i;
616
617 unsigned char
618 *p;
619
620 size_t
621 n;
622
623 unsigned int
624 length;
625
626 /*
627 Update the SHA2224 accumulator.
628 */
629 assert(sha_info != (SHA2224Info *) NULL);
630 assert(sha_info->signature == WizardSignature);
631 n=GetStringInfoLength(message);
632 length=Trunc32((unsigned int) (sha_info->low_order+(n << 3)));
633 if (length < sha_info->low_order)
634 sha_info->high_order++;
635 sha_info->low_order=length;
636 sha_info->high_order+=(unsigned int) n >> 29;
637 p=GetStringInfoDatum(message);
638 if (sha_info->offset != 0)
639 {
640 i=GetStringInfoLength(sha_info->message)-sha_info->offset;
641 if (i > n)
642 i=n;
644 sha_info->offset,p,i);
645 n-=i;
646 p+=i;
647 sha_info->offset+=i;
648 if (sha_info->offset != GetStringInfoLength(sha_info->message))
649 return(WizardTrue);
650 TransformSHA2224(sha_info);
651 }
652 while (n >= GetStringInfoLength(sha_info->message))
653 {
654 SetStringInfoDatum(sha_info->message,p);
655 p+=GetStringInfoLength(sha_info->message);
656 n-=GetStringInfoLength(sha_info->message);
657 TransformSHA2224(sha_info);
658 }
659 (void) CopyWizardMemory(GetStringInfoDatum(sha_info->message),p,n);
660 sha_info->offset=n;
661 /*
662 Reset working registers.
663 */
664 i=0;
665 n=0;
666 length=0;
667 return(WizardTrue);
668}
#define WizardAssert(domain, predicate)
#define ThrowWizardFatalError(domain, error)
@ HashDomain
Definition exception.h:30
@ CipherDomain
Definition exception.h:34
@ HashError
Definition exception.h:85
@ MemoryError
Definition exception.h:49
WizardBooleanType LogWizardEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition log.c:1390
@ TraceEvent
Definition log.h:39
#define GetWizardModule()
Definition log.h:30
static unsigned int H(const unsigned int x, const unsigned int y, const unsigned int z)
Definition md5.c:424
static unsigned int F(const unsigned int x, const unsigned int y, const unsigned int z)
Definition md5.c:412
static unsigned int G(const unsigned int x, const unsigned int y, const unsigned int z)
Definition md5.c:418
WizardExport void * AcquireWizardMemory(const size_t size)
Definition memory.c:586
WizardExport void * CopyWizardMemory(void *destination, const void *source, const size_t size)
Definition memory.c:700
WizardExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
Definition memory.c:657
WizardExport void * RelinquishWizardMemory(void *memory)
Definition memory.c:1039
#define WizardExport
#define WizardSignature
static void TransformSHA2224(SHA2224Info *)
Definition sha2224.c:444
WizardExport const StringInfo * GetSHA2224Digest(const SHA2224Info *sha2224_info)
Definition sha2224.c:320
#define SHA2224Blocksize
Definition sha2224.c:50
WizardExport SHA2224Info * AcquireSHA2224Info(void)
Definition sha2224.c:108
WizardExport WizardBooleanType FinalizeSHA2224(SHA2224Info *sha_info)
Definition sha2224.c:197
#define Suma1(x)
#define Sigma0(x)
#define Sigma1(x)
#define Suma0(x)
WizardExport unsigned int GetSHA2224Blocksize(const SHA2224Info *sha2224_info)
Definition sha2224.c:290
WizardExport WizardBooleanType InitializeSHA2224(SHA2224Info *sha_info)
Definition sha2224.c:380
WizardExport unsigned int GetSHA2224Digestsize(const SHA2224Info *sha2224_info)
Definition sha2224.c:350
WizardExport WizardBooleanType UpdateSHA2224(SHA2224Info *sha_info, const StringInfo *message)
Definition sha2224.c:611
WizardExport SHA2224Info * DestroySHA2224Info(SHA2224Info *sha_info)
Definition sha2224.c:158
#define SHA2224Digestsize
Definition sha2224.c:51
#define Trunc32(x)
Definition signature.c:52
#define RotateRight(x, n)
#define Maj(x, y, z)
#define Ch(x, y, z)
WizardExport size_t GetStringInfoLength(const StringInfo *string_info)
Definition string.c:1280
WizardExport StringInfo * AcquireStringInfo(const size_t length)
Definition string.c:179
WizardExport void SetStringInfoDatum(StringInfo *string_info, const unsigned char *source)
Definition string.c:1832
WizardExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
Definition string.c:1251
WizardExport StringInfo * DestroyStringInfo(StringInfo *string_info)
Definition string.c:857
WizardBooleanType lsb_first
Definition sha2224.c:75
unsigned int digestsize
Definition sha2224.c:59
unsigned int low_order
Definition sha2224.c:68
unsigned int blocksize
Definition sha2224.c:60
StringInfo * message
Definition sha2224.c:64
size_t offset
Definition sha2224.c:72
size_t signature
Definition sha2224.c:81
StringInfo * digest
Definition sha2224.c:63
unsigned int high_order
Definition sha2224.c:69
time_t timestamp
Definition sha2224.c:78
unsigned int * accumulator
Definition sha2224.c:67
WizardBooleanType
Definition wizard-type.h:26
@ WizardTrue
Definition wizard-type.h:28
@ WizardFalse
Definition wizard-type.h:27