]> git.saurik.com Git - apple/security.git/blob - AppleCSP/MiscCSPAlgs/SHA1_MD5_Object.h
Security-30.1.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 <AppleCSP/DigestObject.h>
30 #include <MiscCSPAlgs/MD5.h>
31 #include <CryptKit/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 size_t digestSizeInBytes() const;
45 private:
46 SHS_INFO mCtx;
47 UInt8 mBuffer[SHS_BLOCKSIZE];
48 size_t mBufferCount;
49
50 };
51
52 class MD5Object : public DigestObject
53 {
54 public:
55 MD5Object() { }
56 virtual ~MD5Object() { }
57 virtual void digestInit();
58 virtual void digestUpdate(
59 const void *data,
60 size_t len);
61 virtual void digestFinal(
62 void *digest);
63 virtual size_t digestSizeInBytes() const;
64 private:
65 MD5Context mCtx;
66 };
67
68 #endif /* _SHA1_MD5_OBJECT_H_ */