Hashing, HMAC, and String Comparison
Cryptology Monster includes cryptographic hashing, HMAC message authentication, and exact string comparison. These tools serve different purposes and should not be confused with one another.
Cryptographic Hashing
A cryptographic hash function converts input data into a fixed-length digest.
Cryptology Monster supports:
| Algorithm | Digest Length | Hex Characters |
|---|---|---|
| SHA-256 | 256 bits | 64 |
| SHA-384 | 384 bits | 96 |
| SHA-512 | 512 bits | 128 |
Hashing does not encrypt data and cannot ordinarily be reversed to recover the input.
Hashing Text
- Select Hash.
- Choose SHA-256, SHA-384, or SHA-512.
- Enter text.
- Click Hash Text.
- Copy the hexadecimal digest.
Example
SHA-256 of:
hellois:
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824The text is encoded as UTF-8 before hashing.
Even small changes to the input generally produce different digests.
Hashing Files
- Select Hash.
- Choose a hash algorithm.
- Select a file.
- Click Hash File.
- Review the digest.
The file hashing function processes the original bytes without converting them to text.
The result window displays:
- Filename
- File size in bytes
- Hexadecimal digest
Common Uses
- Comparing file checksums
- Detecting accidental file changes
- Checking downloaded-file integrity against a trusted digest
- Identifying duplicate byte-for-byte content
A hash alone does not prove authenticity unless the expected hash is obtained from a trustworthy source.
HMAC Message Authentication
HMAC is a keyed message authentication mechanism.
Unlike an ordinary hash, HMAC requires a secret key.
Supported Algorithms
| HMAC Algorithm | Hash |
|---|---|
| HMAC-SHA-256 | SHA-256 |
| HMAC-SHA-384 | SHA-384 |
| HMAC-SHA-512 | SHA-512 |
Generating an HMAC
- Select HMAC.
- Choose the algorithm.
- Enter the message.
- Enter the secret key.
- Enable Key is hex if the secret is entered as hexadecimal bytes.
- Click Sign.
Output
The result contains the HMAC signature in:
- Hexadecimal
- Base64url
These representations contain the same signature bytes.
Verifying an HMAC
- Select the same HMAC algorithm used to generate the signature.
- Enter the original message.
- Enter the shared secret key.
- Enter the signature.
- Enable Signature is hex if applicable.
- Click Verify.
The result indicates whether the signature matches.
Example Message
transaction=approvedIf the secret or message changes, the computed HMAC will generally no longer match.
Key Formats
Text Secret
When Key is hex is disabled, the entered secret is UTF-8 encoded.
Hex Secret
When enabled, the application interprets the secret as hexadecimal bytes.
For example:
48656c6c6frepresents the bytes of Hello.
Use the same key representation for signing and verification.
HMAC Security
HMAC provides integrity and authentication to parties sharing the secret.
It does not encrypt the message.
Anyone possessing the shared secret can generate valid HMAC signatures.
String Comparison
The String Comparison tool checks whether two JavaScript strings are exactly equal.
Usage
- Select Compare Strings.
- Enter the first string.
- Enter the second string.
- Click Compare.
Results
The tool reports either:
Strings match exactly.or:
Strings do NOT match.When the lengths differ, it also displays both lengths.
Comparison Behavior
The implementation uses strict JavaScript equality:
str1 === str2The comparison is:
- Case-sensitive
- Whitespace-sensitive
- Sensitive to character differences
For example:
Helloand:
hellodo not match.
Security Limitation
The tool does not implement constant-time comparison.
It should not be used as a substitute for proper cryptographic verification of secret tokens or authentication tags.
Choosing the Right Tool
| Requirement | Tool |
|---|---|
| Produce a checksum | Hash |
| Compare a file with a known trusted checksum | Hash |
| Authenticate a message using a shared secret | HMAC |
| Verify a shared-secret signature | HMAC Verify |
| Check whether two text strings are identical | Compare Strings |
Important: Hashing, message authentication, and encryption solve different security problems.
Updated 9 days ago
