Skip to content

CMD sha

Zplutor edited this page Oct 7, 2023 · 5 revisions

sha

Calculates SHA of file or text.

Usage

sha [<text>] [/u8] [/u16] [/f]
    [/1] [/256] [/384] [/512]

text is the string to be calculated. If there are spaces in text, enclose it in double quotation marks ". Or use text block (press ALT+T to insert) to contain arbitrary text. If text is omitted, the active file will be calculated instead.

/u8, /u16 switches indicate what encoding text uses. They represent UTF-8 and UTF-16 respectively. UTF-8 is default if none of them is specified. If text is omitted and one of them is present, the active path will be treated as a text in corresponding encoding rather than a path.

/f switch indicates that text is a file path and the file will be calculated.

/1, /256, /384, /512 switches indicate which SHA algorithm is used. SHA256 is default if none of them is specified.

Example

Calculate SHA256 of specified text in UTF-16 encoding:
sha "this is a string" /u16

Calculate SHA1 of the active file:
sha /1

Calculate SHA256 of the active path in UTF-8 string:
sha /u8

Calculate SHA512 of a specified file:
sha C:\Windows\notepad.exe /f /512

Clone this wiki locally