The following compares the output of several creative hash functions designed for human readability.
sha1's are merely used as arbitrary, longer, distributed input values.
| input | 1 word output | 2 word output | 3 word output |
|---|
| import collections | |
| import math | |
| import os | |
| import cv2 | |
| import numpy as np | |
| import time | |
| MAX_LINES = 4000 | |
| N_PINS = 36*8 | |
| MIN_LOOP = 20 # To avoid getting stuck in a loop |
The following compares the output of several creative hash functions designed for human readability.
sha1's are merely used as arbitrary, longer, distributed input values.
| input | 1 word output | 2 word output | 3 word output |
|---|
| #!/usr/bin/env python3 | |
| # The goal of this is to gradually balance a btrfs filesystem which contains DM-SMR drives. | |
| # Such drive are described in detail at https://www.usenix.org/node/188434 | |
| # A normal drive should be able to balance a single 1GB chunk in under 30s. | |
| # Such a stripe would normally be written directly to the shingled blocks, but in the case | |
| # it was cached, it would take roughly 100s to clean. | |
| # So our heuristic here is: |
| class BigForeignKey(models.ForeignKey): | |
| def db_type(self, connection): | |
| """ Adds support for foreign keys to big integers as primary keys. | |
| """ | |
| rel_field = self.rel.get_related_field() | |
| if (isinstance(rel_field, BigAutoField) or | |
| (not connection.features.related_fields_match_type and | |
| isinstance(rel_field, (BigIntegerField, )))): |