I'm trying to optimize for code size, so I'm looking for shorter alternatives. I've done some research and believe this should work well enough:
encrypt(key, password): salt = random64Bits() hash = keccak256(salt + password) enc =  for i from 0 til 32: enc[i] = (key[i] + hash[i]) % 16 return enc + salt
I.e., the modulo-16 addition of each byte of the password and the hash of (key + a random salt). It can be implemented in about 10 lines, so, if there isn't anything inherently wrong, I'd certainly favor it.
Is this encryption scheme secure? Are there equally simpler alternatives properly standardized?
Note that I already require Keccak for other functionality, so the Keccak code base doesn't count to the amount of code required.