Notice the result bytesting length remainder r equals zero. The lack
of a "next header" field means this function is not directly useable for
an IPSec implementation (copy/paste the 4 line function and add in a
"next header" field if you are making IPSec ESP).