We consider algebras with basis numerated by elements of a group $G.$ We fix a function $f$ from $Gtimes G$ to a ground field and give a multiplication of the algebra which depends on $f$. We study the basic properties of such algebras. In particular, we find a condition on $f$ under which the corresponding algebra is a Leibniz algebra. Moreover, for a given subgroup $hat G$ of $G$ we define a $hat G$-periodic algebra, which corresponds to a $hat G$-periodic function $f,$ we establish a criterion for the right nilpotency of a $hat G$-periodic algebra. In addition, for $G=mathbb Z$ we describe all $2mathbb Z$- and $3mathbb Z$-periodic algebras. Some properties of $nmathbb Z$-periodic algebras are obtained.