]> git.saurik.com Git - apple/security.git/blob - AppleCSP/MiscCSPAlgs/SHA1_MD5_Object.h
Security-163.tar.gz
[apple/security.git] / AppleCSP / MiscCSPAlgs / SHA1_MD5_Object.h
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19 /*
20 * SHA1_MD5_Object.h - SHA1, MD5 digest objects
21 *
22 * Created 2/19/2001 by dmitch.
23 */
24
25 #ifndef _SHA1_MD5_OBJECT_H_
26 #define _SHA1_MD5_OBJECT_H_
27
28 #include <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>
29 #include <Security/digestobject.h>
30 #include <MiscCSPAlgs/MD5.h>
31 #include <MiscCSPAlgs/SHA1_priv.h>
32
33 class SHA1Object : public DigestObject
34 {
35 public:
36 SHA1Object() { }
37 virtual ~SHA1Object() { };
38 virtual void digestInit();
39 virtual void digestUpdate(
40 const void *data,
41 size_t len);
42 virtual void digestFinal(
43 void *digest);
44 virtual DigestObject *digestClone() const;
45 virtual size_t digestSizeInBytes() const;
46 private:
47 SHS_INFO mCtx;
48 UInt8 mBuffer[SHS_BLOCKSIZE];
49 size_t mBufferCount;
50
51 };
52
53 class MD5Object : public DigestObject
54 {
55 public:
56 MD5Object() { }
57 virtual ~MD5Object() { }
58 virtual void digestInit();
59 virtual void digestUpdate(
60 const void *data,
61 size_t len);
62 virtual void digestFinal(
63 void *digest);
64 virtual DigestObject *digestClone() const;
65 virtual size_t digestSizeInBytes() const;
66 private:
67 MD5Context mCtx;
68 };
69
70 #endif /* _SHA1_MD5_OBJECT_H_ */