 ! Copyright (C) 2006, 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel io io.binary io.files io.streams.byte-array math
+USING: alien.c-types kernel io io.binary io.files io.streams.byte-array math
 math.functions math.parser namespaces splitting grouping strings
 sequences byte-arrays locals sequences.private macros fry
 io.encodings.binary math.bitwise checksums accessors

HINTS: (process-md5-block-H) { uint-array md5-state } ;
HINTS: (process-md5-block-I) { uint-array md5-state } ;

M: md5-state checksum-block ( block state -- )
    [
        [ byte-array>uint-array ] [ state>> ] bi* {
            [ (process-md5-block-F) ]
            [ (process-md5-block-G) ]
            [ (process-md5-block-H) ]

        nip update-md5
    ] 2bi ;

: md5>checksum ( md5 -- bytes ) state>> uint-array>byte-array-le ;

M: md5-state clone ( md5 -- new-md5 )
    call-next-method
