function for selecting probable keylength