OS token generation classes (based on the php version of shindig)