Simple encryption proposal. Comments ?

Bengt Richter bokr at oz.net
Mon Jan 6 23:22:30 CET 2003


On 2 Jan 2003 22:02:43 GMT, bokr at oz.net (Bengt Richter) wrote:

>On 02 Jan 2003 06:58:20 -0800, Paul Rubin <phr-n2002b at NOSPAMnightsong.com> wrote:
>
>>bokr at oz.net (Bengt Richter) writes:
>>> Thanks for posting, mine was in C++ and not so pretty (though fast enough ;-)
>>> 
>>> BTW, (untested)
>>> 
>>>     k1, k2, k3 = map(_inv_letters.__getitem__, x[i:i+3])
>>> 
>>> might be an interesting alternative to the list comprehension?
>>
>>I don't know, I wasn't really trying to make that function fast, I was
>>just playing around.  Base52 is a clever idea (I've gotten burned a
>>number of times by non-alphanumeric base64 characters needing escaping
>>for some purpose) so I wanted to try it.  A more serious
>>implementation should be done as a C patch to the binascii module.
>>
>Ok. Below is a diff. I haven't tested it extensively, and it is called binasciiXXX.c
>to kludge it into being an independently importable module for testing. I didn't
>rebuild python (2.2.2 on windows nt4) yet.
I did later, and I split out a base52x module that does more with the code space,
(see new thread on base52 for example ;-).
>
>It was linked with (just relinked for log) the following, which warns of my test kludging to
>make the DLL export the init name.
>
BTW, I don't know why I messed with DL_EXPORT in the source. Hope no one took that as a model
for how to do it right ;-/ The linker likes -export: just fine, as in a little handy command file
I use when I don't want to bother with the IDE.

====< mkpydll.cmd >=====
@cl -LD -nologo -Id:\python22\include %1.c -link -LIBPATH:D:\python22\libs -export:init%1
========================

Anyway, see what you think. The new base52 lets you include metadata
(or whatever you want to call it ;-)

Regards,
Bengt Richter




More information about the Python-list mailing list