3 ms·
I'm curious, how did they calculate entropy? My first thought was to do something with Huffman encoding.
by foota 10y ago
I'm curious, how did they calculate entropy? My first thought was to do something with Huffman encoding.
- jasonmoo 10y agoI wrote the script in question and actually used a simple shannon entropy value. (http://codereview.stackexchange.com/questions/868/calculating-entropy-of-a-string/909#909 http://codereview.stackexchange.com/questions/868/calculatin...). It worked well enough help rule out several problem spaces.
- pavel_lishin 10y agoWould you mind posting the script? I'd love to run it against our codebase and see what it comes up with. It might be a fun thing to open source as part of a "I've inherited a project, what now?" toolkit that helps you decide what to fix.
- jasonmoo 10y agoSure. It's a simple tool but the concept could be augmented toward something like the scenario you described. https://gist.github.com/jasonmoo/06691c8fea09b62aa35235fc93ee31b6 https://gist.github.com/jasonmoo/06691c8fea09b62aa35235fc93e...
- ubernostrum 10y agoIIRC Instagram released a plugin for Bandit (the OpenStack static analyzer for Python) that does this.