Skip to main content

pypi build status coverage

For any int/str/bytes, return deterministic human-readable string generated by coolname.

>>> from coolname_hash import pseudohash_slug
>>> pseudohash_slug(123)
'ambrosial-amorphous-jackal-of-expertise'
>>> pseudohash_slug('qwerty')
'logical-ingenious-albatross-of-spirit'
>>> pseudohash_slug(b'\x00\x01\xFF')
'small-polar-mole-of-wholeness'

Get sequences instead of strings:

>>> from coolname_hash import pseudohash
>>> pseudohash('foobar')
['loud', 'gabby', 'finch', 'of', 'variation']

Pseudohash functions are stateless, thread-safe and don’t use the random module.

This package is a drop-in replacement for coolname, you can also import and use all of the ordinary functions like generate and generate_slug. You can create custom RandomGenerator as per documentation, and use pseudohash and pseudohash_slug methods.

WARNING: Random sequence varies from version to version of coolname, so make sure you pin version exactly in your project’s requirements file. You MUST include something like coolname_hash==1.0.0 or coolname_hash>=1.0,<2.0 in your project’s dependencies. Don’t specify coolname in your requirements file at all - coolname_hash always pins specific version of it. coolname version (except patches) only changes in major releases of coolname_hash.

If you care about consistency of pseudohashes across multiple executions of your application, the best practice is to add an import-time assert like this, with the actual pseudohash for 0:

from coolname_hash import pseudohash_slug
assert pseudohash_slug(0) == 'elusive-fabulous-sloth-of-wizardry'  # NEVER CHANGE THIS LINE: specific version of coolname_hash is required

Caveats for variable types:

  • Same integer represented as int/str/bytes (e.g. 123, '123' and b'123') will yield the same result.

  • Same text as bytes and str will yield the same result when encoded in UTF-8.

  • Float/Decimal and Boolean values are not allowed (makes no sense anyway).

  • None is not allowed, you should handle it explicitly in your code.

Release files for coolname-hash 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coolname-hash 1.0.0
File Size Uploaded
coolname_hash-1.0.0.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coolname-hash 1.0.0
File Interpreter ABI Platform
coolname_hash-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.0 kB

Release files / coolname_hash-1.0.0.tar.gz

Download URL coolname_hash-1.0.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0c404efad8d472a9f6b80ac815ccc09f7dfe43b6e4b2b5a06d3456f0727e3031
BLAKE2b-256 checksum
How to use checksums
5a603787b57593d7f2eb1acf40bea966428bf52414ffddb2820ef2019781ee3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / coolname_hash-1.0.0-py3-none-any.whl

Download URL coolname_hash-1.0.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
debd8a21b955dcb3ec93872430399b6d3fc8454d99ba34a4b798be3bf42aba68
BLAKE2b-256 checksum
How to use checksums
d783fcbd75513b767ed686c2761af811d1c9726a8569c2720c1f531a9b07fbe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page