[plt-scheme] Accessing openssl from MzScheme, sending control-c (end of text)

From: Erich Rast (erich at snafu.de)
Date: Sat Jul 7 07:37:25 EDT 2007

Hi,

This is a possibly naive question, as I'm not all too familiar with  
escape sequences, subprocesses, and shells. I'd like to compute an  
sha1 checksum of a utf8 string using openssl on OS X. In OS X  
terminal, I'd write openssl sha1, press newline and write some text,  
and then press control-c. However, the following doesn't work:

(require (lib "process.ss"))
(define (sha1 str)
     (system (string-append "openssl sha1\n" str "\n\x3")))

It never ends. I suppose the encoding is wrong. How can I signal to  
openssl that the text has ended and it should return the checksum?  
Otherwise I'd have to create a temp file each time, which shouldn't  
really be necessary. Related to this: Is there a cross-platform way  
to access openssl (except for the library on planet, which looks  
great but fails its own tests in  370.2-svn30may2007 on my system) ?

Regards,

Erich


Posted on the users mailing list.