Ticket #9730 (needs_work enhancement)
A simple RC4 cipher implementation for Sage
| Reported by: | sg.sourav | Owned by: | mvngu |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | cryptography | Keywords: | RC4, Cryptosystem, Cipher |
| Cc: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | |
| Authors: | Sourav Sen Gupta | Merged in: | |
| Dependencies: | Stopgaps: |
Description
This is a standard RC4 implementation in the Cryptography directory for Sage. We do not consider advanced criteria to initialize the state bytearray, and hence this system may be prone to attacks (refer to relevant literature).
Though this is not fully secure (upto industry standard), this is a full-version implementation of the cipher, and can be used for educational purpose as well as for small-scale encryptions.
Attachments
Change History
comment:2 Changed 3 years ago by mvngu
- Status changed from needs_review to needs_work
Running doctests over rc4.py fails with message:
[mvngu@sage sage-4.5.3.alpha0]$ ./sage -t -long devel/sage-main/sage/crypto/rc4.py sage -t -long "devel/sage-main/sage/crypto/rc4.py" ********************************************************************** Error: TAB character found. [1.9 s] ---------------------------------------------------------------------- The following tests failed: sage -t -long "devel/sage-main/sage/crypto/rc4.py" Total time for all tests: 1.9 seconds
This patch needs a lot of work.
comment:3 Changed 3 years ago by sg.sourav
Attaching a modified patch which passed all doctests successfully. Also added some sanity checks for types of inputs.
Apply rc4_mod1.patch directly (not over rc4.patch).
sourav@ssg:~/sage4.5$ ./sage -t -long devel/sage-main/sage/crypto/rc4.py sage -t -long "devel/sage-main/sage/crypto/rc4.py" [6.7 s] ---------------------------------------------------------------------- All tests passed! Total time for all tests: 6.7 seconds sourav@ssg:~/sage4.5$ ./sage -t -long devel/sage-main/sage/crypto/rc4.py sage -t -long "devel/sage-main/sage/crypto/rc4.py" [6.7 s] ---------------------------------------------------------------------- All tests passed! Total time for all tests: 6.7 seconds
Changed 3 years ago by sg.sourav
-
attachment
rc4_mod1.patch
added
Modified version of rc4.patch including sanity checks (passed doctests)

A patch to incorporate an implementation of RC4 in Sage