Encrypting function, autopad generator, TODO: correct encrypting function