Shevek wrote:
It's pretty, but I don't understand it.
This is the original aol record (210 chars, new lines are inserted by me):
v=spf1 ip4:152.163.225.0/24 ip4:205.188.139.0/24 ip4:205.188.144.0/24
ip4:205.188.156.0/24 ip4:205.188.157.0/24 ip4:205.188.159.0/24
ip4:64.12.136.0/24 ip4:64.12.137.0/24 ip4:64.12.138.0/24 ptr:mx.aol.com ?all
First i contract the consecutive 'ip4' elements into one element. It
does not change the semantic. I choose '|' as the ip list separator:
v=spf1 ip4:152.163.225.0/24|205.188.139.0/24|205.188.144.0/24|
205.188.156.0/24|205.188.157.0/24|205.188.159.0/24|
64.12.136.0/24|64.12.137.0/24|64.12.138.0/24 ptr:mx.aol.com ?all
I insert '/24' after 'ip4' as a default network mask. If there is a
missing network mask on the string than the default mask need to use.
Bacause of the default mask i can delete all masks equal to the default
mask:
v=spf1 ip4/24:152.163.225.0|205.188.139.0|205.188.144.0|
205.188.156.0|205.188.157.0|205.188.159.0|
64.12.136.0|64.12.137.0|64.12.138.0 ptr:mx.aol.com ?all
The zero bytes at the end of an ip address is not hold any information,
so it can be deleted:
v=spf1 ip4/24:152.163.225|205.188.139|205.188.144|
205.188.156|205.188.157|205.188.159|
64.12.136|64.12.137|64.12.138 ptr:mx.aol.com ?all
Simple numeric pattern can be used to express alternatives and/or
numeric ranges in a byte position. The '-' used for numeric interval,
and the ',' as the list separator of the alternatives.For example:
64.12.136|64.12.137|64.12.138 can be rewrited as
64.12.136-138 or
64.12.136,137,138
The result is:
v=spf1 ip4/24:152.163.225|205.188.139,144,156-157,159|64.12.136-138
ptr:mx.aol.com ?all
The default mask does not needed in this case but i leave it in the
result because it just take 3 chars and it can demonstrate an idea.
So the result is 89 chars instead of 210. If the upper limit is 127
chars than this compression is significant.
z2