Finding Minimum Gaps And Designing Key Derivation Functions