The "private" vector E is not initialized making entries setkey() and encrypt() useless as standalone routines. (The routine crypt(), being privy to E, can (and does) initialize E for its own purposes.) Perhaps, setkey() should copy e to E since crypt() is designed to munge E.?