Cryptographic Hash
technology.cryptographic.hashOutput of a cryptographic hash function (MD5, SHA-1, SHA-256, etc.). Detected as hex string of fixed length. Broad categorization by length.
Worked samples
DuckDB 1.5.5 · finetype 0.6.64
| Value | As VARCHAR | algorithm |
|---|---|---|
| 5d41402abc4b2a76b9719d911017c592 | 5d41402abc4b2a76b9719d911017c592 | MD5 |
| aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d | aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d | SHA1 |
| 2c26b46911185131006dfb3b57a99d73 | 2c26b46911185131006dfb3b57a99d73 | MD5 |
Shape
^[0-9a-f]{32}$|^[0-9a-f]{40}$|^[0-9a-f]{64}$|^[0-9a-f]{128}$| Value | Length | Shape |
|---|---|---|
| 5d41402abc4b2a76b9719d911017c592 | 32 | matches |
| aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d | 40 | matches |
| 2c26b46911185131006dfb3b57a99d73 | 32 | matches |
| 5d41402abc4b2a76b9719d911017c59 | 31 | rejected: one character short |
Told apart
1 of the 2 other cryptographic types accept every one of these samples on shape alone.
- URL-Safe Base64 Tokenmatches them by pattern
Background
Origin
RFC 1321, The MD5 Message-Digest Algorithm, was written by R. Rivest and published in April 1992.[1] RFC 1321 describes MD5 as producing a 128-bit fingerprint or message digest of its input.[1] RFC 1321 says the MD5 algorithm is intended for digital signature applications.[1] The reference code in RFC 1321 prints a message digest in hexadecimal.[1] The test suite in RFC 1321 gives the MD5 digest of the empty string as d41d8cd98f00b204e9800998ecf8427e.[1] MD5 hashes are typically represented as a sequence of 32 hexadecimal digits.[2]
SHA-1 produces a 160-bit (20-byte) hash value, typically written as 40 hexadecimal digits.[3] The SHA-2 family was designed by the National Security Agency and first published in 2001.[4] NIST's FIPS 180-4, the Secure Hash Standard, specifies seven hash algorithms: SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256.[5] FIPS 180-4 states that the digests are used to detect whether messages have been changed since the digests were generated.[6]
Use
PostgreSQL's md5 function computes the MD5 hash of its argument with the result written in hexadecimal, so md5('abc') returns 900150983cd24fb0d6963f7d28e17f72.[7] Python's hashlib hexdigest method returns the digest as a string of double length containing only hexadecimal digits, for exchanging the value safely in email or other non-binary environments.[8]
NIST deprecated the use of SHA-1 in 2011 and disallowed its use for digital signatures at the end of 2013.[5] Researchers at CWI Amsterdam and Google published two different PDF files with the same SHA-1 hash on 23 February 2017.[3] The GNU Coreutils manual says the chance of two files accidentally having identical MD5 sums is vanishingly small, but that md5sum should not be considered secure against malicious tampering.[9] An MD5 or SHA-1 column is still fine for spotting duplicate or corrupted files, but treat it as weak evidence that nobody has tampered with them. (Meridian's view)
Where you'll meet it
The SHA256SUMS file for Debian's current amd64 CD images lists one 64-character lowercase hexadecimal digest per line, followed by the image's file name.[10]
Sources
- [1]RFC 1321: The MD5 Message-Digest Algorithmstandard
- [2]MD5secondary source
- [3]SHA-1secondary source
- [4]SHA-2secondary source
- [5]Hash Functions | CSRCorganisation
- [6]FIPS 180-4, Secure Hash Standard (SHS) | CSRCcatalogue entry
- [7]PostgreSQL: Documentation: 18: 9.4. String Functions and Operatorsdocumentation
- [8]hashlib — Secure hashes and message digestsdocumentation
- [9]md5sum invocation (GNU Coreutils 9.12)documentation
- [10]SHA256SUMSdataset
Detection notes
v1 migration: Was cryptographic.hash. Decompose infers algorithm from length: 32→MD5, 40→SHA1, 64→SHA256, 128→SHA512. No cryptographic validation (can't verify true hash without known input).
Use it
$ finetype infer -i "5d41402abc4b2a76b9719d911017c592" --mode column
→ technology.cryptographic.hash
SELECT ft_infer('5d41402abc4b2a76b9719d911017c592');
-- → 'technology.cryptographic.hash'CAST({col} AS VARCHAR)Schema
https://meridian.online/schemas/technology.cryptographic.hash · Frictionless type string
finetype taxonomy technology.cryptographic.hash -o json-schema