For some reason I am getting an error when I try to run the Sage implementation of SDES. I did not make any changes to the source code. I did add this to encrypt a plaintext. Y = SDESEncrypt("10111101", "1010000010")
. I get an error from this function:
def XorBlock(block1, block2):
r"""
Xors two blocks together.
"""
l = len(block1);
if (l != len(block2)):
raise ValueError, "XorBlock arguments must be same length"
return [(block1[j]+block2[j]) % 2 for j in xrange(l)];
The error is: TypeError: not all arguments converted during string formatting
I'm really unsure why I get this error. I retrieved the source code from the Stallings Sage examples Appendix. It can be found here: http://faculty.mu.edu.sa/public/uploads/1360993259.0858Cryptography%20and%20Network%20Security%20Principles%20and%20Practice,%205th%20Edition.pdf It begins on page 689.