@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13



Comments:

<0> mitsuhiko: I do too. But str.translate is somewhat faster in this context.
<1> ModelNine: that's reflex :)
<1> jup
<0> AnKiMo: you mean PyCrypto? It also has RSA signing capabilities, IIRC.
<0> DSA is only for signing, though.
<0> (that's why it's called DSA...)
<0> RSA keys can be used to sign and to encrypt. DSA keys can only be used to sign, because that's what the algorithm is specified for.
<2> ModelNine: Give me a second. I have to take a look if checked that. I chacked crypto but this has only support for generated keys not for official CA certificated keys.
<0> Me, personally, I'd use ElGamal, because it's patent-unencumbered.
<0> AnKiMo: as I said, use M2Crypto if you need standards-compliance.
<0> M2Crypto is an openssl-wrapper.
<0> (for Python)
<2> ModelNine: But has no possibility to sign RSA keys. That is my problem.
<0> AnKiMo: what do you want to do exactly?
<2> I have to sign a soapmessage with an given RSA key.
<0> You have an RSA-key in PKCS<something>, and you need to use that to sign a message? Sure, OpenSSL can do that.



<0> And so can M2Crypto.
<0> (because OpenSSL can)
<2> How ? There is no method for this like for DSA in M2Crypto. I searched through sourcecode and documentation.
<0> I'm pretty sure that it works just like it does for DSA (there's no need for special functions), you just have to load a key (which is an RSA key in your case), and sign a BIO-stream with it.
<3> How do I turn strings into numbers?
<3> For example, how to get 4 out of '4' ?
<0> top222: int('4')
<4> top222: int(number)
<5> Anyone know where I can find dotNETters on IRC?
<3> And what about 2.5 from '2.5' ?
<4> top222: I will guess float()
<2> ModelNine: In the DSA modul i have a method sign. But not in RSA. Also in BIO is no method like sign. I am not sure if it is doable by hand or with different steps.
<6> float("2.5")
<0> AnKiMo: let me check.
<3> Ok, thanks everyone :)
<0> AnKiMo: read up on the S/MIME stuff M2Crypto has. I guess that basically that's what you're trying to do. There are even examples for it in the source distribution.
<2> ModelNine: I take a look. Thank you.
<0> AnKiMo: http://sandbox.rulemaker.net/ngps/m2/api-daily/m2/demo/smime
<5> is the arbitrary order of a dict always the same arbitrary order? I mean what is the best way to split a dict into two sequesnces of matching order?
<5> keys, vals = D.keys(), D.values()?
<7> one way is 'for key,val in D.items():'
<8> Hi. A library I'm using returns some image data as a string array. How do I get the integer value of a char? printing it just gives the ascii equivalent.
<9> use ord() for the char
<8> thanks a ton
<8> i'm still kinda new to python
<9> you might be interested in struct module too, in the standard library
<9> that's for packing data from/to strings
<8> i'm trying to track down this frustrating bug
<8> crap
<8> looks like i'm gonna have to dig into the C++ code :P
<10> does anyone have any clue when I'm using pyserial that I'm only able to read the first 393 bytes of a 457 byte packet? no matter what I do, I can't seem to get the last 64 bytes
<10> as soon as I write to the port again, I am able to read
<10> but not before
<10> (this is on linux)
<10> I haven't had a chance to try this on windows to see if the behavior duplicates itself, but pyserial works fine over bluetooth and does what I expect
<10> it is able to read the 457 of 457 properly
<11> Haha, I would've never thought `my_int` would be faster than str(my_int)
<11> But in fact, it's about 1.7x as fast
<8> can I use ord() to turn a string into an array of ints in one fell swoop?
<11> oneko, probably not
<11> " Return the integer ordinal of a one-character string."
<8> ok
<12> map(ord, string)
<11> [ord(c) for c in string]
<11> or that, yeah :p
<8> yeah, it's just as I thought
<8> it's not a bug in my drawing code, it's a bug in the C++ library that generates the bitmap I'm trying to draw
<11> List comprehensions appear a little bit faster
<11> >>> timeit.Timer("[ord(c) for c in 'foo']").timeit() -> 2.1583753564983681
<11> >>> timeit.Timer("map(ord, 'foo')").timeit() -> 2.6311771027068289
<8> i just needed it to see if the values of my bitmap summed to 0 under certain conditions.. wasn't sure if the bitmap really WAS blank, or I just wasn't drawing it properly
<11> Of course, generator expressions are much faster
<8> because the author swore up and down that it was a wxPython problems, not a problem in his code :)
<13> veracon_ on my machine the generator expression for that short iteration is much more expensive
<13> much slower that is
<11> Zalamander, on here it only gives 0.95367600691110965 (but of course that's before viewing any results)
<12> that would be because it doesn't _do_ anything before viewing any results
<11> Exactly
<12> so it's not a sane comparison in any way
<11> But if you don't necessarily use all, it's the better way



<14> i'm writing a short script to bind some a dtd to java code, i'd like to package script and libraries correctly, anyone know where I can find some docs on python and packaging?
<13> I did a "for x in <listcomp or genexp here>: p***"
<13> and the genexp was slower
<11> Of course :)
<13> that probably is not the case for longer lists
<15> andybob: docs.python.org/dist
<12> map also gets quite a bit faster than listcomp with a large string
<14> Yhg1s: thanks much -- that is perfect
<11> Juhaz, a 25-character string appears to give about the same here
<10> hmm, I **** at python, how do I access an overriden method from the supercl***?
<10> super.method() works?
<11> super(self.__cl***__, self).method, maybe
<11> I don't know
<10> jeez, that's horrible
<11> Indeed
<10> how does that help with code re-use....
<13> pfn how does it not?
<12> veracon_, try few thousand.
<11> Juhaz, will do :P
<10> the fact that it sounds overly complex for performing a simple function
<13> pfn it's not simple at all, when multiple inheritance is involved.
<13> pfn you can write it more simply, but then it will break in some cases of multiple inheritence
<10> right, but one would imagine there should be a reasonable default
<10> in the case that multiple inheritance does not provide multiple implementations
<13> I don't understand "reasonable default"
<10> oh well, I guess super(cls, self).method will do
<10> thanks
<16> TheSuperCl***.method(obj_instance) works too, no?
<11> Juhaz, with 3000 chars, listcomp takes 1.2x the time of map.
<7> in the docstring for super, an explicit cl*** (rather than self.__cl***__) is used in the example
<11> roryy, yeah, I didn't say it was the right way, just meant as a demonstration :)
<7> well, i just got a recursionlimit exception and broke ipython doing it with self.__cl***__ ;)
<8> reading other people's C code reminds me of how awful I am of a C programmer :P
<17> C is good unless you are trying to do a GUI library like the GTK guys
<12> veracon_, indeed. although I'm already reading map as faster with no more than 5 chars, dunno why it takes much more there
<7> hrm. where do i find the older "what's new in python" pages? in particular, for 2.2 ?
<7> ah, in www.python.org, not docs.python.org
<18> roryy: http://www.python.org/download/releases/2.2/
<7> ty
<18> roryy: and http://www.python.org/doc/2.2.3/whatsnew/whatsnew22.html
<19> hi again
<19> TypeError: Error when calling the metacl*** bases
<19> module.__init__() takes at most 2 arguments (3 given)
<19> i don't really know what's wrong
<19> getattr( modules.search, search[0] )( self.logger, **searches[1] )
<19> those this call __init__ ?
<20> I have tuple A = (1,2,3) and want to make a new tuple same as A just extended by 4 - B=(1,2,3,4). How?
<7> (1,2,3)+(4,)
<20> thanks
<19> and me ?
<19> :D
<7> asabil: what kind of object is getattr(modules.search,search[0]) ?
<19> a cl***
<7> well, 'calling' a cl*** will invoke it's __init__ method
<21> is there a way to introspectively list the members and methods of a cl*** instance?
<19> xp_prg, dir
<7> (the parentheses after the getattr(m.s,s[0]) are syntax for 'calling' the cl***)
<19> that's what i am expecting
<19> but it seems that the error is not there
<19> wait please
<19> __all__ = [ 'Man', 'Web' ]
<19> for mh_module in __all__:
<19> exec "from %s import %s" % ( mh_module, mh_module )
<19> is this ok ?
<22> ionel_mc: no, the long names, but with only one capitalization.
<19> it's in an __init__.py
<19> cl*** Man( Base ):
<19> TypeError: Error when calling the metacl*** bases
<19> module.__init__() takes at most 2 arguments (3 given)
<23> Can callables have their own attributes?
<7> asabil: perhaps a 'module' cl*** (odd name...?) is instantiated in one of those two modules
<19> roryy, i can paste code if you wish
<24> do you have the self argument in init
<7> asabil: does the traceback not give a specific line ?


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

#centos
CRITICAL **: gsm_protocol_new: assertion `GNOME_CLIENT_CONNECTED (gnome_client)'
nvidia c51 x server ubuntu
TTFTOOL incomplete ttf file
#suse
Exception starting xend: (111, 'Connection refused')
#ubuntu
!!! Unable to build DRM modules.
#linux
grub alternative x11.conf



Home  |  disclaimer  |  contact  |  submit quotes