Kasiski test implementation