added function for encrypting