moved around crypto functions