Skip to content

Instantly share code, notes, and snippets.

@jsign
Created October 2, 2023 11:38
Show Gist options
  • Save jsign/cb633d1439050b81906a53ea3f083405 to your computer and use it in GitHub Desktop.
Save jsign/cb633d1439050b81906a53ea3f083405 to your computer and use it in GitHub Desktop.
Link: https://github.com/gballet/go-ethereum/commit/8622bdcfb7238a94bedb68c4e18dd63e7e7e373b
Result:
```
$ go test ./trie/utils -run=TestPedersenHashDistribution -count=1 -v
=== RUN TestPedersenHashDistribution
Generating...
Aggregating...
Bit 0: 8000196 (deviation from expected 0.00%)
Bit 1: 8004468 (deviation from expected 0.06%)
Bit 2: 7999496 (deviation from expected -0.01%)
Bit 3: 7999484 (deviation from expected -0.01%)
Bit 4: 7997056 (deviation from expected -0.04%)
Bit 5: 8000777 (deviation from expected 0.01%)
Bit 6: 7999270 (deviation from expected -0.01%)
Bit 7: 7999501 (deviation from expected -0.01%)
Bit 8: 8002536 (deviation from expected 0.03%)
Bit 9: 8002647 (deviation from expected 0.03%)
Bit 10: 7996945 (deviation from expected -0.04%)
Bit 11: 8000392 (deviation from expected 0.00%)
Bit 12: 8001772 (deviation from expected 0.02%)
Bit 13: 7997807 (deviation from expected -0.03%)
Bit 14: 7998221 (deviation from expected -0.02%)
Bit 15: 7999730 (deviation from expected -0.00%)
Bit 16: 7996776 (deviation from expected -0.04%)
Bit 17: 8002657 (deviation from expected 0.03%)
Bit 18: 8000393 (deviation from expected 0.00%)
Bit 19: 7998273 (deviation from expected -0.02%)
Bit 20: 8001598 (deviation from expected 0.02%)
Bit 21: 7999289 (deviation from expected -0.01%)
Bit 22: 8000847 (deviation from expected 0.01%)
Bit 23: 8000347 (deviation from expected 0.00%)
Bit 24: 8001802 (deviation from expected 0.02%)
Bit 25: 8001027 (deviation from expected 0.01%)
Bit 26: 8002150 (deviation from expected 0.03%)
Bit 27: 8000022 (deviation from expected 0.00%)
Bit 28: 7996165 (deviation from expected -0.05%)
Bit 29: 8004468 (deviation from expected 0.06%)
Bit 30: 7997304 (deviation from expected -0.03%)
Bit 31: 7997705 (deviation from expected -0.03%)
Bit 32: 7997981 (deviation from expected -0.03%)
Bit 33: 7996031 (deviation from expected -0.05%)
Bit 34: 7999338 (deviation from expected -0.01%)
Bit 35: 8002318 (deviation from expected 0.03%)
Bit 36: 7999940 (deviation from expected -0.00%)
Bit 37: 7996453 (deviation from expected -0.04%)
Bit 38: 8000973 (deviation from expected 0.01%)
Bit 39: 8001848 (deviation from expected 0.02%)
Bit 40: 7998745 (deviation from expected -0.02%)
Bit 41: 8001556 (deviation from expected 0.02%)
Bit 42: 8003700 (deviation from expected 0.05%)
Bit 43: 7997896 (deviation from expected -0.03%)
Bit 44: 8001605 (deviation from expected 0.02%)
Bit 45: 8000640 (deviation from expected 0.01%)
Bit 46: 8002709 (deviation from expected 0.03%)
Bit 47: 8005146 (deviation from expected 0.06%)
Bit 48: 7997963 (deviation from expected -0.03%)
Bit 49: 8000160 (deviation from expected 0.00%)
Bit 50: 8002510 (deviation from expected 0.03%)
Bit 51: 8000244 (deviation from expected 0.00%)
Bit 52: 7998995 (deviation from expected -0.01%)
Bit 53: 7998325 (deviation from expected -0.02%)
Bit 54: 8000502 (deviation from expected 0.01%)
Bit 55: 8001787 (deviation from expected 0.02%)
Bit 56: 8002731 (deviation from expected 0.03%)
Bit 57: 8002263 (deviation from expected 0.03%)
Bit 58: 7997248 (deviation from expected -0.03%)
Bit 59: 7998885 (deviation from expected -0.01%)
Bit 60: 8001534 (deviation from expected 0.02%)
Bit 61: 8004770 (deviation from expected 0.06%)
Bit 62: 8000389 (deviation from expected 0.00%)
Bit 63: 7998917 (deviation from expected -0.01%)
Bit 64: 7996562 (deviation from expected -0.04%)
Bit 65: 8001293 (deviation from expected 0.02%)
Bit 66: 7998592 (deviation from expected -0.02%)
Bit 67: 8000326 (deviation from expected 0.00%)
Bit 68: 7998507 (deviation from expected -0.02%)
Bit 69: 8000514 (deviation from expected 0.01%)
Bit 70: 8001293 (deviation from expected 0.02%)
Bit 71: 8001241 (deviation from expected 0.02%)
Bit 72: 8000470 (deviation from expected 0.01%)
Bit 73: 8004455 (deviation from expected 0.06%)
Bit 74: 7999905 (deviation from expected -0.00%)
Bit 75: 7998167 (deviation from expected -0.02%)
Bit 76: 8002920 (deviation from expected 0.04%)
Bit 77: 7998531 (deviation from expected -0.02%)
Bit 78: 7996921 (deviation from expected -0.04%)
Bit 79: 7998267 (deviation from expected -0.02%)
Bit 80: 7999783 (deviation from expected -0.00%)
Bit 81: 8002818 (deviation from expected 0.04%)
Bit 82: 7998725 (deviation from expected -0.02%)
Bit 83: 7997707 (deviation from expected -0.03%)
Bit 84: 7996068 (deviation from expected -0.05%)
Bit 85: 7999307 (deviation from expected -0.01%)
Bit 86: 8000191 (deviation from expected 0.00%)
Bit 87: 7996810 (deviation from expected -0.04%)
Bit 88: 8003155 (deviation from expected 0.04%)
Bit 89: 7998000 (deviation from expected -0.03%)
Bit 90: 8000895 (deviation from expected 0.01%)
Bit 91: 7998563 (deviation from expected -0.02%)
Bit 92: 8001596 (deviation from expected 0.02%)
Bit 93: 8003122 (deviation from expected 0.04%)
Bit 94: 8001450 (deviation from expected 0.02%)
Bit 95: 7998793 (deviation from expected -0.02%)
Bit 96: 7999393 (deviation from expected -0.01%)
Bit 97: 8001868 (deviation from expected 0.02%)
Bit 98: 7999463 (deviation from expected -0.01%)
Bit 99: 7998241 (deviation from expected -0.02%)
Bit 100: 7997563 (deviation from expected -0.03%)
Bit 101: 8000878 (deviation from expected 0.01%)
Bit 102: 7998170 (deviation from expected -0.02%)
Bit 103: 8003082 (deviation from expected 0.04%)
Bit 104: 7999787 (deviation from expected -0.00%)
Bit 105: 8000349 (deviation from expected 0.00%)
Bit 106: 8000252 (deviation from expected 0.00%)
Bit 107: 8003649 (deviation from expected 0.05%)
Bit 108: 7997859 (deviation from expected -0.03%)
Bit 109: 8001714 (deviation from expected 0.02%)
Bit 110: 7997989 (deviation from expected -0.03%)
Bit 111: 8002181 (deviation from expected 0.03%)
Bit 112: 8001799 (deviation from expected 0.02%)
Bit 113: 8000319 (deviation from expected 0.00%)
Bit 114: 8001429 (deviation from expected 0.02%)
Bit 115: 7997467 (deviation from expected -0.03%)
Bit 116: 7998166 (deviation from expected -0.02%)
Bit 117: 7995861 (deviation from expected -0.05%)
Bit 118: 7998732 (deviation from expected -0.02%)
Bit 119: 8001005 (deviation from expected 0.01%)
Bit 120: 7996931 (deviation from expected -0.04%)
Bit 121: 7999728 (deviation from expected -0.00%)
Bit 122: 7998944 (deviation from expected -0.01%)
Bit 123: 7998435 (deviation from expected -0.02%)
Bit 124: 8000089 (deviation from expected 0.00%)
Bit 125: 8003655 (deviation from expected 0.05%)
Bit 126: 8001637 (deviation from expected 0.02%)
Bit 127: 8000696 (deviation from expected 0.01%)
Bit 128: 7998232 (deviation from expected -0.02%)
Bit 129: 7999722 (deviation from expected -0.00%)
Bit 130: 7996815 (deviation from expected -0.04%)
Bit 131: 8001081 (deviation from expected 0.01%)
Bit 132: 7998474 (deviation from expected -0.02%)
Bit 133: 7999879 (deviation from expected -0.00%)
Bit 134: 7999916 (deviation from expected -0.00%)
Bit 135: 7999399 (deviation from expected -0.01%)
Bit 136: 8000462 (deviation from expected 0.01%)
Bit 137: 8002059 (deviation from expected 0.03%)
Bit 138: 7998544 (deviation from expected -0.02%)
Bit 139: 7997510 (deviation from expected -0.03%)
Bit 140: 7998480 (deviation from expected -0.02%)
Bit 141: 7998177 (deviation from expected -0.02%)
Bit 142: 8000744 (deviation from expected 0.01%)
Bit 143: 8002444 (deviation from expected 0.03%)
Bit 144: 7997515 (deviation from expected -0.03%)
Bit 145: 8001898 (deviation from expected 0.02%)
Bit 146: 8000630 (deviation from expected 0.01%)
Bit 147: 8000771 (deviation from expected 0.01%)
Bit 148: 8000680 (deviation from expected 0.01%)
Bit 149: 8003765 (deviation from expected 0.05%)
Bit 150: 7999883 (deviation from expected -0.00%)
Bit 151: 8001668 (deviation from expected 0.02%)
Bit 152: 7998858 (deviation from expected -0.01%)
Bit 153: 8001177 (deviation from expected 0.01%)
Bit 154: 8000718 (deviation from expected 0.01%)
Bit 155: 8000293 (deviation from expected 0.00%)
Bit 156: 8002104 (deviation from expected 0.03%)
Bit 157: 7999050 (deviation from expected -0.01%)
Bit 158: 7999694 (deviation from expected -0.00%)
Bit 159: 7999304 (deviation from expected -0.01%)
Bit 160: 7998803 (deviation from expected -0.01%)
Bit 161: 8001525 (deviation from expected 0.02%)
Bit 162: 7999509 (deviation from expected -0.01%)
Bit 163: 7999888 (deviation from expected -0.00%)
Bit 164: 7999703 (deviation from expected -0.00%)
Bit 165: 7999659 (deviation from expected -0.00%)
Bit 166: 7998457 (deviation from expected -0.02%)
Bit 167: 7998235 (deviation from expected -0.02%)
Bit 168: 7997479 (deviation from expected -0.03%)
Bit 169: 7999880 (deviation from expected -0.00%)
Bit 170: 7999002 (deviation from expected -0.01%)
Bit 171: 7999712 (deviation from expected -0.00%)
Bit 172: 8004061 (deviation from expected 0.05%)
Bit 173: 8000079 (deviation from expected 0.00%)
Bit 174: 7998923 (deviation from expected -0.01%)
Bit 175: 8000149 (deviation from expected 0.00%)
Bit 176: 7996086 (deviation from expected -0.05%)
Bit 177: 8002346 (deviation from expected 0.03%)
Bit 178: 8002168 (deviation from expected 0.03%)
Bit 179: 8003259 (deviation from expected 0.04%)
Bit 180: 7999323 (deviation from expected -0.01%)
Bit 181: 8002099 (deviation from expected 0.03%)
Bit 182: 7998689 (deviation from expected -0.02%)
Bit 183: 7999981 (deviation from expected -0.00%)
Bit 184: 8002587 (deviation from expected 0.03%)
Bit 185: 8002054 (deviation from expected 0.03%)
Bit 186: 7999169 (deviation from expected -0.01%)
Bit 187: 8001281 (deviation from expected 0.02%)
Bit 188: 8001045 (deviation from expected 0.01%)
Bit 189: 8000236 (deviation from expected 0.00%)
Bit 190: 8000180 (deviation from expected 0.00%)
Bit 191: 8001665 (deviation from expected 0.02%)
Bit 192: 8003357 (deviation from expected 0.04%)
Bit 193: 8001988 (deviation from expected 0.02%)
Bit 194: 7999414 (deviation from expected -0.01%)
Bit 195: 8000670 (deviation from expected 0.01%)
Bit 196: 7999789 (deviation from expected -0.00%)
Bit 197: 8000921 (deviation from expected 0.01%)
Bit 198: 7999108 (deviation from expected -0.01%)
Bit 199: 7996570 (deviation from expected -0.04%)
Bit 200: 7998658 (deviation from expected -0.02%)
Bit 201: 7998407 (deviation from expected -0.02%)
Bit 202: 7998068 (deviation from expected -0.02%)
Bit 203: 7998113 (deviation from expected -0.02%)
Bit 204: 7999559 (deviation from expected -0.01%)
Bit 205: 8002448 (deviation from expected 0.03%)
Bit 206: 8001984 (deviation from expected 0.02%)
Bit 207: 7999135 (deviation from expected -0.01%)
Bit 208: 8000604 (deviation from expected 0.01%)
Bit 209: 8003206 (deviation from expected 0.04%)
Bit 210: 8002676 (deviation from expected 0.03%)
Bit 211: 8001063 (deviation from expected 0.01%)
Bit 212: 7999154 (deviation from expected -0.01%)
Bit 213: 8000638 (deviation from expected 0.01%)
Bit 214: 7999531 (deviation from expected -0.01%)
Bit 215: 8000984 (deviation from expected 0.01%)
Bit 216: 8003103 (deviation from expected 0.04%)
Bit 217: 7999603 (deviation from expected -0.00%)
Bit 218: 8002555 (deviation from expected 0.03%)
Bit 219: 8000416 (deviation from expected 0.01%)
Bit 220: 7997755 (deviation from expected -0.03%)
Bit 221: 8002944 (deviation from expected 0.04%)
Bit 222: 8001128 (deviation from expected 0.01%)
Bit 223: 8003893 (deviation from expected 0.05%)
Bit 224: 7998267 (deviation from expected -0.02%)
Bit 225: 7997451 (deviation from expected -0.03%)
Bit 226: 7999956 (deviation from expected -0.00%)
Bit 227: 7996463 (deviation from expected -0.04%)
Bit 228: 7997939 (deviation from expected -0.03%)
Bit 229: 7994959 (deviation from expected -0.06%)
Bit 230: 8000077 (deviation from expected 0.00%)
Bit 231: 8000019 (deviation from expected 0.00%)
Bit 232: 8000662 (deviation from expected 0.01%)
Bit 233: 7998724 (deviation from expected -0.02%)
Bit 234: 8002198 (deviation from expected 0.03%)
Bit 235: 8000971 (deviation from expected 0.01%)
Bit 236: 8004380 (deviation from expected 0.05%)
Bit 237: 8000442 (deviation from expected 0.01%)
Bit 238: 8000428 (deviation from expected 0.01%)
Bit 239: 7998763 (deviation from expected -0.02%)
Bit 240: 7996309 (deviation from expected -0.05%)
Bit 241: 8001309 (deviation from expected 0.02%)
Bit 242: 7997646 (deviation from expected -0.03%)
Bit 243: 7998181 (deviation from expected -0.02%)
Bit 244: 7994335 (deviation from expected -0.07%)
Bit 245: 7993812 (deviation from expected -0.08%)
Bit 246: 7996594 (deviation from expected -0.04%)
Bit 247: 7993566 (deviation from expected -0.08%)
```
TL;DR: Generate 16 million random tree keys, and count the per-bit frequency to see if there're bias (and compare to expected avg).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment