From d1d76a2dbae8b8c4ee61fbcbbbf4b326c3dce85d Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Tue, 29 Mar 2022 20:37:56 +0200 Subject: [PATCH] Add codes for MD5(IP) distribution --- codes/md5-dist/.gitignore | 1 + codes/md5-dist/Cargo.lock | 70 +++++++ codes/md5-dist/Cargo.toml | 9 + codes/md5-dist/countmap.txt | 256 +++++++++++++++++++++++++ codes/md5-dist/src/main.rs | 28 +++ codes/md5-dist/src/main.rs_all_ips_bak | 21 ++ codes/md5dist-plot/.gitignore | 1 + codes/md5dist-plot/countmap.txt | 256 +++++++++++++++++++++++++ codes/md5dist-plot/dist.png | Bin 0 -> 18045 bytes codes/md5dist-plot/dist.py | 46 +++++ codes/md5dist-plot/requirements.txt | 1 + 11 files changed, 689 insertions(+) create mode 100644 codes/md5-dist/.gitignore create mode 100644 codes/md5-dist/Cargo.lock create mode 100644 codes/md5-dist/Cargo.toml create mode 100644 codes/md5-dist/countmap.txt create mode 100644 codes/md5-dist/src/main.rs create mode 100644 codes/md5-dist/src/main.rs_all_ips_bak create mode 100644 codes/md5dist-plot/.gitignore create mode 100644 codes/md5dist-plot/countmap.txt create mode 100644 codes/md5dist-plot/dist.png create mode 100755 codes/md5dist-plot/dist.py create mode 100644 codes/md5dist-plot/requirements.txt diff --git a/codes/md5-dist/.gitignore b/codes/md5-dist/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/codes/md5-dist/.gitignore @@ -0,0 +1 @@ +/target diff --git a/codes/md5-dist/Cargo.lock b/codes/md5-dist/Cargo.lock new file mode 100644 index 00000000..cbc391be --- /dev/null +++ b/codes/md5-dist/Cargo.lock @@ -0,0 +1,70 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + +[[package]] +name = "crypto-common" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "md-5" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658646b21e0b72f7866c7038ab086d3d5e1cd6271f060fd37defb241949d0582" +dependencies = [ + "digest", +] + +[[package]] +name = "md5-dist" +version = "0.1.0" +dependencies = [ + "md-5", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/codes/md5-dist/Cargo.toml b/codes/md5-dist/Cargo.toml new file mode 100644 index 00000000..b003966e --- /dev/null +++ b/codes/md5-dist/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "md5-dist" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +md-5 = "0.10.1" diff --git a/codes/md5-dist/countmap.txt b/codes/md5-dist/countmap.txt new file mode 100644 index 00000000..b78b1120 --- /dev/null +++ b/codes/md5-dist/countmap.txt @@ -0,0 +1,256 @@ +00: 16775418 +01: 16784471 +02: 16782205 +03: 16777355 +04: 16781626 +05: 16775143 +06: 16773409 +07: 16783120 +08: 16780738 +09: 16776141 +0a: 16780852 +0b: 16779188 +0c: 16769188 +0d: 16778425 +0e: 16782101 +0f: 16773329 +10: 16775877 +11: 16773625 +12: 16782333 +13: 16779312 +14: 16778791 +15: 16772556 +16: 16776048 +17: 16776984 +18: 16774961 +19: 16772505 +1a: 16772749 +1b: 16784280 +1c: 16776018 +1d: 16780113 +1e: 16775174 +1f: 16775598 +20: 16775411 +21: 16775281 +22: 16781508 +23: 16782609 +24: 16774699 +25: 16774058 +26: 16780100 +27: 16778931 +28: 16785083 +29: 16774624 +2a: 16769029 +2b: 16769432 +2c: 16779676 +2d: 16777681 +2e: 16775010 +2f: 16779064 +30: 16770980 +31: 16775936 +32: 16780708 +33: 16774265 +34: 16775831 +35: 16781156 +36: 16778539 +37: 16774660 +38: 16775533 +39: 16774402 +3a: 16775884 +3b: 16776471 +3c: 16782541 +3d: 16770076 +3e: 16784726 +3f: 16782120 +40: 16783936 +41: 16776491 +42: 16769981 +43: 16779010 +44: 16780694 +45: 16774333 +46: 16771538 +47: 16773219 +48: 16781715 +49: 16777370 +4a: 16778144 +4b: 16778755 +4c: 16773066 +4d: 16775350 +4e: 16779655 +4f: 16779264 +50: 16772744 +51: 16776626 +52: 16779230 +53: 16783053 +54: 16780042 +55: 16778545 +56: 16778630 +57: 16779584 +58: 16786895 +59: 16781375 +5a: 16778843 +5b: 16775092 +5c: 16779425 +5d: 16772850 +5e: 16783451 +5f: 16779147 +60: 16786462 +61: 16777634 +62: 16777892 +63: 16769887 +64: 16774137 +65: 16778514 +66: 16778853 +67: 16771229 +68: 16785638 +69: 16779226 +6a: 16773444 +6b: 16782595 +6c: 16781253 +6d: 16776543 +6e: 16775492 +6f: 16785094 +70: 16774113 +71: 16772065 +72: 16775977 +73: 16778131 +74: 16767229 +75: 16779234 +76: 16778190 +77: 16778508 +78: 16774681 +79: 16780882 +7a: 16772074 +7b: 16774136 +7c: 16778663 +7d: 16769883 +7e: 16777787 +7f: 16777442 +80: 16770867 +81: 16780600 +82: 16781874 +83: 16783000 +84: 16780492 +85: 16777010 +86: 16771862 +87: 16771841 +88: 16775756 +89: 16780580 +8a: 16788426 +8b: 16785673 +8c: 16776136 +8d: 16774636 +8e: 16774131 +8f: 16776528 +90: 16778622 +91: 16779850 +92: 16774853 +93: 16786692 +94: 16785159 +95: 16786085 +96: 16779068 +97: 16778402 +98: 16770266 +99: 16775790 +9a: 16772544 +9b: 16780165 +9c: 16771988 +9d: 16774073 +9e: 16775503 +9f: 16775211 +a0: 16778822 +a1: 16770790 +a2: 16772720 +a3: 16782384 +a4: 16777523 +a5: 16776009 +a6: 16776404 +a7: 16780201 +a8: 16786679 +a9: 16782734 +aa: 16781532 +ab: 16774293 +ac: 16778811 +ad: 16773288 +ae: 16777402 +af: 16780705 +b0: 16771373 +b1: 16772570 +b2: 16776390 +b3: 16769489 +b4: 16780751 +b5: 16780086 +b6: 16773617 +b7: 16779288 +b8: 16772726 +b9: 16773539 +ba: 16772098 +bb: 16771896 +bc: 16770747 +bd: 16779381 +be: 16776967 +bf: 16780660 +c0: 16774753 +c1: 16777763 +c2: 16778860 +c3: 16774258 +c4: 16769455 +c5: 16781673 +c6: 16777371 +c7: 16779255 +c8: 16780965 +c9: 16774925 +ca: 16773390 +cb: 16766367 +cc: 16779007 +cd: 16774152 +ce: 16779393 +cf: 16775566 +d0: 16777541 +d1: 16775665 +d2: 16767130 +d3: 16777702 +d4: 16774089 +d5: 16778767 +d6: 16777777 +d7: 16778717 +d8: 16774044 +d9: 16769863 +da: 16775188 +db: 16780781 +dc: 16780489 +dd: 16774530 +de: 16785037 +df: 16780348 +e0: 16781971 +e1: 16785674 +e2: 16775852 +e3: 16772744 +e4: 16777170 +e5: 16783475 +e6: 16778994 +e7: 16775288 +e8: 16771541 +e9: 16776289 +ea: 16778383 +eb: 16780526 +ec: 16780465 +ed: 16778746 +ee: 16770117 +ef: 16775146 +f0: 16775217 +f1: 16777215 +f2: 16776901 +f3: 16779481 +f4: 16778597 +f5: 16776573 +f6: 16773471 +f7: 16778843 +f8: 16775212 +f9: 16776428 +fa: 16771828 +fb: 16771978 +fc: 16781247 +fd: 16778215 +fe: 16778741 +ff: 16777991 diff --git a/codes/md5-dist/src/main.rs b/codes/md5-dist/src/main.rs new file mode 100644 index 00000000..987c91e3 --- /dev/null +++ b/codes/md5-dist/src/main.rs @@ -0,0 +1,28 @@ +use md5::{Digest, Md5}; +use std::{ + collections::HashMap, + fs::File, + io::{BufWriter, Write}, +}; + +fn main() -> std::io::Result<()> { + let mut map = HashMap::new(); + for i in 0u32..=std::u32::MAX { + let mut hasher = Md5::new(); + hasher.update(i.to_le_bytes()); + let out = hasher.finalize(); + let key = out[out.len() - 1]; + *map.entry(key).or_insert(0) += 1; + if i % 100_000 == 0 { + println!("{i}"); + } + } + let mut count_list = map.into_iter().collect::>(); + count_list.sort(); + let file = File::create("./countmap.txt")?; + let mut writer = BufWriter::new(file); + for (k, v) in count_list { + writeln!(writer, "{:02x}: {}", k, v)?; + } + Ok(()) +} diff --git a/codes/md5-dist/src/main.rs_all_ips_bak b/codes/md5-dist/src/main.rs_all_ips_bak new file mode 100644 index 00000000..cee15e4f --- /dev/null +++ b/codes/md5-dist/src/main.rs_all_ips_bak @@ -0,0 +1,21 @@ +use md5::{Digest, Md5}; +use std::{ + fs::File, + io::{BufWriter, Write}, +}; + +fn main() -> std::io::Result<()> { + let file = File::create("./hashes.txt")?; + let mut writer = BufWriter::new(file); + for i in 0u32..=std::u32::MAX { + let mut hasher = Md5::new(); + // let mut out = [0; 16]; + hasher.update(i.to_le_bytes()); + let out = hasher.finalize(); + writeln!(writer, "{:02x}", out[out.len() - 1])?; + if i % 100_000 == 0 { + println!("{i}"); + } + } + Ok(()) +} diff --git a/codes/md5dist-plot/.gitignore b/codes/md5dist-plot/.gitignore new file mode 100644 index 00000000..1d17dae1 --- /dev/null +++ b/codes/md5dist-plot/.gitignore @@ -0,0 +1 @@ +.venv diff --git a/codes/md5dist-plot/countmap.txt b/codes/md5dist-plot/countmap.txt new file mode 100644 index 00000000..b78b1120 --- /dev/null +++ b/codes/md5dist-plot/countmap.txt @@ -0,0 +1,256 @@ +00: 16775418 +01: 16784471 +02: 16782205 +03: 16777355 +04: 16781626 +05: 16775143 +06: 16773409 +07: 16783120 +08: 16780738 +09: 16776141 +0a: 16780852 +0b: 16779188 +0c: 16769188 +0d: 16778425 +0e: 16782101 +0f: 16773329 +10: 16775877 +11: 16773625 +12: 16782333 +13: 16779312 +14: 16778791 +15: 16772556 +16: 16776048 +17: 16776984 +18: 16774961 +19: 16772505 +1a: 16772749 +1b: 16784280 +1c: 16776018 +1d: 16780113 +1e: 16775174 +1f: 16775598 +20: 16775411 +21: 16775281 +22: 16781508 +23: 16782609 +24: 16774699 +25: 16774058 +26: 16780100 +27: 16778931 +28: 16785083 +29: 16774624 +2a: 16769029 +2b: 16769432 +2c: 16779676 +2d: 16777681 +2e: 16775010 +2f: 16779064 +30: 16770980 +31: 16775936 +32: 16780708 +33: 16774265 +34: 16775831 +35: 16781156 +36: 16778539 +37: 16774660 +38: 16775533 +39: 16774402 +3a: 16775884 +3b: 16776471 +3c: 16782541 +3d: 16770076 +3e: 16784726 +3f: 16782120 +40: 16783936 +41: 16776491 +42: 16769981 +43: 16779010 +44: 16780694 +45: 16774333 +46: 16771538 +47: 16773219 +48: 16781715 +49: 16777370 +4a: 16778144 +4b: 16778755 +4c: 16773066 +4d: 16775350 +4e: 16779655 +4f: 16779264 +50: 16772744 +51: 16776626 +52: 16779230 +53: 16783053 +54: 16780042 +55: 16778545 +56: 16778630 +57: 16779584 +58: 16786895 +59: 16781375 +5a: 16778843 +5b: 16775092 +5c: 16779425 +5d: 16772850 +5e: 16783451 +5f: 16779147 +60: 16786462 +61: 16777634 +62: 16777892 +63: 16769887 +64: 16774137 +65: 16778514 +66: 16778853 +67: 16771229 +68: 16785638 +69: 16779226 +6a: 16773444 +6b: 16782595 +6c: 16781253 +6d: 16776543 +6e: 16775492 +6f: 16785094 +70: 16774113 +71: 16772065 +72: 16775977 +73: 16778131 +74: 16767229 +75: 16779234 +76: 16778190 +77: 16778508 +78: 16774681 +79: 16780882 +7a: 16772074 +7b: 16774136 +7c: 16778663 +7d: 16769883 +7e: 16777787 +7f: 16777442 +80: 16770867 +81: 16780600 +82: 16781874 +83: 16783000 +84: 16780492 +85: 16777010 +86: 16771862 +87: 16771841 +88: 16775756 +89: 16780580 +8a: 16788426 +8b: 16785673 +8c: 16776136 +8d: 16774636 +8e: 16774131 +8f: 16776528 +90: 16778622 +91: 16779850 +92: 16774853 +93: 16786692 +94: 16785159 +95: 16786085 +96: 16779068 +97: 16778402 +98: 16770266 +99: 16775790 +9a: 16772544 +9b: 16780165 +9c: 16771988 +9d: 16774073 +9e: 16775503 +9f: 16775211 +a0: 16778822 +a1: 16770790 +a2: 16772720 +a3: 16782384 +a4: 16777523 +a5: 16776009 +a6: 16776404 +a7: 16780201 +a8: 16786679 +a9: 16782734 +aa: 16781532 +ab: 16774293 +ac: 16778811 +ad: 16773288 +ae: 16777402 +af: 16780705 +b0: 16771373 +b1: 16772570 +b2: 16776390 +b3: 16769489 +b4: 16780751 +b5: 16780086 +b6: 16773617 +b7: 16779288 +b8: 16772726 +b9: 16773539 +ba: 16772098 +bb: 16771896 +bc: 16770747 +bd: 16779381 +be: 16776967 +bf: 16780660 +c0: 16774753 +c1: 16777763 +c2: 16778860 +c3: 16774258 +c4: 16769455 +c5: 16781673 +c6: 16777371 +c7: 16779255 +c8: 16780965 +c9: 16774925 +ca: 16773390 +cb: 16766367 +cc: 16779007 +cd: 16774152 +ce: 16779393 +cf: 16775566 +d0: 16777541 +d1: 16775665 +d2: 16767130 +d3: 16777702 +d4: 16774089 +d5: 16778767 +d6: 16777777 +d7: 16778717 +d8: 16774044 +d9: 16769863 +da: 16775188 +db: 16780781 +dc: 16780489 +dd: 16774530 +de: 16785037 +df: 16780348 +e0: 16781971 +e1: 16785674 +e2: 16775852 +e3: 16772744 +e4: 16777170 +e5: 16783475 +e6: 16778994 +e7: 16775288 +e8: 16771541 +e9: 16776289 +ea: 16778383 +eb: 16780526 +ec: 16780465 +ed: 16778746 +ee: 16770117 +ef: 16775146 +f0: 16775217 +f1: 16777215 +f2: 16776901 +f3: 16779481 +f4: 16778597 +f5: 16776573 +f6: 16773471 +f7: 16778843 +f8: 16775212 +f9: 16776428 +fa: 16771828 +fb: 16771978 +fc: 16781247 +fd: 16778215 +fe: 16778741 +ff: 16777991 diff --git a/codes/md5dist-plot/dist.png b/codes/md5dist-plot/dist.png new file mode 100644 index 0000000000000000000000000000000000000000..87ac864ef615ee3562ea47a2266c51986ea296dd GIT binary patch literal 18045 zcmdUX2T)b%y5&(@ZN<>tii#2pfJ&4kf&>#HAd*3{h-3*8L_oj}N~@U20un@W6a*w= zBOn@N4x8`j@K=&?!Reb z?_gnTBg7}dC&07c+|kj_L7bo8`hWfcpRK(af1A;C0p4Vj-34t23T3+y`C1bv9cw|M z$c)IHJFR{zbiCU|Pt$}(pAvo875C#GM|9a!at;j__Zhsra9&K&V&s)iN1fl%($JTj z4V63!8GEY&RCKE)Gmkb_bBI*f8>I_6lyB`iudJ^8*28n5kLFr+kn7LqjV~^k1BG)*PyRF+SOv zqcq*7ZVe+nEG6Lm&!d^Cs#PVcgB60T7j1f znbq>lIQbvPCp}_0NljR-oH@aucb{Uu20!uh_4QpHn3zZ@E9w7$rR}w`zmJb9R~5ISsDm}f)JFw=i^1yWu4AvuXQ#^9Mn8G6rF`|NeE%_8L1A{g znRa`c(eGuCSrXM^FKJxfx^Bak`Yh{CVULwt?kiK}mW?rrcblhWl`sFqHx|?yr*f#Y zyqsH7vS4lEdK=ahMtw?U-AtWyDsE@wue%KL3JQ(EB38mz-~Xr>CZQefNz2j6x^6MK zT<1wsQ<7et72&0S`&6=5)F$-InKMlZ8i~Ku&Cj(O8aBG7$lk~-pwpHstE#wX_S(G1 z&t`|D>Dq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}o??7$gafL|Y{f%?u6-;;v+w*mQpQsO4?`BDPGKhr2do zO$E+rV(e{BH7v@ndLzuYruW+4P?&0;uG!ycdul`i*LK*Th|vVrH=m-SBE$!R=BSsH z_uO0sTgGRqK4CA0rnzv1Le!`TGW3FjrJ}V}i@X5WuMV73xbT^Qpjxu9R#3oR{sUff zW`1hL;)v^Qh8;iud_Zp7^0B{F5hhVlQL?1St(Ed78{-cPXaG<>l8P(2ypWIP@KBPA zC(F>tDX-T(a5Q2qf@ySAIon1bxbdX78I%z0p_sGPefV&J7*~ldIj@b)LJY*m=s!h# z*~TgnNA`p;CjX`14eM_p=~e)#D0TjjrbmzA8vnqH(GzM8n5SNTeFij*NFIyVKPZk^ z_Ui^=dkYI0UQE6AstvtoPM-$I6@VYDI#jHY>}?HVrXzxo-`4x!OojJe5wfCOMt0n8 z!*9%qVZg%DQZPwYV{ay`spgDlbynkfRs+vpymsx?ecW(gf~^63c*jwqM97yiy-$W|VYcKZ7jG_FDHuL@xhDuOi4;EzIu=ftS!de_^AB*UT}*ssY7 zXza`5!!fE|3t>|39TMc9#j9^&;BKj-P(I0?cqxS^4QO zyyay5(R~RmrW$7QYAo|y#d(?1rUQ$D$g=pAQqgSKxAw`cH-Of9tW3{!XEi){X2^N( z8dD)m!3ALCx4T@1of9mDyMH&l&CUvgM-Ad!7}G>V!#|hJWAi2khfVPOcl#jltLcZQ z2iAKCT)X{Hv#m{D5YzFr`J)vAM#x%DPR=sym^71z376D!R6@U*maf|=#|uG*V_^6% zD=#lcF()25;xF}m_Uuy{b6NK76HLYz7hl){Bb<`y|Bm+m4gRMi|AGbo?SG&$NM9GY Xi{C|4NFxkbo+2l6>0HX0E5H2@wH_OX literal 0 HcmV?d00001 diff --git a/codes/md5dist-plot/dist.py b/codes/md5dist-plot/dist.py new file mode 100755 index 00000000..2f48e45b --- /dev/null +++ b/codes/md5dist-plot/dist.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 + +from collections import defaultdict + +import matplotlib.pyplot as plt + +def main(): + with open('./countmap.txt', 'r') as f: + countmap = {} + keys = [] + values = [] + for line in f: + split = line.split(': ') + prefix = split[0].strip() + key = int(prefix, 16) + value = int(split[1].strip()) + countmap[key] = value + keys.append(key) + values.append(value) + + plt.bar(keys, values) + plt.title('Distribution of lowest byte of hashed IP addresses') + plt.savefig('dist.png') + plt.show() + + # with open('./hashes.txt', 'r') as f: + # # countmap = defaultdict(lambda: 0) + # ints = set() + # data = [] + # for line in f.readlines(): + # # line = line.strip() + # # prefix = line[len(line) - 2:] + # prefix = line.strip() + # ints.add(prefix) + # # countmap[prefix] = countmap[prefix] + 1 + # data.append(int(prefix, 16)) + + # plt.hist(data, bins=len(ints)) + # plt.title('Distribution of lowest byte of hashed IP addresses') + # plt.savefig('dist.png') + # plt.show() + # # print(countmap) + + +if __name__ == '__main__': + main() diff --git a/codes/md5dist-plot/requirements.txt b/codes/md5dist-plot/requirements.txt new file mode 100644 index 00000000..fec370b7 --- /dev/null +++ b/codes/md5dist-plot/requirements.txt @@ -0,0 +1 @@ +matplotlib==3.5.1