Examples - aegoroff/hc GitHub Wiki

Calculate SHA1 hash of string 123

hc sha1 string -s 123

Calculate SHA1 hash of string 123 using low case

hc sha1 string -s 123 -l

Calculate SHA1 hash of a file

hc sha1 file -s file.txt

Calculate SHA1 hash of a file and output result in base64 form

hc sha1 file -s file.txt -b

Calculate SHA1 hash of the part of the file (the first kilobyte)

hc sha1 file -s file.txt -z 1024

Calculate SHA1 hash of the part of the file (one kilobyte skiping the first 512 bytes)

hc sha1 file -s file.txt -z 1024 -q 512

Validate file using it's SHA1 hash

hc sha1 file -s file.txt -m 8BD7954C40C1E59A900F71EA3A266732609915B1

Calculate SHA1 of all files in c:\dir directory

hc sha1 dir -s c:\dir

Calculate SHA1 of all files in c:\dir directory including all it's subdirectories

hc sha1 dir -r -s c:\dir

Calculate SHA1 of all files in c:\dir directory and output results in checksum file format

hc sha1 dir -s c:\dir --checksumfile

Calculate SHA1 of all files in c:\dir directory and save results to dir.sha1 in checksum file format

hc sha1 dir -s c:\dir --checksumfile -o dir.sha1

Calculate CRC32 of all files in c:\dir directory and save results to dir.sfv in SFV format

hc crc32 dir -s c:\dir --sfv -o dir.sfv

Calculate SHA1 of all exe files in c:\dir directory

hc sha1 dir -s c:\dir -i *.exe

Calculate SHA1 of all files in c:\dir directory excluding files with tmp extension

hc sha1 dir -s c:\dir -e *.tmp

Calculate SHA1 of all exe and dll files in c:\dir directory

hc sha1 dir -s c:\dir -i *.exe;*.dll

Calculate SHA1 of all exe files in c:\dir directory excluding files beginning with bad

hc sha1 dir -s c:\dir -i *.exe -e bad*

Searching file on C:\ drive using known SHA1 hash

hc sha1 dir -s c:\ -r -H 8BD7954C40C1E59A900F71EA3A266732609915B1

Restore string by it's SHA1 hash using default dictionary

hc sha1 hash -s 40BD001563085FC35165329EA1FF5C5ECBDBBEEF

Same as above (restore string by SHA1 hash) but hash in Base64 form

hc sha1 hash -b -s QL0AFWMIX8NRZTKeof9cXsvbvu8=

Restore string by it's SHA1 hash using user defined dictionary

hc sha1 hash -s 40BD001563085FC35165329EA1FF5C5ECBDBBEEF -a 0123456789

Restore string by it's SHA1 hash using user defined dictionary short form (only digits)

hc sha1 hash -s 40BD001563085FC35165329EA1FF5C5ECBDBBEEF -a 0-9

Restore string by it's SHA1 hash using user defined dictionary short form (low case latin letters)

hc sha1 hash -s 40BD001563085FC35165329EA1FF5C5ECBDBBEEF -a a-z

Restore string by it's SHA1 hash using user defined dictionary short form (digits, upper and low case latin letters)

hc sha1 hash -s 40BD001563085FC35165329EA1FF5C5ECBDBBEEF -a 0-9a-zA-Z

Restore string by it's SHA1 hash using user defined dictionary and string to restore min and max length

hc sha1 hash -s 40BD001563085FC35165329EA1FF5C5ECBDBBEEF -a 0123456789 -n 2 -x 6

Test performance SHA1 using default dictionary

hc sha1 hash -p

Test performance using user defined dictionary short form (only digits)

hc sha1 hash -p -a 0-9

Restore MD5 on GPU when a device is available (no extra flag):

hc md5 hash -s 202CB962AC59075B964B07152D234B70 -a 0-9 -n 1 -x 5

l2h

Hash one file, keep only non-empty ones:

l2h -q "from file f in '/tmp/file' where f.size > 0 select f.md5;"

List SHA1 of files larger than 1000 bytes, recursively:

l2h -q "from dir d in '/tmp' from file f in d.tree() where f.size > 1000 select f.sha1;"

Find a file by a known digest:

l2h -q "from dir d in '/tmp' from file f in d where f.md5('d41d8cd98f00b204e9800998ecf8427e') select f.path;"

Hash only a byte window of a file:

l2h -q "from file f in '/tmp/file' select f.offset(2).limit(4).md5;"

Restore a digest (same as hc md5 hash):

l2h -q "from hash x in '202CB962AC59075B964B07152D234B70' select x.dict('0-9').min(1).max(3).noProbe().md5;"

SFV-style line for CRC32:

l2h -q "from file f in '/tmp/a' select { f.crc32, f.name }.sfv();"

Run a query from a file, or only type-check it:

l2h -f query.l2h
l2h -n -f query.l2h

See l2h for the language.