chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] md5 egg documentation wrong


From: Kon Lovett
Subject: Re: [Chicken-users] md5 egg documentation wrong
Date: Thu, 15 Dec 2011 12:03:26 -0800

On Dec 15, 2011, at 10:16 AM, address@hidden wrote:

> The documentation for the md5 egg states:
> 
>> Any Scheme-object can be the SOURCE for a digest.
> 
> But that seems to be wrong:

It is wrong, or at least incomplete, without the sentence below it in the doc: 
"See [[message-digest]] for more information." Misleading in any case.

The "Message Digest" doc section "Common Argument Definitions" has a discussion 
of the interpretation of the "SOURCE" argument. Only something that can easily 
be massaged into a byte-vector is supported.

Using the 'message-digest-chunk-converter' & the "s11n" egg 'serialize' (to a 
string port) it should be possible to get a digest of a cons cell. (Be nice if 
blob-ports existed.)

Example:

#;1> (use s11n ports)
#;2> (call-with-output-string (cut serialize '(1 . 2) <>))
"\x05\x02\x00\x00\x00\x00\x00\x00\x03\x03\x03\x00\x00\x00\x00\x00\x00\x00\x03\x05\x00\x00\x00\x00\x00\x00\x00"

So:

        (message-digest-chunk-converter (lambda (obj) (call-with-output-string 
(cut serialize obj <>))))

should be enough.

Sorry,
Kon

> 
>> (md5-digest (cons 1 2))
> 
> Error: (message-digest-update-object) indigestible object: (1 . 2)
> 
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]