ddh 1.2.0
dd's hashing utility
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
ddh, Generic hasher
ddh is a generic hasher available cross-platform (Windows, macOS, Linux, BSDs) and comes with more features than built-in OS utilities.
Feature Comparison
Feature | ddh | GNU coreutils | openssl | crc32(1)[^1] |
---|---|---|---|---|
Binary mode | ✔️ | ✔️ | ✔️ | ✔️ |
Text mode | ✔️ | ✔️ | ||
Check support | ✔️ | ✔️[^2] | ✔️ | ✔️ |
FILE support | ✔️ | ✔️ | ✔️ | ✔️ |
GNU-style checksums/hashes | ✔️ | ✔️ | ||
BSD-style checksums/hashes | ✔️ | ✔️ | ||
SRI-style checksums/hashes | ✔️ | |||
Memory-mapped file support | ✔️ | |||
Standard Input support | ✔️ | ✔️ | ✔️ |
Algorithm Availability
Checksum or Hash | ddh | GNU coreutils | openssl[^3] | crc32(1)[^1] |
---|---|---|---|---|
BSD sum | ✔️ (sum) | |||
System V sum | ✔️ (sum -s) | |||
Ethernet CRC | ✔️ (cksum) | |||
CRC-32 | ✔️ | ✔️ | ||
CRC-64-ISO | ✔️ | |||
CRC-64-ECMA | ✔️ | |||
MD5 | ✔️ | ✔️ (md5sum) | ✔️ | |
RIPEMD-160 | ✔️ | ✔️ | ||
SHA-1 | ✔️ | ✔️ (sha1sum) | ✔️ | |
SHA-2 | ✔️ | ✔️[^4] | ✔️ | |
SHA-3 | ✔️ | ✔️ | ||
SHAKE | ✔️ | ✔️ | ||
BLAKE2 | ✔️ (b2sum) | ✔️ | ||
BLAKE3 | ✔️ (b3sum) |
Usage
Typical usage looks like this: ddh md5 LICENSE
ddh
: Command;md5
: Select MD-5;LICENSE
: File.
With no arguments, the help page is shown.
To get a list of options available, use the --help
argument.
To get a list of supported checksums and hashes, use the list
command.
Hash styles
Style | Example |
---|---|
GNU (default) | 1d267ceb3a8d8f75f1be3011ee4cbf53 |
BSD (--tag ) | MD5(LICENSE)= 1d267ceb3a8d8f75f1be3011ee4cbf53 |
SRI (--sri ) | md5-HSZ86zqNj3XxvjAR7ky/Uw== |
Standard Input (stdin)
To use the standard input (stdin) method, either:
- Omit the third parameter (e.g.,
ddh md5
); - Or use the
-
character (e.g.,ddh md5 -
).
File Pattern Globbing (*
vs. '*'
)
This utility supports file globbing out of the box using std.file.dirEntries
.
However, while useful on Windows, most UNIX-like terminals support in-shell
globbing. This may behave differently than the dirEntries
function.
To force the usage of the embedded globbing mechanism, you may want to use
'*'
or \*
. To disable it, use the --
parameter.
The globbing pattern is further explained on dlang.org.
The default parameters used in dirEntries
are:
SpanMode
:shallow
(same-level directory);- And
followSymlink
:true
(follows soft symbolic links).
NOTE: The embedded globbing system includes hidden files.
EXAMPLE: A pattern such as src/*.{d,dd}
:
- Matches
src/example.d
,src/.dd
, andsrc/file.dd
; - But doesn't match
example.d
,src/.ddd
, andsrc/.e
; - Basically all files ending with
.d
and.dd
in thesrc
directory, following symlinks.
Memory-mapped Files
The mmfile mode's performance may vary on systems. Typically, file mode is faster on Windows, and mmfile mode is faster on Linux systems.
The default is file.
Checking against a list
To check hashes in a list, like for example:
34f53abbdbc66ebdb969c5a77f0f8902 .gitignore
301dff35a1c11b231b67aaaed0e7be46 ddh
38605d99f2cd043879c401ff1fe292cf ddh-test-library.exe
9a2fdb96ff77f4d71510b38c2f278ff6 ddh.exe
Simply use the -c
option: ddh md5 -c LIST
.
Only the GNU and BSD (tag) styles can be used in file checks.
Compiling
Compiling requires a recent D compiler and DUB.
To compile a debug build with the default compiler:
dub build
Release recommendation with the LDC compiler:
dub build -b release-nobounds --compiler=ldc2
- 1.2.0 released 3 years ago
- dd86k/ddh
- github.com/dd86k/ddh
- public domain
- Authors:
- Dependencies:
- sha3-d
- Versions:
-
2.0.2 2022-Dec-24 2.0.1 2022-Nov-08 2.0.0 2022-Oct-31 1.4.0 2022-Apr-26 1.3.0 2021-Dec-23 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
24 downloads total
-
- Score:
- 0.0
- Short URL:
- ddh.dub.pm