crypto: basic crypto functions