Crypt-compatible COS function/implementation - has anyone seen this code?