I'd like to get opinions on the following from the experts -- I am in the process of preparing for a cryptography course, for which I've previously used a Magma package that I wrote and would like to use SAGE.
Python has some special octal ('\ooo') and hexadecimal ('\xhh') string constructors, e.g. one can see hexadecimals in action here in SAGE: import Crypto for i in range(256): x = Crypto.Util.number.long_to_bytes(i) print "%s: %s %s [%s]" % (i, repr(x), x, len(x)) Note that repr(x) uses hexadecimal printing for strings in some, but not all, ranges of the ASCII alphabet. Thus Python strings represent the monoid \union_n {0,..,255}^n, with special constructors for the subsets of octals in \union_n {0,..7} and hexadecimals in \union_n {0,..,15}^n. What would you think of having SAGE classes for binary, octal, hexadecimal, radix64 (used by GPG) and other string monoids, which are not Python strings? Advantages: differentiated printing, clear morphisms, efficient embeddings (i.e. length n binary strings can use n + O(log(n)) rather than 256n bits), and more general string monoids (like with alphabets {"AA",..,"ZZ"}). Disadvantages: performance and introduction of non-standard Python classes. The alternative is to always embedd cryptographic strings in Python strings. In Magma I did create a Hackobj cryptographic string type (CryptTxt) for exclusive use with my cryptography package.
V := VigenereCryptosystem(8); M := Encoding(V,"ABCDEFGH");
ABCDEFGH
Type(M);
CryptTxt This was meant to overcome certain disadvantages with Magma strings, give verifiable type-checking, etc. What do you think of such classes in SAGE would be merited? Is there possibly any existing string library which provides similar features? --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---