Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for good small DES implementation [closed]

I'm looking for a good permissive-licensed (BSD/MIT or PD) DES implementation in C, with minimal runtime memory usage (i.e. minimal amount of read-write memory, and preferably small code/table size too). Speed is not an issue; in fact, in some ways slower is better because it provides some natural defense against brute-force login attempts.

All of the traditional implementations I've seen do lazy/runtime initialization of huge tables, which is what I'm trying to avoid. I'd be happy to have the tables in static const data in the binary, and in fact this is what I've partly hacked onto an implementation I've got right now, but I'm wondering if there are any existing implementations that do a better job of minimizing the size of tables at the expense of performance so that the binary isn't so big (~50kb of tables).

Note: Yes, DES sucks. The intended usage case is for implementing the crypt function for handling traditional password logins.

like image 900
R.. GitHub STOP HELPING ICE Avatar asked Dec 28 '25 20:12

R.. GitHub STOP HELPING ICE


1 Answers

An example with MIT license and the version from libtomcrypt is completely free for all purposes.

The first version seems to do lazy initialization of the tables, too, whereas they are static consts in libtomcrypt. But libtomcrypt seems to give you a compilation flag for speed vs. size, there's a #ifndef LTC_SMALL_CODE in front of the larger tables, maybe that can solve your problem?

like image 132
emboss Avatar answered Dec 31 '25 12:12

emboss