Changeset 36179 in project


Ignore:
Timestamp:
08/11/18 21:26:39 (13 months ago)
Author:
sjamaan
Message:

Drop srfi-13 dependency from simple-md5, because why not

Location:
release/5/simple-md5/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/5/simple-md5/trunk/simple-md5.egg

    r36048 r36179  
    55 (license "Public Domain")
    66 (maintainer "Peter Bex")
    7  (dependencies memory-mapped-files srfi-13)
     7 (dependencies memory-mapped-files)
    88 (test-dependencies test)
    99 (category crypt)
  • release/5/simple-md5/trunk/simple-md5.scm

    r36017 r36179  
    55(module simple-md5 (string->md5sum file-md5sum)
    66
    7 (import scheme (chicken base) (chicken blob) (chicken file) (chicken foreign) (chicken file posix)
    8         memory-mapped-files srfi-13)
     7(import scheme (chicken base) (chicken blob) (chicken file)
     8        (chicken foreign) (chicken file posix) (chicken fixnum)
     9        memory-mapped-files)
    910
    1011(foreign-declare "#include \"md5-base.c\"")
     
    1819(define final (foreign-lambda void MD5Final scheme-pointer scheme-pointer))
    1920
     21(define (char->hexdigits c)
     22  (let ((int (char->integer c)))
     23    (if (fx>= int 16)
     24        (number->string int 16)
     25        (string-append "0" (number->string int 16)))))
     26
    2027(define (string->md5sum str)
    2128  (let ((str-size (string-length str))
     
    2633      (update ctxt str str-size))
    2734    (final ctxt digest)
    28     (string-concatenate
    29      (map (lambda (c)
    30             (string-pad (number->string (char->integer c) 16) 2 #\0))
    31           (string->list digest)))))
     35    (apply string-append (map char->hexdigits (string->list digest)))))
    3236
    3337;; From simple-sha1
     
    6670         (final ctxt digest)
    6771         (file-close fd)
    68          (string-concatenate
    69           (map (lambda (c)
    70                  (string-pad (number->string (char->integer c) 16) 2 #\0))
    71                (string->list digest))))))
     72         (apply string-append (map char->hexdigits (string->list digest))))))
    7273)
Note: See TracChangeset for help on using the changeset viewer.