LinuxCommandLibrary

hashid

Identify hash types

TLDR

Identify hashes from stdin (through typing, copying and pasting, or piping the hash into the program)

$ hashid
copy

Identify one or more hashes
$ hashid [hash1 hash2 ...]
copy

Identify hashes on a file (one hash per line)
$ hashid [path/to/hashes.txt]
copy

Show all possible hash types (including salted hashes)
$ hashid --extended [hash]
copy

Show hashcat's mode number and john's format string of the hash types
$ hashid --mode --john [hash]
copy

Save output to a file instead of printing to stdout
$ hashid --outfile [path/to/output.txt] [hash]
copy

SYNOPSIS

hashid [-s salt] [-l length] [-a alphabet] integers...

PARAMETERS

-s salt
    Specifies the salt string. The salt is a secret key used in the hashing algorithm. Changing the salt will result in different IDs being generated for the same integers. If not provided, a default salt is used, making the generated IDs less secure.

-l length
    Sets the minimum length of the generated hash ID. If the encoded ID is shorter than this value, it will be padded with additional characters.

-a alphabet
    Defines the alphabet used to generate the hash ID. The default alphabet is typically alphanumeric, but you can customize it by providing a different character set.

integers...
    A list of one or more integer values to be encoded into hash IDs.

DESCRIPTION

The `hashid` command, often associated with the `hashids` library, is a command-line utility used to generate short, unique, and non-sequential identifiers (IDs) from integers. This is particularly useful in scenarios where you want to obfuscate database IDs in URLs or prevent users from easily predicting sequential values. The command takes integer inputs and uses a reversible hashing algorithm, based on a secret salt, to encode them into a string. The resulting string is alphanumeric and can be customized in terms of minimum length and allowed characters.

It avoids generating consecutive, predictable hashes.

The `hashid` command is typically installed as part of a broader software package or through a package manager, rather than being a standard Linux system utility.

CAVEATS

The security of the generated IDs depends heavily on the strength and secrecy of the salt. Avoid using default salts in production environments, as they are easily guessable. Also, while the hash IDs are non-sequential, they are not cryptographically secure; they should not be used as a primary security measure.

EXAMPLES

Encode a single integer:
`hashid 12345`

Encode multiple integers with a specific salt:
`hashid -s 'mysecret' 123 456 789`

Encode with a minimum length of 10:
`hashid -l 10 9876`

Encode with a custom alphabet:
`hashid -a 'abcdefghijk' 100`

DEPENDENCIES

The `hashid` command typically relies on a programming language runtime (e.g., Python, Ruby, Node.js) and the corresponding 'hashids' library implementation. Make sure these dependencies are installed before using the command.

HISTORY

The `hashid` command is not a standard part of the Linux core utilities. It is more commonly associated with specific programming libraries, such as the 'hashids' library, which provides similar functionality in various programming languages (e.g., Python, JavaScript, PHP). The command-line utility is usually created as a wrapper around these libraries for convenient usage from the terminal. The development and usage of this utility depend on the presence and evolution of those specific libraries.

SEE ALSO

uuidgen(1), md5sum(1), sha1sum(1)

Copied to clipboard