2 * Copyright © 2000 Keith Packard
3 * Copyright © 2005 Patrick Lam
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of Keith Packard not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission. Keith Packard makes no
12 * representations about the suitability of this software for any purpose. It
13 * is provided "as is" without express or implied warranty.
15 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
25 #include "../fc-arch/fcarch.h"
30 #include <sys/types.h>
31 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
33 # include <sys/mman.h>
48 static void MD5Init(struct MD5Context
*ctx
);
49 static void MD5Update(struct MD5Context
*ctx
, unsigned char *buf
, unsigned len
);
50 static void MD5Final(unsigned char digest
[16], struct MD5Context
*ctx
);
51 static void MD5Transform(FcChar32 buf
[4], FcChar32 in
[16]);
53 #define CACHEBASE_LEN (1 + 32 + 1 + sizeof (FC_ARCHITECTURE) + sizeof (FC_CACHE_SUFFIX))
55 static const char bin2hex
[] = { '0', '1', '2', '3',
61 FcDirCacheBasename (const FcChar8
* dir
, FcChar8 cache_base
[CACHEBASE_LEN
])
63 unsigned char hash
[16];
66 struct MD5Context ctx
;
69 MD5Update (&ctx
, (unsigned char *)dir
, strlen ((char *) dir
));
71 MD5Final (hash
, &ctx
);
74 hex_hash
= cache_base
+ 1;
75 for (cnt
= 0; cnt
< 16; ++cnt
)
77 hex_hash
[2*cnt
] = bin2hex
[hash
[cnt
] >> 4];
78 hex_hash
[2*cnt
+1] = bin2hex
[hash
[cnt
] & 0xf];
81 strcat ((char *) cache_base
, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX
);
87 FcDirCacheUnlink (const FcChar8
*dir
, FcConfig
*config
)
89 FcChar8
*cache_hashed
= NULL
;
90 FcChar8 cache_base
[CACHEBASE_LEN
];
94 FcDirCacheBasename (dir
, cache_base
);
96 list
= FcStrListCreate (config
->cacheDirs
);
100 while ((cache_dir
= FcStrListNext (list
)))
102 cache_hashed
= FcStrPlus (cache_dir
, cache_base
);
105 (void) unlink ((char *) cache_hashed
);
107 FcStrListDone (list
);
108 /* return FcFalse if something went wrong */
115 FcDirCacheOpenFile (const FcChar8
*cache_file
, struct stat
*file_stat
)
119 fd
= open((char *) cache_file
, O_RDONLY
| O_BINARY
);
122 if (fstat (fd
, file_stat
) < 0)
131 * Look for a cache file for the specified dir. Attempt
132 * to use each one we find, stopping when the callback
136 FcDirCacheProcess (FcConfig
*config
, const FcChar8
*dir
,
137 FcBool (*callback
) (int fd
, struct stat
*stat
, void *closure
),
138 void *closure
, FcChar8
**cache_file_ret
)
141 FcChar8 cache_base
[CACHEBASE_LEN
];
144 struct stat file_stat
, dir_stat
;
145 FcBool ret
= FcFalse
;
147 if (stat ((char *) dir
, &dir_stat
) < 0)
150 FcDirCacheBasename (dir
, cache_base
);
152 list
= FcStrListCreate (config
->cacheDirs
);
156 while ((cache_dir
= FcStrListNext (list
)))
158 FcChar8
*cache_hashed
= FcStrPlus (cache_dir
, cache_base
);
161 fd
= FcDirCacheOpenFile (cache_hashed
, &file_stat
);
163 if (dir_stat
.st_mtime
<= file_stat
.st_mtime
)
165 ret
= (*callback
) (fd
, &file_stat
, closure
);
169 *cache_file_ret
= cache_hashed
;
171 FcStrFree (cache_hashed
);
178 FcStrFree (cache_hashed
);
180 FcStrListDone (list
);
186 FcDirCacheDispose (FcCache
*cache
)
188 switch (cache
->magic
) {
189 case FC_CACHE_MAGIC_ALLOC
:
192 case FC_CACHE_MAGIC_MMAP
:
193 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
194 munmap (cache
, cache
->size
);
195 #elif defined(_WIN32)
196 UnmapViewOfFile (cache
);
202 #define FC_CACHE_MIN_MMAP 1024
204 #define FC_CACHE_HASH_SIZE 67
206 typedef struct _FcCacheBucket FcCacheBucket
;
208 struct _FcCacheBucket
{
216 static FcCacheBucket
*FcCacheBuckets
[FC_CACHE_HASH_SIZE
];
219 FcCacheStatHash (struct stat
*cache_stat
)
221 return ((uint32_t) cache_stat
->st_dev
^
222 (uint32_t) cache_stat
->st_ino
^
223 (uint32_t) cache_stat
->st_mtime
);
227 FcCacheLookup (struct stat
*cache_stat
)
229 uint32_t hash
= FcCacheStatHash(cache_stat
);
230 FcCacheBucket
**bucket
= &FcCacheBuckets
[hash
% FC_CACHE_HASH_SIZE
];
233 for (b
= *bucket
; b
; b
= b
->next
)
234 if (b
->cache_dev
== cache_stat
->st_dev
&&
235 b
->cache_ino
== cache_stat
->st_ino
&&
236 b
->cache_mtime
== cache_stat
->st_mtime
)
242 FcCacheRecord (FcCache
*cache
, struct stat
*cache_stat
)
244 uint32_t hash
= FcCacheStatHash(cache_stat
);
245 FcCacheBucket
**bucket
= &FcCacheBuckets
[hash
% FC_CACHE_HASH_SIZE
];
248 b
= malloc (sizeof (FcCacheBucket
));
253 b
->cache_dev
= cache_stat
->st_dev
;
254 b
->cache_ino
= cache_stat
->st_ino
;
255 b
->cache_mtime
= cache_stat
->st_mtime
;
264 FcCacheBucket
*b
, *next
;
266 for (i
= 0; i
< FC_CACHE_HASH_SIZE
; i
++)
268 for (b
= FcCacheBuckets
[i
]; b
; b
= next
)
271 FcDirCacheDispose (b
->cache
);
274 FcCacheBuckets
[i
] = NULL
;
279 * Map a cache file into memory
282 FcDirCacheMapFd (int fd
, struct stat
*fd_stat
)
285 FcBool allocated
= FcFalse
;
287 if (fd_stat
->st_size
< sizeof (FcCache
))
289 cache
= FcCacheLookup (fd_stat
);
293 * For small cache files, just read them into memory
295 if (fd_stat
->st_size
>= FC_CACHE_MIN_MMAP
)
297 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
298 cache
= mmap (0, fd_stat
->st_size
, PROT_READ
, MAP_SHARED
, fd
, 0);
299 #elif defined(_WIN32)
304 hFileMap
= CreateFileMapping((HANDLE
) _get_osfhandle(fd
), NULL
,
305 PAGE_READONLY
, 0, 0, NULL
);
306 if (hFileMap
!= NULL
)
308 cache
= MapViewOfFile (hFileMap
, FILE_MAP_READ
, 0, 0, size
);
309 CloseHandle (hFileMap
);
316 cache
= malloc (fd_stat
->st_size
);
320 if (read (fd
, cache
, fd_stat
->st_size
) != fd_stat
->st_size
)
327 if (cache
->magic
!= FC_CACHE_MAGIC_MMAP
||
328 cache
->version
< FC_CACHE_CONTENT_VERSION
||
329 cache
->size
!= fd_stat
->st_size
||
330 !FcCacheRecord (cache
, fd_stat
))
336 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
337 munmap (cache
, fd_stat
->st_size
);
338 #elif defined(_WIN32)
339 UnmapViewOfFile (cache
);
345 /* Mark allocated caches so they're freed rather than unmapped */
347 cache
->magic
= FC_CACHE_MAGIC_ALLOC
;
353 FcDirCacheUnload (FcCache
*cache
)
355 /* Can't free or unmap the cache as apps may point into it */
359 FcDirCacheMapHelper (int fd
, struct stat
*fd_stat
, void *closure
)
361 FcCache
*cache
= FcDirCacheMapFd (fd
, fd_stat
);
365 *((FcCache
**) closure
) = cache
;
370 FcDirCacheLoad (const FcChar8
*dir
, FcConfig
*config
, FcChar8
**cache_file
)
372 FcCache
*cache
= NULL
;
374 if (!FcDirCacheProcess (config
, dir
,
382 FcDirCacheLoadFile (const FcChar8
*cache_file
, struct stat
*file_stat
)
387 fd
= FcDirCacheOpenFile (cache_file
, file_stat
);
390 cache
= FcDirCacheMapFd (fd
, file_stat
);
396 * Validate a cache file by reading the header and checking
397 * the magic number and the size field
400 FcDirCacheValidateHelper (int fd
, struct stat
*fd_stat
, void *closure
)
405 if (read (fd
, &c
, sizeof (FcCache
)) != sizeof (FcCache
))
407 else if (c
.magic
!= FC_CACHE_MAGIC_MMAP
)
409 else if (c
.version
< FC_CACHE_CONTENT_VERSION
)
411 else if (fd_stat
->st_size
!= c
.size
)
417 FcDirCacheValidConfig (const FcChar8
*dir
, FcConfig
*config
)
419 return FcDirCacheProcess (config
, dir
,
420 FcDirCacheValidateHelper
,
425 FcDirCacheValid (const FcChar8
*dir
)
429 config
= FcConfigGetCurrent ();
433 return FcDirCacheValidConfig (dir
, config
);
437 * Build a cache structure from the given contents
440 FcDirCacheBuild (FcFontSet
*set
, const FcChar8
*dir
, FcStrSet
*dirs
)
442 FcSerialize
*serialize
= FcSerializeCreate ();
445 intptr_t cache_offset
;
446 intptr_t dirs_offset
;
447 FcChar8
*dir_serialize
;
448 intptr_t *dirs_serialize
;
449 FcFontSet
*set_serialize
;
454 * Space for cache structure
456 cache_offset
= FcSerializeReserve (serialize
, sizeof (FcCache
));
460 if (!FcStrSerializeAlloc (serialize
, dir
))
465 dirs_offset
= FcSerializeAlloc (serialize
, dirs
, dirs
->num
* sizeof (FcChar8
*));
466 for (i
= 0; i
< dirs
->num
; i
++)
467 if (!FcStrSerializeAlloc (serialize
, dirs
->strs
[i
]))
473 if (!FcFontSetSerializeAlloc (serialize
, set
))
476 /* Serialize layout complete. Now allocate space and fill it */
477 cache
= malloc (serialize
->size
);
480 /* shut up valgrind */
481 memset (cache
, 0, serialize
->size
);
483 serialize
->linear
= cache
;
485 cache
->magic
= FC_CACHE_MAGIC_ALLOC
;
486 cache
->version
= FC_CACHE_CONTENT_VERSION
;
487 cache
->size
= serialize
->size
;
490 * Serialize directory name
492 dir_serialize
= FcStrSerialize (serialize
, dir
);
495 cache
->dir
= FcPtrToOffset (cache
, dir_serialize
);
500 dirs_serialize
= FcSerializePtr (serialize
, dirs
);
503 cache
->dirs
= FcPtrToOffset (cache
, dirs_serialize
);
504 cache
->dirs_count
= dirs
->num
;
505 for (i
= 0; i
< dirs
->num
; i
++)
507 FcChar8
*d_serialize
= FcStrSerialize (serialize
, dirs
->strs
[i
]);
510 dirs_serialize
[i
] = FcPtrToOffset (dirs_serialize
, d_serialize
);
516 set_serialize
= FcFontSetSerialize (serialize
, set
);
519 cache
->set
= FcPtrToOffset (cache
, set_serialize
);
521 FcSerializeDestroy (serialize
);
528 FcSerializeDestroy (serialize
);
533 FcMakeDirectory (const FcChar8
*dir
)
538 if (strlen ((char *) dir
) == 0)
541 parent
= FcStrDirname (dir
);
544 if (access ((char *) parent
, W_OK
|X_OK
) == 0)
545 ret
= mkdir ((char *) dir
, 0777) == 0;
546 else if (access ((char *) parent
, F_OK
) == -1)
547 ret
= FcMakeDirectory (parent
) && (mkdir ((char *) dir
, 0777) == 0);
554 /* write serialized state to the cache file */
556 FcDirCacheWrite (FcCache
*cache
, FcConfig
*config
)
558 FcChar8
*dir
= FcCacheDir (cache
);
559 FcChar8 cache_base
[CACHEBASE_LEN
];
560 FcChar8
*cache_hashed
;
564 FcChar8
*cache_dir
= NULL
;
570 * Write it to the first directory in the list which is writable
573 list
= FcStrListCreate (config
->cacheDirs
);
576 while ((test_dir
= FcStrListNext (list
))) {
577 if (access ((char *) test_dir
, W_OK
|X_OK
) == 0)
579 cache_dir
= test_dir
;
585 * If the directory doesn't exist, try to create it
587 if (access ((char *) test_dir
, F_OK
) == -1) {
588 if (FcMakeDirectory (test_dir
))
590 cache_dir
= test_dir
;
596 FcStrListDone (list
);
600 FcDirCacheBasename (dir
, cache_base
);
601 cache_hashed
= FcStrPlus (cache_dir
, cache_base
);
605 if (FcDebug () & FC_DBG_CACHE
)
606 printf ("FcDirCacheWriteDir dir \"%s\" file \"%s\"\n",
609 atomic
= FcAtomicCreate ((FcChar8
*)cache_hashed
);
613 if (!FcAtomicLock (atomic
))
616 fd
= open((char *)FcAtomicNewFile (atomic
), O_RDWR
| O_CREAT
| O_BINARY
, 0666);
620 /* Temporarily switch magic to MMAP while writing to file */
621 magic
= cache
->magic
;
622 if (magic
!= FC_CACHE_MAGIC_MMAP
)
623 cache
->magic
= FC_CACHE_MAGIC_MMAP
;
626 * Write cache contents to file
628 written
= write (fd
, cache
, cache
->size
);
630 /* Switch magic back */
631 if (magic
!= FC_CACHE_MAGIC_MMAP
)
632 cache
->magic
= magic
;
634 if (written
!= cache
->size
)
636 perror ("write cache");
641 if (!FcAtomicReplaceOrig(atomic
))
643 FcStrFree (cache_hashed
);
644 FcAtomicUnlock (atomic
);
645 FcAtomicDestroy (atomic
);
651 FcAtomicUnlock (atomic
);
653 FcAtomicDestroy (atomic
);
655 FcStrFree (cache_hashed
);
660 * Hokey little macro trick to permit the definitions of C functions
661 * with the same name as CPP macros
663 #define args(x...) (x)
666 FcCacheDir
args(const FcCache
*c
)
668 return FcCacheDir (c
);
672 FcCacheCopySet
args(const FcCache
*c
)
674 FcFontSet
*old
= FcCacheSet (c
);
675 FcFontSet
*new = FcFontSetCreate ();
680 for (i
= 0; i
< old
->nfont
; i
++)
681 if (!FcFontSetAdd (new, FcFontSetFont (old
, i
)))
683 FcFontSetDestroy (new);
690 FcCacheSubdir
args(const FcCache
*c
, int i
)
692 return FcCacheSubdir (c
, i
);
696 FcCacheNumSubdir
args(const FcCache
*c
)
698 return c
->dirs_count
;
702 FcCacheNumFont
args(const FcCache
*c
)
704 return FcCacheSet(c
)->nfont
;
708 * This code implements the MD5 message-digest algorithm.
709 * The algorithm is due to Ron Rivest. This code was
710 * written by Colin Plumb in 1993, no copyright is claimed.
711 * This code is in the public domain; do with it what you wish.
713 * Equivalent code is available from RSA Data Security, Inc.
714 * This code has been tested against that, and is equivalent,
715 * except that you don't need to include two pages of legalese
718 * To compute the message digest of a chunk of bytes, declare an
719 * MD5Context structure, pass it to MD5Init, call MD5Update as
720 * needed on buffers full of bytes, and then call MD5Final, which
721 * will fill a supplied 16-byte array with the digest.
725 #define byteReverse(buf, len) /* Nothing */
728 * Note: this code is harmless on little-endian machines.
730 void byteReverse(unsigned char *buf
, unsigned longs
)
734 t
= (FcChar32
) ((unsigned) buf
[3] << 8 | buf
[2]) << 16 |
735 ((unsigned) buf
[1] << 8 | buf
[0]);
736 *(FcChar32
*) buf
= t
;
743 * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
744 * initialization constants.
746 static void MD5Init(struct MD5Context
*ctx
)
748 ctx
->buf
[0] = 0x67452301;
749 ctx
->buf
[1] = 0xefcdab89;
750 ctx
->buf
[2] = 0x98badcfe;
751 ctx
->buf
[3] = 0x10325476;
758 * Update context to reflect the concatenation of another buffer full
761 static void MD5Update(struct MD5Context
*ctx
, unsigned char *buf
, unsigned len
)
765 /* Update bitcount */
768 if ((ctx
->bits
[0] = t
+ ((FcChar32
) len
<< 3)) < t
)
769 ctx
->bits
[1]++; /* Carry from low to high */
770 ctx
->bits
[1] += len
>> 29;
772 t
= (t
>> 3) & 0x3f; /* Bytes already in shsInfo->data */
774 /* Handle any leading odd-sized chunks */
777 unsigned char *p
= (unsigned char *) ctx
->in
+ t
;
785 byteReverse(ctx
->in
, 16);
786 MD5Transform(ctx
->buf
, (FcChar32
*) ctx
->in
);
790 /* Process data in 64-byte chunks */
793 memcpy(ctx
->in
, buf
, 64);
794 byteReverse(ctx
->in
, 16);
795 MD5Transform(ctx
->buf
, (FcChar32
*) ctx
->in
);
800 /* Handle any remaining bytes of data. */
802 memcpy(ctx
->in
, buf
, len
);
806 * Final wrapup - pad to 64-byte boundary with the bit pattern
807 * 1 0* (64-bit count of bits processed, MSB-first)
809 static void MD5Final(unsigned char digest
[16], struct MD5Context
*ctx
)
814 /* Compute number of bytes mod 64 */
815 count
= (ctx
->bits
[0] >> 3) & 0x3F;
817 /* Set the first char of padding to 0x80. This is safe since there is
818 always at least one byte free */
822 /* Bytes of padding needed to make 64 bytes */
823 count
= 64 - 1 - count
;
825 /* Pad out to 56 mod 64 */
827 /* Two lots of padding: Pad the first block to 64 bytes */
829 byteReverse(ctx
->in
, 16);
830 MD5Transform(ctx
->buf
, (FcChar32
*) ctx
->in
);
832 /* Now fill the next block with 56 bytes */
833 memset(ctx
->in
, 0, 56);
835 /* Pad block to 56 bytes */
836 memset(p
, 0, count
- 8);
838 byteReverse(ctx
->in
, 14);
840 /* Append length in bits and transform */
841 ((FcChar32
*) ctx
->in
)[14] = ctx
->bits
[0];
842 ((FcChar32
*) ctx
->in
)[15] = ctx
->bits
[1];
844 MD5Transform(ctx
->buf
, (FcChar32
*) ctx
->in
);
845 byteReverse((unsigned char *) ctx
->buf
, 4);
846 memcpy(digest
, ctx
->buf
, 16);
847 memset(ctx
, 0, sizeof(ctx
)); /* In case it's sensitive */
851 /* The four core functions - F1 is optimized somewhat */
853 /* #define F1(x, y, z) (x & y | ~x & z) */
854 #define F1(x, y, z) (z ^ (x & (y ^ z)))
855 #define F2(x, y, z) F1(z, x, y)
856 #define F3(x, y, z) (x ^ y ^ z)
857 #define F4(x, y, z) (y ^ (x | ~z))
859 /* This is the central step in the MD5 algorithm. */
860 #define MD5STEP(f, w, x, y, z, data, s) \
861 ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
864 * The core of the MD5 algorithm, this alters an existing MD5 hash to
865 * reflect the addition of 16 longwords of new data. MD5Update blocks
866 * the data and converts bytes into longwords for this routine.
868 static void MD5Transform(FcChar32 buf
[4], FcChar32 in
[16])
870 register FcChar32 a
, b
, c
, d
;
877 MD5STEP(F1
, a
, b
, c
, d
, in
[0] + 0xd76aa478, 7);
878 MD5STEP(F1
, d
, a
, b
, c
, in
[1] + 0xe8c7b756, 12);
879 MD5STEP(F1
, c
, d
, a
, b
, in
[2] + 0x242070db, 17);
880 MD5STEP(F1
, b
, c
, d
, a
, in
[3] + 0xc1bdceee, 22);
881 MD5STEP(F1
, a
, b
, c
, d
, in
[4] + 0xf57c0faf, 7);
882 MD5STEP(F1
, d
, a
, b
, c
, in
[5] + 0x4787c62a, 12);
883 MD5STEP(F1
, c
, d
, a
, b
, in
[6] + 0xa8304613, 17);
884 MD5STEP(F1
, b
, c
, d
, a
, in
[7] + 0xfd469501, 22);
885 MD5STEP(F1
, a
, b
, c
, d
, in
[8] + 0x698098d8, 7);
886 MD5STEP(F1
, d
, a
, b
, c
, in
[9] + 0x8b44f7af, 12);
887 MD5STEP(F1
, c
, d
, a
, b
, in
[10] + 0xffff5bb1, 17);
888 MD5STEP(F1
, b
, c
, d
, a
, in
[11] + 0x895cd7be, 22);
889 MD5STEP(F1
, a
, b
, c
, d
, in
[12] + 0x6b901122, 7);
890 MD5STEP(F1
, d
, a
, b
, c
, in
[13] + 0xfd987193, 12);
891 MD5STEP(F1
, c
, d
, a
, b
, in
[14] + 0xa679438e, 17);
892 MD5STEP(F1
, b
, c
, d
, a
, in
[15] + 0x49b40821, 22);
894 MD5STEP(F2
, a
, b
, c
, d
, in
[1] + 0xf61e2562, 5);
895 MD5STEP(F2
, d
, a
, b
, c
, in
[6] + 0xc040b340, 9);
896 MD5STEP(F2
, c
, d
, a
, b
, in
[11] + 0x265e5a51, 14);
897 MD5STEP(F2
, b
, c
, d
, a
, in
[0] + 0xe9b6c7aa, 20);
898 MD5STEP(F2
, a
, b
, c
, d
, in
[5] + 0xd62f105d, 5);
899 MD5STEP(F2
, d
, a
, b
, c
, in
[10] + 0x02441453, 9);
900 MD5STEP(F2
, c
, d
, a
, b
, in
[15] + 0xd8a1e681, 14);
901 MD5STEP(F2
, b
, c
, d
, a
, in
[4] + 0xe7d3fbc8, 20);
902 MD5STEP(F2
, a
, b
, c
, d
, in
[9] + 0x21e1cde6, 5);
903 MD5STEP(F2
, d
, a
, b
, c
, in
[14] + 0xc33707d6, 9);
904 MD5STEP(F2
, c
, d
, a
, b
, in
[3] + 0xf4d50d87, 14);
905 MD5STEP(F2
, b
, c
, d
, a
, in
[8] + 0x455a14ed, 20);
906 MD5STEP(F2
, a
, b
, c
, d
, in
[13] + 0xa9e3e905, 5);
907 MD5STEP(F2
, d
, a
, b
, c
, in
[2] + 0xfcefa3f8, 9);
908 MD5STEP(F2
, c
, d
, a
, b
, in
[7] + 0x676f02d9, 14);
909 MD5STEP(F2
, b
, c
, d
, a
, in
[12] + 0x8d2a4c8a, 20);
911 MD5STEP(F3
, a
, b
, c
, d
, in
[5] + 0xfffa3942, 4);
912 MD5STEP(F3
, d
, a
, b
, c
, in
[8] + 0x8771f681, 11);
913 MD5STEP(F3
, c
, d
, a
, b
, in
[11] + 0x6d9d6122, 16);
914 MD5STEP(F3
, b
, c
, d
, a
, in
[14] + 0xfde5380c, 23);
915 MD5STEP(F3
, a
, b
, c
, d
, in
[1] + 0xa4beea44, 4);
916 MD5STEP(F3
, d
, a
, b
, c
, in
[4] + 0x4bdecfa9, 11);
917 MD5STEP(F3
, c
, d
, a
, b
, in
[7] + 0xf6bb4b60, 16);
918 MD5STEP(F3
, b
, c
, d
, a
, in
[10] + 0xbebfbc70, 23);
919 MD5STEP(F3
, a
, b
, c
, d
, in
[13] + 0x289b7ec6, 4);
920 MD5STEP(F3
, d
, a
, b
, c
, in
[0] + 0xeaa127fa, 11);
921 MD5STEP(F3
, c
, d
, a
, b
, in
[3] + 0xd4ef3085, 16);
922 MD5STEP(F3
, b
, c
, d
, a
, in
[6] + 0x04881d05, 23);
923 MD5STEP(F3
, a
, b
, c
, d
, in
[9] + 0xd9d4d039, 4);
924 MD5STEP(F3
, d
, a
, b
, c
, in
[12] + 0xe6db99e5, 11);
925 MD5STEP(F3
, c
, d
, a
, b
, in
[15] + 0x1fa27cf8, 16);
926 MD5STEP(F3
, b
, c
, d
, a
, in
[2] + 0xc4ac5665, 23);
928 MD5STEP(F4
, a
, b
, c
, d
, in
[0] + 0xf4292244, 6);
929 MD5STEP(F4
, d
, a
, b
, c
, in
[7] + 0x432aff97, 10);
930 MD5STEP(F4
, c
, d
, a
, b
, in
[14] + 0xab9423a7, 15);
931 MD5STEP(F4
, b
, c
, d
, a
, in
[5] + 0xfc93a039, 21);
932 MD5STEP(F4
, a
, b
, c
, d
, in
[12] + 0x655b59c3, 6);
933 MD5STEP(F4
, d
, a
, b
, c
, in
[3] + 0x8f0ccc92, 10);
934 MD5STEP(F4
, c
, d
, a
, b
, in
[10] + 0xffeff47d, 15);
935 MD5STEP(F4
, b
, c
, d
, a
, in
[1] + 0x85845dd1, 21);
936 MD5STEP(F4
, a
, b
, c
, d
, in
[8] + 0x6fa87e4f, 6);
937 MD5STEP(F4
, d
, a
, b
, c
, in
[15] + 0xfe2ce6e0, 10);
938 MD5STEP(F4
, c
, d
, a
, b
, in
[6] + 0xa3014314, 15);
939 MD5STEP(F4
, b
, c
, d
, a
, in
[13] + 0x4e0811a1, 21);
940 MD5STEP(F4
, a
, b
, c
, d
, in
[4] + 0xf7537e82, 6);
941 MD5STEP(F4
, d
, a
, b
, c
, in
[11] + 0xbd3af235, 10);
942 MD5STEP(F4
, c
, d
, a
, b
, in
[2] + 0x2ad7d2bb, 15);
943 MD5STEP(F4
, b
, c
, d
, a
, in
[9] + 0xeb86d391, 21);