================Codes for CDF-Zipf fitting===================
1. CDF-Zipf_parameter_estimation.nb is the executable file under the software Mathematica.

2. Input: a frequency text file. Prepare the dataset (e.g., Myspace passwords) to be fitted: create a new text file named "Myspace_frequency.txt", which is just consisted of the freqencies of the passwords, one frequency per line and with \n being the sign of a new line. 

3. Invoke the command parameterEstimation["Myspace"], but note that the file "Myspace_frequency.txt" is already put in the same directory with the working directory. 

4. Output: three parameters (i.e., KS D, Zipf C, and Zipf s), and five files: 
1) "myspace_searchList.csv" contains the parameters and KS D for each pass of golden search;
2) "myspace_CDF.pdf" is the CDF curve of Myspace passwords; 
3) "myspace_CDF_error.pdf" is the distance between the CDF curve of Myspace passwords and the fitted the CDF curve; 
4) "myspace_realCDFPlot.csv" contains the intermediate data points for plotting the CDF curve of Myspace passwords;
5) "myspace_sampleCDFPlot.csv" contains the intermediate data points for plotting the fitted the CDF curve.


Note: 
1)For 16 million dodonew passwords, it will take about one day on a common PC. 
2)It takes years of us to work the problem out. Whenever you use the full or part of this code, please refer to and appropriately mention the paper: Ding Wang, Haibo Cheng, Ping Wang, Xinyi Huang, Gaopeng Jian. Zipfs Law in Passwords. IEEE Transactions on Information Forensics and Security, 2017, 12(11): 2776-2791. 



================Zipfϴ===================

1. zipf_parameter_estimation.nbΪļ

2. ʽΪparameterEstimation["myspace"]ҪͬһļСmyspace_frequency.txtΪƵļΪвͬƵƵݼУһһ

3. ΪһԪбֱΪcsһͬһļ5ļmyspace_searchList.csvΪƽָ㷨ÿεĲӦmyspace_CDF.pdfΪCDFͼmyspace_CDF_error.pdfΪвͼCDF֮myspace_realCDFPlot.csvmyspace_sampleCDFPlot.csvΪCDFͼʱͼϴĵ㣬һļӦһߡ







