A encrypt algotitm with a key