A Disqus alternative https://posativ.org/isso/
Go to file
Matthias Adler 43623f349b
Fix: Truncate key-length when generating identicons
Hex-digits with character count above 17 cannot be safely converted to an Integer, see [MAX_SAFE_INTEGER](https://medium.com/the-node-js-collection/javascripts-number-type-8d59199db1b6#53cd).

Therefore, when long keys (e.g. 32 characters) are passed into `generateIdenticon()`, and the modulus of 2^18 is performed, the result is 0 all the time. This means, the identicon will render as an empty svg image.

Here is a proof-of-concept (run in any modern browser):

```js
const key = '841b625dcf75413ff3ed5137a81ff1c3';
const int = parseInt(key, 16);
const hash = int % Math.pow(2, 18);
// throws, due to floating point conversion / integer overflow
console.assert(258499 === hash, "Modulus for 'hash' should be != 0");

const int2 = parseInt(key.substr(-16), 16);
const hash2 = int2 % Math.pow(2, 18);
// works as expected
console.assert(258048 === hash2, "Modulus 'hash2' should be != 0");
```

Truncating the passed in argument to a maximum of 16 characters solves the issue.

As a sidenote, the same code in Python will work correctly:

```python
key = '841b625dcf75413ff3ed5137a81ff1c3'
int = int(key, 16)
hash = int % pow(2, 18)
assert 258499 == hash
```
2017-08-06 17:06:20 +02:00
.tx add Transifex project configuration file 2014-01-06 18:21:30 +01:00
ansible Make Vagrant actually work 2015-08-25 13:32:57 +01:00
bin fix tx-push script to work with GNU mktemp 2014-04-23 10:24:29 +02:00
docs fix sphinx build 2017-07-30 23:28:51 +02:00
isso Fix: Truncate key-length when generating identicons 2017-08-06 17:06:20 +02:00
share Fixed typo in isso.conf 2017-06-11 00:05:34 +08:00
.gitignore append Github's .gitignore to .gitignore 2016-09-20 22:05:22 +02:00
.travis.yml Run travis tests with python 3.5 & python 3.6 2017-07-30 22:38:12 +02:00
apidoc.json apidoc settings 2016-06-03 14:54:21 +02:00
CHANGES.rst Back to development: 0.10.7 2016-09-22 09:16:22 +02:00
CONTRIBUTING.rst write contribute section 2013-12-02 14:26:12 +01:00
CONTRIBUTORS.txt update authors 2016-09-20 22:24:48 +02:00
LICENSE re-license to MIT 2013-09-19 18:44:40 +02:00
Makefile Skip compat module when running flakes checks. 2017-07-29 13:09:48 +00:00
MANIFEST.in symlink share/isso.conf to isso/defaults.ini and include it properly 2016-01-09 00:15:04 +01:00
README.md simplify GH readme to avoid repetition 2014-05-24 16:03:42 +02:00
setup.cfg make universal wheels 2016-01-30 13:03:11 +01:00
setup.py Back to development: 0.10.7 2016-09-22 09:16:22 +02:00
tox.ini Run travis tests with python 3.5 & python 3.6. 2017-07-15 14:04:16 +00:00
uwsgi.ini replace isso module with isso.run 2013-12-16 15:42:43 +01:00
Vagrantfile Add comments for debugging 2015-02-19 16:40:46 +01:00

Isso a commenting server similar to Disqus

Isso Ich schrei sonst is a lightweight commenting server written in Python and JavaScript. It aims to be a drop-in replacement for Disqus.

Isso in Action

See posativ.org/isso for more details.