improve crypt funct