Implemented encrypt string function