Fix encryption functions

my comments are on commit bcdfc66

thank you