fixing encryption to be compatible with JS and java