diff options
author | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2009-03-01 09:51:00 -0500 |
---|---|---|
committer | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2009-03-01 10:23:13 -0500 |
commit | 5b5b496c0f81f3595d0aebb8da5196492abae429 (patch) | |
tree | 63cb94ef764d0dc2b603e34951f7d42f73ae4ef6 /src/XOR.c | |
parent | 494cad8bc9a706aeb721098e8e1cd19c26d84466 (diff) | |
download | pycrypto-5b5b496c0f81f3595d0aebb8da5196492abae429.tar.gz |
Remove Blowfish, DES, DES3, IDEA, RC5, and XOR modules
Because:
- Blowfish: Uses the original (ambiguous) PyCrypto license. The
documentation says "the Blowfish algorithm has been placed in the public
domain and can be used freely", but this seems to be referring to
patents, not copyright.
- DES: The file says "Copyright (C) 1993 Eric Young", and appears to have
been taken from SSLeay. The license of SSLeay is not GPL-compatible,
since it has an advertising clause.
- DES3: Same reason as for the DES module.
- IDEA: Patent-encumbered.
- RC5: Patent-encumbered.
- XOR: Insecure as a stream cipher, and it silently truncates "keys"
to 32 bytes. The strxor module is a better replacement if you want to
do a bitwise exclusive-or between strings.
Diffstat (limited to 'src/XOR.c')
-rw-r--r-- | src/XOR.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/XOR.c b/src/XOR.c deleted file mode 100644 index f2c74af..0000000 --- a/src/XOR.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * xor.c : Source for the trivial cipher which XORs the message with the key. - * The key can be up to 32 bytes long. - * - * Part of the Python Cryptography Toolkit - * - * Distribute and use freely; there are no restrictions on further - * dissemination and usage except those imposed by the laws of your - * country of residence. - * - */ - -#define MODULE_NAME XOR -#define BLOCK_SIZE 1 -#define KEY_SIZE 0 - -typedef struct -{ - unsigned char key[32]; - int keylen, last_pos; -} stream_state; - -static void -stream_init(stream_state *self, unsigned char *key, int len) -{ - int i; - - if (32 <= len) len=32; - self->keylen = len; - self->last_pos = 0; - - for(i=0; i<len; i++) - { - self->key[i] = key[i]; - } -} - -/* Encryption and decryption are symmetric */ -#define stream_decrypt stream_encrypt - -static void stream_encrypt(stream_state *self, unsigned char *block, - int len) -{ - int i, j = self->last_pos; - for(i=0; i<len; i++, j=(j+1) % self->keylen) - { - block[i] ^= self->key[j]; - } - self->last_pos = j; -} - -#include "stream_template.c" |