# Day: August 8, 2021

## JavaScript: Number.EPSILON and Number.MAX_SAFE_INTEGER

EPSILON The Number.EPSILON property represents the difference between 1 and the smallest floating point number greater than 1 > Number.EPSILON == Math.pow(2, -52) true Use Number.EPSILON to test floating point number equality. x = 0.2; y = 0.3; z = 0.1; equal = (Math.abs(x – y + z) < Number.EPSILON); https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON MAX_SAFE_INTEGER & MIN_SAFE_INTEGER The MAX_SAFE_INTEGER constant has a …

## Non-cryptographic Hash Functions

See: List of non-cryptographic hash functions Pearson hashing Pearson hashing is a hash function designed for fast execution on processors with 8-bit registers. This hash function is a CBC-MAC that uses an 8-bit substitution cipher implemented via the substitution table. An 8-bit cipher has negligible cryptographic security, so the Pearson hash function is not cryptographically strong, but it is useful for implementing hash tables or as a data integrity check …

## Python: pearson_hashing.py

\$ cat pearson_hashing.py from random import shuffle example_table = list(range(0, 256)) shuffle(example_table) def hash8(message, table): hash = len(message) % 256 for c in message: #hash = table[(hash+ord(c)) % 256] print(f’for c=\'{c}\’, ord(c)={ord(c)}: {hash} ^ {ord(c)} => {hash ^ ord(c)} and table[hash ^ ord(c)] = {table[hash ^ ord(c)]}’) hash = table[hash ^ ord(c)] return hash if …

## Digital Signature Flow Diagram

Taken from: https://www.docusign.com/how-it-works/electronic-signature/digital-signature/digital-signature-faq

## Bloom Filters in Redis

Probabilistic (P11C) data structure https://github.com/guyroyse/understanding-probabilistic-data-structures/blob/master/code/bloom-filter/javascript/bloom.js https://github.com/guyroyse/understanding-probabilistic-data-structures/blob/master/slides/understanding-probabilistic-data-structures.pdf