<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Sorry it took so long, but I've submitted a pull request to make
    this function public in file/sha1:<br>
    <br>
    <a class="moz-txt-link-freetext" href="https://github.com/plt/racket/pull/426">https://github.com/plt/racket/pull/426</a><br>
    <br>
    Let me know if I screwed up, it's my first pull request.<br>
    <br>
    Thanks,<br>
    Dave<br>
    <br>
    <div class="moz-cite-prefix">On 06/11/2013 05:11 PM, Robby Findler
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAL3TdOMS050e1Argnu_PP-fi8EF9vyDZG4MW9vjZv8z_m_SUyg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Yes, I think file/sha1 is the right place.
        <div><br>
        </div>
        <div>Thanks!<br>
          <div><br>
          </div>
          <div>Robby</div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Tue, Jun 11, 2013 at 3:26 PM, David
          Vanderson <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:david.vanderson@gmail.com" target="_blank">david.vanderson@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you
            Stephen and Tony for your examples.  I found the following
            private function in db/private/mysql/connection.rkt:<br>
            <br>
            (define (hex-string-&gt;bytes s)<br>
              (define (hex-digit-&gt;int c)<br>
                (let ([c (char-&gt;integer c)])<br>
                  (cond [(&lt;= (char-&gt;integer #\0) c
            (char-&gt;integer #\9))<br>
                         (- c (char-&gt;integer #\0))]<br>
                        [(&lt;= (char-&gt;integer #\a) c
            (char-&gt;integer #\f))<br>
                         (+ 10 (- c (char-&gt;integer #\a)))]<br>
                        [(&lt;= (char-&gt;integer #\A) c
            (char-&gt;integer #\F))<br>
                         (+ 10 (- c (char-&gt;integer #\A)))])))<br>
              (unless (and (string? s) (even? (string-length s))<br>
                           (regexp-match? #rx"[0-9a-zA-Z]*" s))<br>
                (raise-type-error 'hex-string-&gt;bytes<br>
                                  "string containing an even number of
            hexadecimal digits" s))<br>
              (let* ([c (quotient (string-length s) 2)]<br>
                     [b (make-bytes c)])<br>
                (for ([i (in-range c)])<br>
                  (let ([high (hex-digit-&gt;int (string-ref s (+ i
            i)))]<br>
                        [low  (hex-digit-&gt;int (string-ref s (+ i i
            1)))])<br>
                    (bytes-set! b i (+ (arithmetic-shift high 4) low))))<br>
                b))<br>
            <br>
            <br>
            Can this function be exported?  I'm willing to make a patch
            with docs and tests - is file/sha1 the right place?
            <div class="HOEnZb">
              <div class="h5"><br>
                <br>
                Thanks,<br>
                Dave<br>
                <br>
                _________________________<br>
                 Racket Developers list:<br>
                 <a moz-do-not-send="true"
                  href="http://lists.racket-lang.org/dev"
                  target="_blank">http://lists.racket-lang.org/dev</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>