spf-discuss
[Top] [All Lists]

SRS: encoding with lengths instead of delimiters

2004-03-28 20:40:34
I run a forwarding MTA and after looking at SRS for a while, I became
interested in the general problem of how to encode a field of arbitrary
characters with transparency without having to escape anything.

My idea is to prefix fields with a length instead of using delimiters. For
example, ajr(_at_)example(_dot_)com could be encoded with a 2 byte length as 
follows:

03ajr11example.com

However this isn't transparent for fields starting with a number. Adding
a length delimiter eg, 3.ajr11.example.com would cure that (and allow
fields sizes > 99 in length) but adds too many characters.

My current approach is to convert the length to octal, and turn on the
high bit of each digit except the last to indicate there are more digits.
(Effectively, the length is coded in hex). For example:

3ajr93example.com 

where 93 is the encoding of 11. (11 --> octal 13 with 8 added
to the first digit).

The only thing I dont like about it for SRS is that it's somewhat less
readable for the user. OTOH it is transparent for any data in any order.

Any thoughts?

Alan Reider
e4ward.com




<Prev in Thread] Current Thread [Next in Thread>