SWIG and binary strings?

Markus Stenberg mstenber at cc.Helsinki.FI
Mon Jun 28 06:57:04 CEST 1999


ngps at madcap.dyn.ml.org (Ng Pheng Siong) writes:
> In article <al8pv2nwnny.fsf at myntti.helsinki.fi>,
> Markus Stenberg  <mstenber at cc.Helsinki.FI> wrote:
> >I've swig'ed OpenSSL library for my Python needs. 
> Me too! 
> Well, I've only done RSA and block ciphers, since that's
> what my application needs for now. (Ok, one block cipher. 
> Adding more block ciphers looks like cut-&-paste to me.)

Ah, I've concentrated on SSL itself (TLS actually, but still; full TLS/SSL
functionality, no ciphers whatsoever wrapped). I wish someone wrapped whole
OpenSSL and maintained it.. ;-) (I'd do it, but I'm too lazy by half)

> >Is there any elegant way to make SWIG generate s# automatically (as opposed
> >to s, and requiring unneccessary length parameter and much whining if
> >string has 0's?)
> >
> >My (ugly) solution was following:
> Dunno if my solution qualifies as ugly, but here's what I do:

It does; I'd prefer solution that didn't sacrifice any speed (although,
admittedly, I guess your approach's overhead isn't very high) because
esp. SSL_write is called fairly often ;-) Also, being transparent to the
user wouldn't hurt (.. count length of strings? isn't this Century of the
Fruitbat?)

I thought of that as well.. Oh well. Hoped there was some really elegant
solution I was just missing ;-)

> Cheers.
> -- 
> Ng Pheng Siong <ngps at post1.com>

-Markus Stenberg

-- 
"Schizophrenia, like the Unicorn, is described in various ways by
various people. And its elimination, like the capture of the Unicorn,
appears to require some special conditions, not all of which have yet
been specified. Finally, whether or not those conditions exist, belief
in their existence has had significant consequences."
	- Schizophrenia, Behavioural Aspects (Salzinger, 1972)




More information about the Python-list mailing list