2 * $RCSId: xc/lib/fontconfig/src/fccache.c,v 1.12 2002/08/22 07:36:44 keithp Exp $
4 * Copyright © 2000 Keith Packard
5 * Copyright © 2005 Patrick Lam
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of Keith Packard not be used in
12 * advertising or publicity pertaining to distribution of the software without
13 * specific, written prior permission. Keith Packard makes no
14 * representations about the suitability of this software for any purpose. It
15 * is provided "as is" without express or implied warranty.
17 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23 * PERFORMANCE OF THIS SOFTWARE.
27 #include "../fc-arch/fcarch.h"
32 #include <sys/types.h>
33 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
35 # include <sys/mman.h>
40 #define ENDIAN_TEST 0x12345678
41 #define MACHINE_SIGNATURE_SIZE (9 + 5*20 + 1)
42 /* for when we don't have sysconf: */
43 #define FC_HARDCODED_PAGESIZE 8192
50 FcDirCacheOpen (FcConfig
*config
, const FcChar8
*dir
, FcChar8
**cache_path
);
53 FcDirCacheProduce (FcFontSet
*set
, FcCache
* metadata
);
56 FcCacheNextOffset(off_t w
);
59 FcCacheHaveBank (int bank
);
62 FcCacheAddBankDir (int bank
, const char * dir
);
70 static void MD5Init(struct MD5Context
*ctx
);
71 static void MD5Update(struct MD5Context
*ctx
, unsigned char *buf
, unsigned len
);
72 static void MD5Final(unsigned char digest
[16], struct MD5Context
*ctx
);
73 static void MD5Transform(FcChar32 buf
[4], FcChar32 in
[16]);
75 #define FC_DBG_CACHE_REF 1024
78 FcCacheReadString (FILE *file
, char *dest
, int len
)
86 while ((c
= getc (file
)) != EOF
&& len
> 0) {
96 FcCacheWriteString (int fd
, const char *chars
)
98 if (write (fd
, chars
, strlen(chars
)+1) != strlen(chars
)+1)
104 * Find the next presumably-mmapable offset after the supplied file
108 FcCacheNextOffset(off_t w
)
110 static long pagesize
= -1;
116 #if defined (HAVE_SYSCONF)
117 pagesize
= sysconf(_SC_PAGESIZE
);
119 pagesize
= FC_HARDCODED_PAGESIZE
;
121 if (w
% pagesize
== 0)
124 return ((w
/ pagesize
)+1)*pagesize
;
127 /* Does not check that the cache has the appropriate arch section. */
129 FcDirCacheValid (const FcChar8
*dir
, FcConfig
*config
)
133 file
= FcDirCacheOpen (config
, dir
, NULL
);
142 #define CACHEBASE_LEN (1 + 32 + 1 + sizeof (FC_ARCHITECTURE) + sizeof (FC_CACHE_SUFFIX))
144 static const char bin2hex
[] = { '0', '1', '2', '3',
147 'c', 'd', 'e', 'f' };
150 FcDirCacheBasename (const FcChar8
* dir
, FcChar8 cache_base
[CACHEBASE_LEN
])
152 unsigned char hash
[16];
155 struct MD5Context ctx
;
158 MD5Update (&ctx
, (unsigned char *)dir
, strlen ((char *) dir
));
160 MD5Final (hash
, &ctx
);
163 hex_hash
= cache_base
+ 1;
164 for (cnt
= 0; cnt
< 16; ++cnt
)
166 hex_hash
[2*cnt
] = bin2hex
[hash
[cnt
] >> 4];
167 hex_hash
[2*cnt
+1] = bin2hex
[hash
[cnt
] & 0xf];
170 strcat ((char *) cache_base
, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX
);
176 FcDirCacheUnlink (const FcChar8
*dir
, FcConfig
*config
)
178 FcChar8
*cache_hashed
= NULL
;
179 FcChar8 cache_base
[CACHEBASE_LEN
];
183 FcDirCacheBasename (dir
, cache_base
);
185 list
= FcStrListCreate (config
->cacheDirs
);
189 while ((cache_dir
= FcStrListNext (list
)))
191 cache_hashed
= FcStrPlus (cache_dir
, cache_base
);
194 (void) unlink ((char *) cache_hashed
);
196 FcStrListDone (list
);
197 /* return FcFalse if something went wrong */
204 FcCacheReadDirs (FcConfig
* config
,
205 FcStrList
*list
, FcFontSet
* set
, FcStrSet
*processed_dirs
)
213 * Read in the results from 'list'.
215 while ((dir
= FcStrListNext (list
)))
217 if (!FcConfigAcceptFilename (config
, dir
))
220 /* Skip this directory if already updated
221 * to avoid the looped directories via symlinks
222 * Clearly a dir not in fonts.conf shouldn't be globally cached.
225 if (FcStrSetMember (processed_dirs
, dir
))
227 if (!FcStrSetAdd (processed_dirs
, dir
))
230 subdirs
= FcStrSetCreate ();
233 fprintf (stderr
, "Can't create directory set\n");
238 FcDirScanConfig (set
, subdirs
,
239 config
->blanks
, dir
, FcFalse
, config
);
241 sublist
= FcStrListCreate (subdirs
);
242 FcStrSetDestroy (subdirs
);
245 fprintf (stderr
, "Can't create subdir list in \"%s\"\n", dir
);
249 ret
+= FcCacheReadDirs (config
, sublist
, set
, processed_dirs
);
251 FcStrListDone (list
);
256 FcCacheRead (FcConfig
*config
)
258 FcFontSet
*s
= FcFontSetCreate();
259 FcStrSet
*processed_dirs
;
264 processed_dirs
= FcStrSetCreate();
268 if (FcCacheReadDirs (config
, FcConfigGetConfigDirs (config
), s
, processed_dirs
))
271 FcStrSetDestroy (processed_dirs
);
275 FcStrSetDestroy (processed_dirs
);
277 FcFontSetDestroy (s
);
281 /* Opens the cache file for 'dir' for reading.
282 * This searches the list of cache dirs for the relevant cache file,
283 * returning the first one found.
286 FcDirCacheOpen (FcConfig
*config
, const FcChar8
*dir
, FcChar8
**cache_path
)
289 FcChar8
*cache_hashed
= NULL
;
290 FcChar8 cache_base
[CACHEBASE_LEN
];
293 struct stat file_stat
, dir_stat
;
295 if (stat ((char *) dir
, &dir_stat
) < 0)
298 FcDirCacheBasename (dir
, cache_base
);
300 list
= FcStrListCreate (config
->cacheDirs
);
304 while ((cache_dir
= FcStrListNext (list
)))
306 cache_hashed
= FcStrPlus (cache_dir
, cache_base
);
309 file
= fopen((char *) cache_hashed
, "rb");
311 if (fstat (fileno (file
), &file_stat
) >= 0 &&
312 dir_stat
.st_mtime
<= file_stat
.st_mtime
)
319 FcStrFree (cache_hashed
);
322 FcStrListDone (list
);
328 *cache_path
= cache_hashed
;
330 FcStrFree (cache_hashed
);
335 /* read serialized state from the cache file */
337 FcDirCacheRead (FcFontSet
* set
, FcStrSet
* dirs
,
338 const FcChar8
*dir
, FcConfig
*config
)
342 void *current_dir_block
;
343 char subdir_name
[FC_MAX_FILE_LEN
+ 1 + 12 + 1];
345 file
= FcDirCacheOpen (config
, dir
, NULL
);
349 if (fread(&metadata
, sizeof(FcCache
), 1, file
) != 1)
351 if (metadata
.magic
!= FC_CACHE_MAGIC
)
354 while (FcCacheReadString (file
, subdir_name
, sizeof (subdir_name
)) &&
355 strlen (subdir_name
) > 0)
356 FcStrSetAdd (dirs
, (FcChar8
*)subdir_name
);
360 int fd
= fileno (file
);
361 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
362 current_dir_block
= mmap (0, metadata
.count
,
363 PROT_READ
, MAP_SHARED
, fd
, metadata
.pos
);
364 if (current_dir_block
== MAP_FAILED
)
366 #elif defined(_WIN32)
370 hFileMap
= CreateFileMapping((HANDLE
) _get_osfhandle(fd
), NULL
, PAGE_READONLY
, 0, 0, NULL
);
371 if (hFileMap
== NULL
)
374 current_dir_block
= MapViewOfFile (hFileMap
, FILE_MAP_READ
, 0, metadata
.pos
, metadata
.count
);
375 if (current_dir_block
== NULL
)
377 CloseHandle (hFileMap
);
382 if (lseek (fd
, metatdata
.pos
, SEEK_SET
) == -1)
385 current_dir_block
= malloc (metadata
.count
);
386 if (!current_dir_block
)
389 /* could also use CreateMappedViewOfFile under MinGW... */
390 if (read (fd
, current_dir_block
, metadata
.count
) != metadata
.count
)
392 free (current_dir_block
);
396 FcCacheAddBankDir (metadata
.bank
, (char *) dir
);
397 if (!FcFontSetUnserialize (&metadata
, set
, current_dir_block
))
401 FcConfigAddFontDir (config
, (FcChar8
*)dir
);
413 FcDirCacheProduce (FcFontSet
*set
, FcCache
*metadata
)
415 void * current_dir_block
, * final_dir_block
;
416 static unsigned int rand_state
= 0;
417 int bank
, needed_bytes_no_align
;
419 #if defined (HAVE_RAND_R)
421 rand_state
= time(0L);
422 bank
= rand_r(&rand_state
);
424 while (FcCacheHaveBank(bank
))
425 bank
= rand_r(&rand_state
);
434 while (FcCacheHaveBank(bank
))
438 memset (metadata
, 0, sizeof(FcCache
));
440 needed_bytes_no_align
= FcFontSetNeededBytes (set
);
441 metadata
->count
= needed_bytes_no_align
+
442 FcFontSetNeededBytesAlign ();
443 metadata
->magic
= FC_CACHE_MAGIC
;
444 metadata
->bank
= bank
;
446 if (!needed_bytes_no_align
) /* not a failure, no fonts to write */
448 /* no, you don't really need to write any bytes at all. */
453 current_dir_block
= malloc (metadata
->count
);
454 if (!current_dir_block
)
456 /* shut up valgrind */
457 memset (current_dir_block
, 0, metadata
->count
);
458 final_dir_block
= FcFontSetDistributeBytes (metadata
, current_dir_block
);
460 if ((void *)((char *)current_dir_block
+metadata
->count
) < final_dir_block
)
463 if (!FcFontSetSerialize (bank
, set
))
466 return current_dir_block
;
469 free (current_dir_block
);
474 FcMakeDirectory (const FcChar8
*dir
)
479 if (strlen ((char *) dir
) == 0)
482 parent
= FcStrDirname (dir
);
485 if (access ((char *) parent
, W_OK
|X_OK
) == 0)
486 ret
= mkdir ((char *) dir
, 0777) == 0;
487 else if (access ((char *) parent
, F_OK
) == -1)
488 ret
= FcMakeDirectory (parent
) && (mkdir ((char *) dir
, 0777) == 0);
495 /* write serialized state to the cache file */
497 FcDirCacheWrite (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*dir
, FcConfig
*config
)
499 FcChar8 cache_base
[CACHEBASE_LEN
];
500 FcChar8
*cache_hashed
;
504 void *current_dir_block
= 0;
506 FcChar8
*cache_dir
= NULL
;
511 * Write it to the first directory in the list which is writable
514 list
= FcStrListCreate (config
->cacheDirs
);
517 while ((test_dir
= FcStrListNext (list
))) {
518 if (access ((char *) test_dir
, W_OK
|X_OK
) == 0)
520 cache_dir
= test_dir
;
526 * If the directory doesn't exist, try to create it
528 if (access ((char *) test_dir
, F_OK
) == -1) {
529 if (FcMakeDirectory (test_dir
))
531 cache_dir
= test_dir
;
537 FcStrListDone (list
);
540 FcDirCacheBasename (dir
, cache_base
);
541 cache_hashed
= FcStrPlus (cache_dir
, cache_base
);
545 current_dir_block
= FcDirCacheProduce (set
, &metadata
);
547 if (metadata
.count
&& !current_dir_block
)
550 if (FcDebug () & FC_DBG_CACHE
)
551 printf ("FcDirCacheWriteDir dir \"%s\" file \"%s\"\n",
554 atomic
= FcAtomicCreate ((FcChar8
*)cache_hashed
);
558 if (!FcAtomicLock (atomic
))
561 fd
= open((char *)FcAtomicNewFile (atomic
), O_RDWR
| O_CREAT
| O_BINARY
, 0666);
566 * Compute file header length -- the FcCache followed by the subdir names
568 header_len
= sizeof (FcCache
);
569 for (i
= 0; i
< dirs
->size
; i
++)
570 header_len
+= strlen ((char *)dirs
->strs
[i
]) + 1;
572 metadata
.pos
= FcCacheNextOffset (lseek (fd
, 0, SEEK_CUR
) + header_len
);
573 metadata
.subdirs
= dirs
->size
;
576 * Write out the header
578 if (write (fd
, &metadata
, sizeof(FcCache
)) != sizeof(FcCache
))
580 perror("write metadata");
584 for (i
= 0; i
< dirs
->size
; i
++)
585 FcCacheWriteString (fd
, (char *)dirs
->strs
[i
]);
589 if (lseek (fd
, metadata
.pos
, SEEK_SET
) != metadata
.pos
)
591 else if (write (fd
, current_dir_block
, metadata
.count
) !=
593 perror("write current_dir_block");
594 free (current_dir_block
);
595 current_dir_block
= 0;
599 if (!FcAtomicReplaceOrig(atomic
))
601 FcStrFree ((FcChar8
*)cache_hashed
);
602 FcAtomicUnlock (atomic
);
603 FcAtomicDestroy (atomic
);
609 FcAtomicUnlock (atomic
);
611 FcAtomicDestroy (atomic
);
613 FcStrFree ((FcChar8
*)cache_hashed
);
614 if (current_dir_block
)
615 free (current_dir_block
);
619 static int banks_ptr
= 0, banks_alloc
= 0;
620 int * _fcBankId
= 0, * _fcBankIdx
= 0;
621 static const char ** bankDirs
= 0;
624 FcCacheHaveBank (int bank
)
628 if (bank
< FC_BANK_FIRST
)
631 for (i
= 0; i
< banks_ptr
; i
++)
632 if (_fcBankId
[i
] == bank
)
639 FcCacheBankToIndexMTF (int bank
)
643 for (i
= 0; i
< banks_ptr
; i
++)
644 if (_fcBankId
[_fcBankIdx
[i
]] == bank
)
646 int t
= _fcBankIdx
[i
];
648 for (j
= i
; j
> 0; j
--)
649 _fcBankIdx
[j
] = _fcBankIdx
[j
-1];
654 if (banks_ptr
>= banks_alloc
)
659 b
= realloc (_fcBankId
, (banks_alloc
+ 4) * sizeof(int));
664 bidx
= realloc (_fcBankIdx
, (banks_alloc
+ 4) * sizeof(int));
669 bds
= realloc (bankDirs
, (banks_alloc
+ 4) * sizeof (char *));
684 FcCacheAddBankDir (int bank
, const char * dir
)
686 int bi
= FcCacheBankToIndexMTF (bank
);
691 bankDirs
[bi
] = (const char *)FcStrCopy ((FcChar8
*)dir
);
695 FcCacheFindBankDir (int bank
)
697 int bi
= FcCacheBankToIndex (bank
);
702 * This code implements the MD5 message-digest algorithm.
703 * The algorithm is due to Ron Rivest. This code was
704 * written by Colin Plumb in 1993, no copyright is claimed.
705 * This code is in the public domain; do with it what you wish.
707 * Equivalent code is available from RSA Data Security, Inc.
708 * This code has been tested against that, and is equivalent,
709 * except that you don't need to include two pages of legalese
712 * To compute the message digest of a chunk of bytes, declare an
713 * MD5Context structure, pass it to MD5Init, call MD5Update as
714 * needed on buffers full of bytes, and then call MD5Final, which
715 * will fill a supplied 16-byte array with the digest.
719 #define byteReverse(buf, len) /* Nothing */
722 * Note: this code is harmless on little-endian machines.
724 void byteReverse(unsigned char *buf
, unsigned longs
)
728 t
= (FcChar32
) ((unsigned) buf
[3] << 8 | buf
[2]) << 16 |
729 ((unsigned) buf
[1] << 8 | buf
[0]);
730 *(FcChar32
*) buf
= t
;
737 * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
738 * initialization constants.
740 static void MD5Init(struct MD5Context
*ctx
)
742 ctx
->buf
[0] = 0x67452301;
743 ctx
->buf
[1] = 0xefcdab89;
744 ctx
->buf
[2] = 0x98badcfe;
745 ctx
->buf
[3] = 0x10325476;
752 * Update context to reflect the concatenation of another buffer full
755 static void MD5Update(struct MD5Context
*ctx
, unsigned char *buf
, unsigned len
)
759 /* Update bitcount */
762 if ((ctx
->bits
[0] = t
+ ((FcChar32
) len
<< 3)) < t
)
763 ctx
->bits
[1]++; /* Carry from low to high */
764 ctx
->bits
[1] += len
>> 29;
766 t
= (t
>> 3) & 0x3f; /* Bytes already in shsInfo->data */
768 /* Handle any leading odd-sized chunks */
771 unsigned char *p
= (unsigned char *) ctx
->in
+ t
;
779 byteReverse(ctx
->in
, 16);
780 MD5Transform(ctx
->buf
, (FcChar32
*) ctx
->in
);
784 /* Process data in 64-byte chunks */
787 memcpy(ctx
->in
, buf
, 64);
788 byteReverse(ctx
->in
, 16);
789 MD5Transform(ctx
->buf
, (FcChar32
*) ctx
->in
);
794 /* Handle any remaining bytes of data. */
796 memcpy(ctx
->in
, buf
, len
);
800 * Final wrapup - pad to 64-byte boundary with the bit pattern
801 * 1 0* (64-bit count of bits processed, MSB-first)
803 static void MD5Final(unsigned char digest
[16], struct MD5Context
*ctx
)
808 /* Compute number of bytes mod 64 */
809 count
= (ctx
->bits
[0] >> 3) & 0x3F;
811 /* Set the first char of padding to 0x80. This is safe since there is
812 always at least one byte free */
816 /* Bytes of padding needed to make 64 bytes */
817 count
= 64 - 1 - count
;
819 /* Pad out to 56 mod 64 */
821 /* Two lots of padding: Pad the first block to 64 bytes */
823 byteReverse(ctx
->in
, 16);
824 MD5Transform(ctx
->buf
, (FcChar32
*) ctx
->in
);
826 /* Now fill the next block with 56 bytes */
827 memset(ctx
->in
, 0, 56);
829 /* Pad block to 56 bytes */
830 memset(p
, 0, count
- 8);
832 byteReverse(ctx
->in
, 14);
834 /* Append length in bits and transform */
835 ((FcChar32
*) ctx
->in
)[14] = ctx
->bits
[0];
836 ((FcChar32
*) ctx
->in
)[15] = ctx
->bits
[1];
838 MD5Transform(ctx
->buf
, (FcChar32
*) ctx
->in
);
839 byteReverse((unsigned char *) ctx
->buf
, 4);
840 memcpy(digest
, ctx
->buf
, 16);
841 memset(ctx
, 0, sizeof(ctx
)); /* In case it's sensitive */
845 /* The four core functions - F1 is optimized somewhat */
847 /* #define F1(x, y, z) (x & y | ~x & z) */
848 #define F1(x, y, z) (z ^ (x & (y ^ z)))
849 #define F2(x, y, z) F1(z, x, y)
850 #define F3(x, y, z) (x ^ y ^ z)
851 #define F4(x, y, z) (y ^ (x | ~z))
853 /* This is the central step in the MD5 algorithm. */
854 #define MD5STEP(f, w, x, y, z, data, s) \
855 ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
858 * The core of the MD5 algorithm, this alters an existing MD5 hash to
859 * reflect the addition of 16 longwords of new data. MD5Update blocks
860 * the data and converts bytes into longwords for this routine.
862 static void MD5Transform(FcChar32 buf
[4], FcChar32 in
[16])
864 register FcChar32 a
, b
, c
, d
;
871 MD5STEP(F1
, a
, b
, c
, d
, in
[0] + 0xd76aa478, 7);
872 MD5STEP(F1
, d
, a
, b
, c
, in
[1] + 0xe8c7b756, 12);
873 MD5STEP(F1
, c
, d
, a
, b
, in
[2] + 0x242070db, 17);
874 MD5STEP(F1
, b
, c
, d
, a
, in
[3] + 0xc1bdceee, 22);
875 MD5STEP(F1
, a
, b
, c
, d
, in
[4] + 0xf57c0faf, 7);
876 MD5STEP(F1
, d
, a
, b
, c
, in
[5] + 0x4787c62a, 12);
877 MD5STEP(F1
, c
, d
, a
, b
, in
[6] + 0xa8304613, 17);
878 MD5STEP(F1
, b
, c
, d
, a
, in
[7] + 0xfd469501, 22);
879 MD5STEP(F1
, a
, b
, c
, d
, in
[8] + 0x698098d8, 7);
880 MD5STEP(F1
, d
, a
, b
, c
, in
[9] + 0x8b44f7af, 12);
881 MD5STEP(F1
, c
, d
, a
, b
, in
[10] + 0xffff5bb1, 17);
882 MD5STEP(F1
, b
, c
, d
, a
, in
[11] + 0x895cd7be, 22);
883 MD5STEP(F1
, a
, b
, c
, d
, in
[12] + 0x6b901122, 7);
884 MD5STEP(F1
, d
, a
, b
, c
, in
[13] + 0xfd987193, 12);
885 MD5STEP(F1
, c
, d
, a
, b
, in
[14] + 0xa679438e, 17);
886 MD5STEP(F1
, b
, c
, d
, a
, in
[15] + 0x49b40821, 22);
888 MD5STEP(F2
, a
, b
, c
, d
, in
[1] + 0xf61e2562, 5);
889 MD5STEP(F2
, d
, a
, b
, c
, in
[6] + 0xc040b340, 9);
890 MD5STEP(F2
, c
, d
, a
, b
, in
[11] + 0x265e5a51, 14);
891 MD5STEP(F2
, b
, c
, d
, a
, in
[0] + 0xe9b6c7aa, 20);
892 MD5STEP(F2
, a
, b
, c
, d
, in
[5] + 0xd62f105d, 5);
893 MD5STEP(F2
, d
, a
, b
, c
, in
[10] + 0x02441453, 9);
894 MD5STEP(F2
, c
, d
, a
, b
, in
[15] + 0xd8a1e681, 14);
895 MD5STEP(F2
, b
, c
, d
, a
, in
[4] + 0xe7d3fbc8, 20);
896 MD5STEP(F2
, a
, b
, c
, d
, in
[9] + 0x21e1cde6, 5);
897 MD5STEP(F2
, d
, a
, b
, c
, in
[14] + 0xc33707d6, 9);
898 MD5STEP(F2
, c
, d
, a
, b
, in
[3] + 0xf4d50d87, 14);
899 MD5STEP(F2
, b
, c
, d
, a
, in
[8] + 0x455a14ed, 20);
900 MD5STEP(F2
, a
, b
, c
, d
, in
[13] + 0xa9e3e905, 5);
901 MD5STEP(F2
, d
, a
, b
, c
, in
[2] + 0xfcefa3f8, 9);
902 MD5STEP(F2
, c
, d
, a
, b
, in
[7] + 0x676f02d9, 14);
903 MD5STEP(F2
, b
, c
, d
, a
, in
[12] + 0x8d2a4c8a, 20);
905 MD5STEP(F3
, a
, b
, c
, d
, in
[5] + 0xfffa3942, 4);
906 MD5STEP(F3
, d
, a
, b
, c
, in
[8] + 0x8771f681, 11);
907 MD5STEP(F3
, c
, d
, a
, b
, in
[11] + 0x6d9d6122, 16);
908 MD5STEP(F3
, b
, c
, d
, a
, in
[14] + 0xfde5380c, 23);
909 MD5STEP(F3
, a
, b
, c
, d
, in
[1] + 0xa4beea44, 4);
910 MD5STEP(F3
, d
, a
, b
, c
, in
[4] + 0x4bdecfa9, 11);
911 MD5STEP(F3
, c
, d
, a
, b
, in
[7] + 0xf6bb4b60, 16);
912 MD5STEP(F3
, b
, c
, d
, a
, in
[10] + 0xbebfbc70, 23);
913 MD5STEP(F3
, a
, b
, c
, d
, in
[13] + 0x289b7ec6, 4);
914 MD5STEP(F3
, d
, a
, b
, c
, in
[0] + 0xeaa127fa, 11);
915 MD5STEP(F3
, c
, d
, a
, b
, in
[3] + 0xd4ef3085, 16);
916 MD5STEP(F3
, b
, c
, d
, a
, in
[6] + 0x04881d05, 23);
917 MD5STEP(F3
, a
, b
, c
, d
, in
[9] + 0xd9d4d039, 4);
918 MD5STEP(F3
, d
, a
, b
, c
, in
[12] + 0xe6db99e5, 11);
919 MD5STEP(F3
, c
, d
, a
, b
, in
[15] + 0x1fa27cf8, 16);
920 MD5STEP(F3
, b
, c
, d
, a
, in
[2] + 0xc4ac5665, 23);
922 MD5STEP(F4
, a
, b
, c
, d
, in
[0] + 0xf4292244, 6);
923 MD5STEP(F4
, d
, a
, b
, c
, in
[7] + 0x432aff97, 10);
924 MD5STEP(F4
, c
, d
, a
, b
, in
[14] + 0xab9423a7, 15);
925 MD5STEP(F4
, b
, c
, d
, a
, in
[5] + 0xfc93a039, 21);
926 MD5STEP(F4
, a
, b
, c
, d
, in
[12] + 0x655b59c3, 6);
927 MD5STEP(F4
, d
, a
, b
, c
, in
[3] + 0x8f0ccc92, 10);
928 MD5STEP(F4
, c
, d
, a
, b
, in
[10] + 0xffeff47d, 15);
929 MD5STEP(F4
, b
, c
, d
, a
, in
[1] + 0x85845dd1, 21);
930 MD5STEP(F4
, a
, b
, c
, d
, in
[8] + 0x6fa87e4f, 6);
931 MD5STEP(F4
, d
, a
, b
, c
, in
[15] + 0xfe2ce6e0, 10);
932 MD5STEP(F4
, c
, d
, a
, b
, in
[6] + 0xa3014314, 15);
933 MD5STEP(F4
, b
, c
, d
, a
, in
[13] + 0x4e0811a1, 21);
934 MD5STEP(F4
, a
, b
, c
, d
, in
[4] + 0xf7537e82, 6);
935 MD5STEP(F4
, d
, a
, b
, c
, in
[11] + 0xbd3af235, 10);
936 MD5STEP(F4
, c
, d
, a
, b
, in
[2] + 0x2ad7d2bb, 15);
937 MD5STEP(F4
, b
, c
, d
, a
, in
[9] + 0xeb86d391, 21);