Efficient String Algorithms for Data Security and Privacy