MagickCore 7.0.10
magick.c
Go to the documentation of this file.
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3% %
4% %
5% %
6% M M AAA GGGG IIIII CCCC K K %
7% MM MM A A G I C K K %
8% M M M AAAAA G GGG I C KKK %
9% M M A A G G I C K K %
10% M M A A GGGG IIIII CCCC K K %
11% %
12% Wizard's Toolkit Magick 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%
36*/
37
38/*
39 Include declarations.
40*/
41#include "wizard/studio.h"
42#include "wizard/hash.h"
43#include "wizard/magick.h"
44#include "wizard/string_.h"
45/*
46 Global declaractions.
47*/
48unsigned char
50 {
51 (unsigned char) 0x45,
52 (unsigned char) 0x45,
53 (unsigned char) 0x53,
54 (unsigned char) 0x7f
55 }, /* EES\177 */
57 {
58 (unsigned char) 0x7f,
59 (unsigned char) 0x53,
60 (unsigned char) 0x45,
61 (unsigned char) 0x45
62 }; /* \177SEE */
63
64/*
65%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66% %
67% %
68% %
69% G e t W i z a r d M a g i c k %
70% %
71% %
72% %
73%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74%
75% GetWizardMagick() produces a unique signature useful for verifying that a
76% structure or file is in fact Wizard related.
77%
78% The format of the GetWizardMagick method is:
79%
80% StringInfo GetWizardMagick(const char *signature,const size_t length)
81%
82% A description of each parameter follows:
83%
84% o signature: Derive the magick from this signature.
85%
86%
87*/
88WizardExport StringInfo *GetWizardMagick(const unsigned char *signature,
89 const size_t length)
90{
92 *hash_info;
93
95 *magick,
96 *tag;
97
99 InitializeHash(hash_info);
100 tag=AcquireStringInfo(length);
101 SetStringInfoDatum(tag,signature);
102 UpdateHash(hash_info,tag);
103 tag=DestroyStringInfo(tag);
104 FinalizeHash(hash_info);
105 magick=CloneStringInfo(GetHashDigest(hash_info));
106 hash_info=DestroyHashInfo(hash_info);
107 return(magick);
108}
WizardExport HashInfo * AcquireHashInfo(const HashType hash)
Definition hash.c:99
WizardExport WizardBooleanType UpdateHash(HashInfo *hash_info, const StringInfo *message)
Definition hash.c:849
WizardExport WizardBooleanType InitializeHash(HashInfo *hash_info)
Definition hash.c:760
WizardExport HashInfo * DestroyHashInfo(HashInfo *hash_info)
Definition hash.c:231
WizardExport const StringInfo * GetHashDigest(const HashInfo *hash_info)
Definition hash.c:568
WizardExport WizardBooleanType FinalizeHash(HashInfo *hash_info)
Definition hash.c:324
@ SHA2256Hash
Definition hash.h:36
WizardExport StringInfo * GetWizardMagick(const unsigned char *signature, const size_t length)
Definition magick.c:88
unsigned char MagickWizard[4]
Definition magick.c:49
unsigned char WizardMagick[4]
Definition magick.c:56
#define WizardExport
WizardExport StringInfo * AcquireStringInfo(const size_t length)
Definition string.c:179
WizardExport StringInfo * CloneStringInfo(const StringInfo *string_info)
Definition string.c:332
WizardExport void SetStringInfoDatum(StringInfo *string_info, const unsigned char *source)
Definition string.c:1832
WizardExport StringInfo * DestroyStringInfo(StringInfo *string_info)
Definition string.c:857