Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schaefer's Simplified Data Encryption Standard for educational purposes #6461

Closed
sagetrac-mvngu mannequin opened this issue Jul 4, 2009 · 9 comments
Closed

Schaefer's Simplified Data Encryption Standard for educational purposes #6461

sagetrac-mvngu mannequin opened this issue Jul 4, 2009 · 9 comments

Comments

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Jul 4, 2009

This is a follow-up to #6164. The goal here is to implement the S-DES block cipher of Schaefer as described in the paper:

E. Schaefer. A simplified data encryption algorithm. Cryptologia, 20(1):77--84, 1996.

This is a simplified variant of the Data Encryption Standard (DES) to be used for cryptography education.

CC: @malb

Component: cryptography

Keywords: DES, S-DES

Author: Minh Van Nguyen

Reviewer: Martin Albrecht, William Stein

Merged: Sage 4.1.2.alpha0

Issue created by migration from https://trac.sagemath.org/ticket/6461

@sagetrac-mvngu
Copy link
Mannequin Author

sagetrac-mvngu mannequin commented Jul 4, 2009

Author: Minh Van Nguyen

@sagetrac-mvngu sagetrac-mvngu mannequin added this to the sage-4.1 milestone Jul 4, 2009
@sagetrac-mvngu sagetrac-mvngu mannequin added the s: needs review label Jul 4, 2009
@malb
Copy link
Member

malb commented Jul 16, 2009

comment:2

Review:

  • I assume that the specification implemented is correct, I didn't check against the paper, are there official test vectors?
  • The code looks good and is nicely documented (coverage: 100%)
  • __cmp__ expects you to return an integer (-1,0,1) and not True or False, cf. http://docs.python.org/reference/datamodel.html
  • it is a bit confusing that P is often the plaintext (cf. C for ciphertext) and the permutation, but that might be a problem in the paper
  • it would be nice to have an sbox(n) function to return the S-Boxes 0 and 1
  • patch applies cleanly against 4.1.
  • reference manual builds without warnings and the result looks okay.
  • doctests pass on sage.math

Bottomline: positive review except some nitpicks.

@sagetrac-mvngu
Copy link
Mannequin Author

sagetrac-mvngu mannequin commented Jul 16, 2009

comment:3

Replying to @malb:

  • I assume that the specification implemented is correct, I didn't check against the paper, are there official test vectors?

Unfortunately, I don't have access to the original paper by Schaefer, and neither do my institution. I relied on the note at

http://bitterroot.vancouver.wsu.edu/cs427_Spring09/docs/sdes.pdf

Before switching to using __cmp__(), I used == for comparing objects. But then doing a == loads(dumps(a)) consistently returned False for me. Let me try it again.

  • it is a bit confusing that P is often the plaintext (cf. C for ciphertext) and the permutation, but that might be a problem in the paper

Ah... the notes I referenced above uses IP to denote the initial permutation and IP^-1 for its inverse. Perhaps that is less confusing you think?

  • it would be nice to have an sbox(n) function to return the S-Boxes 0 and 1

That can be done.

@malb
Copy link
Member

malb commented Jul 16, 2009

comment:4

I just found this: http://buzzard.ups.edu/sdes/sdes.html :)

@sagetrac-mvngu
Copy link
Mannequin Author

sagetrac-mvngu mannequin commented Jul 24, 2009

based on Sage 4.1.1.alpha0

@sagetrac-mvngu
Copy link
Mannequin Author

sagetrac-mvngu mannequin commented Jul 24, 2009

comment:5

Attachment: trac_6461-sdes.patch.gz

Replying to @malb:

  • I assume that the specification implemented is correct, I didn't check against the paper, are there official test vectors?

There are no official test vectors for simplified DES. Even the original paper by Schaefer doesn't contain any such vectors.

The latest patch trac_6461-sdes.patch now uses __eq__(). I have also modified the class MiniAES in sage/crypto/block_cipher/miniaes.py so it now also uses __eq__().

  • it would be nice to have an sbox(n) function to return the S-Boxes 0 and 1

Done.

@williamstein
Copy link
Contributor

comment:6

Looks good to me, and Martin says it's ok if it fixes the nitpicks, which I think it does.

@sagetrac-mvngu
Copy link
Mannequin Author

sagetrac-mvngu mannequin commented Aug 23, 2009

Reviewer: Martin Albrecht, William Stein

@sagetrac-mvngu
Copy link
Mannequin Author

sagetrac-mvngu mannequin commented Aug 23, 2009

Merged: Sage 4.1.2.alpha0

@sagetrac-mvngu sagetrac-mvngu mannequin closed this as completed Aug 23, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants