Md5 string

Discussion in 'Rebol' started by geoff, Apr 8, 2010.

  1. geoff

    geoff New Member

    Hi,

    I'm using a MD5 hash and I get a binary number output like this if I print it:

    #{CF020BEF44D3833F79022FA1D7F6D80CEA3639EF}

    I'm trying to get this as a string so I can write it to a file, however I can only get the first 8 characters:

    CF0202BE

    I guess this is limited by integer size in the conversion. (i used to-hex to-integer)

    Is there a solution?

    thanks,

    geoff
  2. Graham

    Graham Developer Staff Member

  3. geoff

    geoff New Member

    Graham,

    Thanks! I was using the second method, and now I've discovered the enbase function.
    My working demo:

    Rebol [
    Title: "MD5 test"
    ]
    sport: open [scheme: 'checksum algorithm: 'md5]
    insert sport "Hello World"
    insert sport "more Hello World"
    update sport
    out: copy sport
    close sport
    print out
    print enbase/base out 16


    Thanks again,

    Geoff
  4. Graham

    Graham Developer Staff Member

Share This Page